From cedb1fd0da6efae3a5688fcb52d7d45511336618 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:02:52 +0000 Subject: [PATCH 1/5] Update dependency org.matrix.rustcomponents:sdk-android to v0.2.70 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a0fd714363..2943814b01 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -173,7 +173,7 @@ jsoup = "org.jsoup:jsoup:1.18.1" 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.69" +matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.70" 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" } From 213dd408f26bf34fcf24f2f7f867997a55924a23 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 11 Dec 2024 09:57:45 +0100 Subject: [PATCH 2/5] Handle new EventCache Exception --- .../libraries/matrix/impl/auth/AuthenticationException.kt | 1 + .../matrix/impl/auth/AuthenticationExceptionMappingTest.kt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationException.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationException.kt index cf48d68c70..c3a920dc69 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationException.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationException.kt @@ -22,6 +22,7 @@ fun Throwable.mapAuthenticationException(): AuthenticationException { is ClientBuildException.SlidingSync -> AuthenticationException.Generic(message) is ClientBuildException.WellKnownDeserializationException -> AuthenticationException.Generic(message) is ClientBuildException.WellKnownLookupFailed -> AuthenticationException.Generic(message) + is ClientBuildException.EventCache -> AuthenticationException.Generic(message) } else -> AuthenticationException.Generic(message) } diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationExceptionMappingTest.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationExceptionMappingTest.kt index 81a1667f4e..810adbfb3a 100644 --- a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationExceptionMappingTest.kt +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationExceptionMappingTest.kt @@ -52,6 +52,8 @@ class AuthenticationExceptionMappingTest { .isException("WellKnown Deserialization") assertThat(ClientBuildException.WellKnownLookupFailed("WellKnown Lookup Failed").mapAuthenticationException()) .isException("WellKnown Lookup Failed") + assertThat(ClientBuildException.EventCache("EventCache error").mapAuthenticationException()) + .isException("EventCache error") } private inline fun ThrowableSubject.isException(message: String) { From 1ea5388dc2a762ebf025c2799b10b02c307e6939 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 11 Dec 2024 09:59:13 +0100 Subject: [PATCH 3/5] `DayDivider` has been renamed to `DateDivider`. For the main timeline, we can keep the name `VirtualTimelineItem.DayDivider` --- .../impl/timeline/item/virtual/VirtualTimelineItemMapper.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/item/virtual/VirtualTimelineItemMapper.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/item/virtual/VirtualTimelineItemMapper.kt index 841194abb4..befdf8903b 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/item/virtual/VirtualTimelineItemMapper.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/item/virtual/VirtualTimelineItemMapper.kt @@ -13,7 +13,7 @@ import org.matrix.rustcomponents.sdk.VirtualTimelineItem as RustVirtualTimelineI class VirtualTimelineItemMapper { fun map(virtualTimelineItem: RustVirtualTimelineItem): VirtualTimelineItem { return when (virtualTimelineItem) { - is RustVirtualTimelineItem.DayDivider -> VirtualTimelineItem.DayDivider(virtualTimelineItem.ts.toLong()) + is RustVirtualTimelineItem.DateDivider -> VirtualTimelineItem.DayDivider(virtualTimelineItem.ts.toLong()) RustVirtualTimelineItem.ReadMarker -> VirtualTimelineItem.ReadMarker } } From 6fab5a5eea438cf2d5f49d600909a7965fa579cf Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 11 Dec 2024 10:08:53 +0100 Subject: [PATCH 4/5] Add TODO for the event cache --- .../android/libraries/matrix/impl/RustMatrixClientFactory.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClientFactory.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClientFactory.kt index 0ce1d2362b..e688452510 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClientFactory.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClientFactory.kt @@ -109,6 +109,9 @@ class RustMatrixClientFactory @Inject constructor( .addRootCertificates(userCertificatesProvider.provides()) .autoEnableBackups(true) .autoEnableCrossSigning(true) + // TODO Add a feature flag to enable persistent storage + // See https://github.com/matrix-org/matrix-rust-sdk/pull/4396 + .useEventCachePersistentStorage(false) .roomKeyRecipientStrategy( strategy = if (featureFlagService.isFeatureEnabled(FeatureFlags.OnlySignedDeviceIsolationMode)) { CollectStrategy.IdentityBasedStrategy From 11ebe163d344a4d9bb6332380ad2b3d084eb197d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 11 Dec 2024 10:41:55 +0100 Subject: [PATCH 5/5] Fix tests --- .../matrix/impl/fixtures/fakes/FakeRustClientBuilder.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeRustClientBuilder.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeRustClientBuilder.kt index c22e7adb79..a1af968c34 100644 --- a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeRustClientBuilder.kt +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeRustClientBuilder.kt @@ -41,6 +41,7 @@ class FakeRustClientBuilder : ClientBuilder(NoPointer) { override fun slidingSyncVersionBuilder(versionBuilder: SlidingSyncVersionBuilder) = this override fun userAgent(userAgent: String) = this override fun username(username: String) = this + override fun useEventCachePersistentStorage(value: Boolean) = this override suspend fun buildWithQrCode(qrCodeData: QrCodeData, oidcConfiguration: OidcConfiguration, progressListener: QrLoginProgressListener): Client { return FakeRustClient()