From a0607b5a26c14abb24ab8e05975f1f0f243771ab Mon Sep 17 00:00:00 2001 From: ganfra Date: Fri, 17 Jan 2025 09:39:22 +0100 Subject: [PATCH] dependencies(sdk) : update to 0.2.75 --- gradle/libs.versions.toml | 2 +- .../libraries/matrix/impl/RustMatrixClient.kt | 4 +- .../libraries/matrix/impl/media/ImageInfo.kt | 1 + .../matrix/impl/timeline/RustTimeline.kt | 79 +++++++++++-------- .../matrix/impl/tracing/RustTracingService.kt | 3 + .../fixtures/factories/EventTimelineItem.kt | 2 + .../impl/fixtures/factories/RoomInfo.kt | 3 + .../impl/fixtures/factories/RoomMember.kt | 2 + 8 files changed, 62 insertions(+), 34 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 40fc3c35c3..043acc06ed 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -173,7 +173,7 @@ jsoup = "org.jsoup:jsoup:1.18.3" appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" } molecule-runtime = "app.cash.molecule:molecule-runtime:2.0.0" timber = "com.jakewharton.timber:timber:5.0.1" -matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.73" +matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.75" matrix_richtexteditor = { module = "io.element.android:wysiwyg", version.ref = "wysiwyg" } matrix_richtexteditor_compose = { module = "io.element.android:wysiwyg-compose", version.ref = "wysiwyg" } sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt index bd85a7f849..4f470d556e 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt @@ -311,8 +311,8 @@ class RustMatrixClient( isEncrypted = createRoomParams.isEncrypted, isDirect = createRoomParams.isDirect, visibility = when (createRoomParams.visibility) { - RoomVisibility.PUBLIC -> RustRoomVisibility.PUBLIC - RoomVisibility.PRIVATE -> RustRoomVisibility.PRIVATE + RoomVisibility.PUBLIC -> RustRoomVisibility.Public + RoomVisibility.PRIVATE -> RustRoomVisibility.Private }, preset = when (createRoomParams.visibility) { RoomVisibility.PRIVATE -> { diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/media/ImageInfo.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/media/ImageInfo.kt index 0eb2b70d8c..e43ded8be1 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/media/ImageInfo.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/media/ImageInfo.kt @@ -28,4 +28,5 @@ fun ImageInfo.map(): RustImageInfo = RustImageInfo( thumbnailInfo = thumbnailInfo?.map(), thumbnailSource = null, blurhash = blurhash, + isAnimated = null ) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt index 7013b4bb78..3e10ce1a5b 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt @@ -71,6 +71,7 @@ import org.matrix.rustcomponents.sdk.FormattedBody import org.matrix.rustcomponents.sdk.MessageFormat import org.matrix.rustcomponents.sdk.PollData import org.matrix.rustcomponents.sdk.SendAttachmentJoinHandle +import org.matrix.rustcomponents.sdk.UploadParameters import org.matrix.rustcomponents.sdk.use import timber.log.Timber import uniffi.matrix_sdk_ui.LiveBackPaginationStatus @@ -323,6 +324,7 @@ class RustTimeline( formattedCaption = formattedCaption?.let { FormattedBody(body = it, format = MessageFormat.Html) }, + mentions = null, ) inner.edit( newContent = editedContent, @@ -355,14 +357,17 @@ class RustTimeline( val useSendQueue = featureFlagsService.isFeatureEnabled(FeatureFlags.MediaUploadOnSendQueue) return sendAttachment(listOfNotNull(file, thumbnailFile)) { inner.sendImage( - url = file.path, - thumbnailUrl = thumbnailFile?.path, + params = UploadParameters( + filename = file.path, + caption = caption, + formattedCaption = formattedCaption?.let { + FormattedBody(body = it, format = MessageFormat.Html) + }, + useSendQueue = useSendQueue, + mentions = null, + ), + thumbnailPath = thumbnailFile?.path, imageInfo = imageInfo.map(), - caption = caption, - formattedCaption = formattedCaption?.let { - FormattedBody(body = it, format = MessageFormat.Html) - }, - useSendQueue = useSendQueue, progressWatcher = progressCallback?.toProgressWatcher() ) } @@ -379,14 +384,17 @@ class RustTimeline( val useSendQueue = featureFlagsService.isFeatureEnabled(FeatureFlags.MediaUploadOnSendQueue) return sendAttachment(listOfNotNull(file, thumbnailFile)) { inner.sendVideo( - url = file.path, - thumbnailUrl = thumbnailFile?.path, + params = UploadParameters( + filename = file.path, + caption = caption, + formattedCaption = formattedCaption?.let { + FormattedBody(body = it, format = MessageFormat.Html) + }, + useSendQueue = useSendQueue, + mentions = null, + ), + thumbnailPath = thumbnailFile?.path, videoInfo = videoInfo.map(), - caption = caption, - formattedCaption = formattedCaption?.let { - FormattedBody(body = it, format = MessageFormat.Html) - }, - useSendQueue = useSendQueue, progressWatcher = progressCallback?.toProgressWatcher() ) } @@ -402,13 +410,16 @@ class RustTimeline( val useSendQueue = featureFlagsService.isFeatureEnabled(FeatureFlags.MediaUploadOnSendQueue) return sendAttachment(listOf(file)) { inner.sendAudio( - url = file.path, + params = UploadParameters( + filename = file.path, + caption = caption, + formattedCaption = formattedCaption?.let { + FormattedBody(body = it, format = MessageFormat.Html) + }, + useSendQueue = useSendQueue, + mentions = null, + ), audioInfo = audioInfo.map(), - caption = caption, - formattedCaption = formattedCaption?.let { - FormattedBody(body = it, format = MessageFormat.Html) - }, - useSendQueue = useSendQueue, progressWatcher = progressCallback?.toProgressWatcher() ) } @@ -424,13 +435,16 @@ class RustTimeline( val useSendQueue = featureFlagsService.isFeatureEnabled(FeatureFlags.MediaUploadOnSendQueue) return sendAttachment(listOf(file)) { inner.sendFile( - url = file.path, + params = UploadParameters( + filename = file.path, + caption = caption, + formattedCaption = formattedCaption?.let { + FormattedBody(body = it, format = MessageFormat.Html) + }, + useSendQueue = useSendQueue, + mentions = null, + ), fileInfo = fileInfo.map(), - caption = caption, - formattedCaption = formattedCaption?.let { - FormattedBody(body = it, format = MessageFormat.Html) - }, - useSendQueue = useSendQueue, progressWatcher = progressCallback?.toProgressWatcher(), ) } @@ -543,13 +557,16 @@ class RustTimeline( val useSendQueue = featureFlagsService.isFeatureEnabled(FeatureFlags.MediaUploadOnSendQueue) return sendAttachment(listOf(file)) { inner.sendVoiceMessage( - url = file.path, + params = UploadParameters( + filename = file.path, + // Maybe allow a caption in the future? + caption = null, + formattedCaption = null, + useSendQueue = useSendQueue, + mentions = null, + ), audioInfo = audioInfo.map(), waveform = waveform.toMSC3246range(), - // Maybe allow a caption in the future? - caption = null, - formattedCaption = null, - useSendQueue = useSendQueue, progressWatcher = progressCallback?.toProgressWatcher(), ) } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/tracing/RustTracingService.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/tracing/RustTracingService.kt index 159cfed74f..b9fdeda6ce 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/tracing/RustTracingService.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/tracing/RustTracingService.kt @@ -20,6 +20,7 @@ import javax.inject.Inject @ContributesBinding(AppScope::class) class RustTracingService @Inject constructor(private val buildMeta: BuildMeta) : TracingService { override fun setupTracing(tracingConfiguration: TracingConfiguration) { + /* val filter = tracingConfiguration.filterConfiguration val rustTracingConfiguration = org.matrix.rustcomponents.sdk.TracingConfiguration( filter = tracingConfiguration.filterConfiguration.filter, @@ -28,6 +29,8 @@ class RustTracingService @Inject constructor(private val buildMeta: BuildMeta) : ) org.matrix.rustcomponents.sdk.setupTracing(rustTracingConfiguration) Timber.v("Tracing config filter = $filter: ${filter.filter}") + + */ } override fun createTimberTree(): Timber.Tree { diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/EventTimelineItem.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/EventTimelineItem.kt index fcedab0273..ff8fcaa78d 100644 --- a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/EventTimelineItem.kt +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/EventTimelineItem.kt @@ -37,6 +37,7 @@ fun aRustEventTimelineItem( origin: EventItemOrigin? = EventItemOrigin.SYNC, canBeRepliedTo: Boolean = true, shieldsState: ShieldState? = null, + localCreatedAt: ULong? = null, ) = EventTimelineItem( isRemote = isRemote, eventOrTransactionId = eventOrTransactionId, @@ -51,6 +52,7 @@ fun aRustEventTimelineItem( reactions = reactions, readReceipts = readReceipts, origin = origin, + localCreatedAt = localCreatedAt, lazyProvider = FakeRustLazyTimelineItemProvider( debugInfo = debugInfo, shieldsState = shieldsState, diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/RoomInfo.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/RoomInfo.kt index 2bfd1b8804..f5341a1c5e 100644 --- a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/RoomInfo.kt +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/RoomInfo.kt @@ -13,6 +13,7 @@ import io.element.android.libraries.matrix.test.A_ROOM_NAME import org.matrix.rustcomponents.sdk.JoinRule import org.matrix.rustcomponents.sdk.Membership import org.matrix.rustcomponents.sdk.RoomHero +import org.matrix.rustcomponents.sdk.RoomHistoryVisibility import org.matrix.rustcomponents.sdk.RoomInfo import org.matrix.rustcomponents.sdk.RoomMember import org.matrix.rustcomponents.sdk.RoomNotificationMode @@ -49,6 +50,7 @@ fun aRustRoomInfo( pinnedEventIds: List = listOf(), roomCreator: UserId? = null, joinRule: JoinRule? = null, + historyVisibility: RoomHistoryVisibility = RoomHistoryVisibility.Joined, ) = RoomInfo( id = id, displayName = displayName, @@ -81,4 +83,5 @@ fun aRustRoomInfo( pinnedEventIds = pinnedEventIds, creator = roomCreator?.value, joinRule = joinRule, + historyVisibility = historyVisibility ) diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/RoomMember.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/RoomMember.kt index d6159088ab..a38496222c 100644 --- a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/RoomMember.kt +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/factories/RoomMember.kt @@ -21,6 +21,7 @@ fun aRustRoomMember( powerLevel: Long = 0L, isIgnored: Boolean = false, role: RoomMemberRole = RoomMemberRole.USER, + membershipChangeReason: String? = null, ) = RoomMember( userId = userId.value, displayName = displayName, @@ -31,4 +32,5 @@ fun aRustRoomMember( normalizedPowerLevel = powerLevel, isIgnored = isIgnored, suggestedRoleForPowerLevel = role, + membershipChangeReason = membershipChangeReason, )