From 9f24048e9625e4e3d8a5e785e6f17896f97cef8b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 14:15:59 +0000 Subject: [PATCH 1/4] fix(deps): update dependency org.matrix.rustcomponents:sdk-android to v25.11.24 --- 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 593aaa2d70..6986e3577e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -178,7 +178,7 @@ test_detekt_test = { module = "io.gitlab.arturbosch.detekt:detekt-test", version # https://github.com/matrix-org/matrix-rust-components-kotlin/commits/main/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt # All new features should not be implemented in the pull request that upgrades the version, developers should # only fix API breaks and may add some TODOs. -matrix_sdk = "org.matrix.rustcomponents:sdk-android:25.11.19" +matrix_sdk = "org.matrix.rustcomponents:sdk-android:25.11.24" # Others coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" } From 8a599a1e51a51a9ff36bd3aa1d33950e96718eeb Mon Sep 17 00:00:00 2001 From: ganfra Date: Mon, 24 Nov 2025 20:22:11 +0100 Subject: [PATCH 2/4] deps(sdk) : add fallbackToServer on userIdentity api. --- .../matrix/api/encryption/EncryptionService.kt | 6 +++--- .../matrix/impl/encryption/RustEncryptionService.kt | 12 ++++-------- .../matrix/test/encryption/FakeEncryptionService.kt | 7 +------ 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/encryption/EncryptionService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/encryption/EncryptionService.kt index 4ae75774c1..aefad517dc 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/encryption/EncryptionService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/encryption/EncryptionService.kt @@ -64,8 +64,6 @@ interface EncryptionService { */ suspend fun startIdentityReset(): Result - suspend fun isUserVerified(userId: UserId): Result - /** * Remember this identity, ensuring it does not result in a pin violation. */ @@ -82,8 +80,10 @@ interface EncryptionService { /** * Get the identity state of a user, if known. + * @param userId the user id to get the identity for. + * @param fallbackToServer whether to fallback to fetching the identity from the server if not known locally. Defaults to true. */ - suspend fun getUserIdentity(userId: UserId): Result + suspend fun getUserIdentity(userId: UserId, fallbackToServer: Boolean = true): Result } /** diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RustEncryptionService.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RustEncryptionService.kt index 6ebf80337c..e081d1c9f1 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RustEncryptionService.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RustEncryptionService.kt @@ -240,10 +240,6 @@ class RustEncryptionService( } } - override suspend fun isUserVerified(userId: UserId): Result = runCatchingExceptions { - getUserIdentityInternal(userId).isVerified() - } - override suspend fun pinUserIdentity(userId: UserId): Result = runCatchingExceptions { getUserIdentityInternal(userId).pin() } @@ -252,8 +248,8 @@ class RustEncryptionService( getUserIdentityInternal(userId).withdrawVerification() } - override suspend fun getUserIdentity(userId: UserId): Result = runCatchingExceptions { - val identity = getUserIdentityInternal(userId) + override suspend fun getUserIdentity(userId: UserId, fallbackToServer: Boolean): Result = runCatchingExceptions { + val identity = getUserIdentityInternal(userId, fallbackToServer) val isVerified = identity.isVerified() when { identity.hasVerificationViolation() -> IdentityState.VerificationViolation @@ -263,10 +259,10 @@ class RustEncryptionService( } } - suspend fun getUserIdentityInternal(userId: UserId): UserIdentity { + private suspend fun getUserIdentityInternal(userId: UserId, fallbackToServer: Boolean = true): UserIdentity { return service.userIdentity( userId = userId.value, - // requestFromHomeserverIfNeeded = true, + fallbackToServer = fallbackToServer, ) ?: error("User identity not found") } diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/encryption/FakeEncryptionService.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/encryption/FakeEncryptionService.kt index a94de15f1e..04e3779298 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/encryption/FakeEncryptionService.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/encryption/FakeEncryptionService.kt @@ -26,7 +26,6 @@ import kotlinx.coroutines.flow.flowOf class FakeEncryptionService( var startIdentityResetLambda: () -> Result = { lambdaError() }, private val pinUserIdentityResult: (UserId) -> Result = { lambdaError() }, - private val isUserVerifiedResult: (UserId) -> Result = { lambdaError() }, private val withdrawVerificationResult: (UserId) -> Result = { lambdaError() }, private val getUserIdentityResult: (UserId) -> Result = { lambdaError() }, private val enableRecoveryLambda: (Boolean) -> Result = { lambdaError() }, @@ -139,11 +138,7 @@ class FakeEncryptionService( return withdrawVerificationResult(userId) } - override suspend fun isUserVerified(userId: UserId): Result = simulateLongTask { - isUserVerifiedResult(userId) - } - - override suspend fun getUserIdentity(userId: UserId): Result = simulateLongTask { + override suspend fun getUserIdentity(userId: UserId, fallbackToServer: Boolean): Result = simulateLongTask { return getUserIdentityResult(userId) } From 9b0b1fa112ec1b048a69c0b4a0f7d35348cd241f Mon Sep 17 00:00:00 2001 From: ganfra Date: Mon, 24 Nov 2025 20:23:46 +0100 Subject: [PATCH 3/4] change(member list): use only local user identity --- .../roomdetails/impl/members/RoomMemberListPresenter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenter.kt b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenter.kt index e69ddb744a..9274c1a8e5 100644 --- a/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenter.kt +++ b/features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/members/RoomMemberListPresenter.kt @@ -179,7 +179,7 @@ class RoomMemberListPresenter( return if (room.info().isEncrypted != true) { RoomMemberWithIdentityState(this, null) } else { - val identityState = identityStates[userId] ?: encryptionService.getUserIdentity(userId).getOrNull() + val identityState = identityStates[userId] ?: encryptionService.getUserIdentity(userId, fallbackToServer = false).getOrNull() RoomMemberWithIdentityState(this, identityState) } } From 7780cdcea5d206848af532edd21a1bdf4d609a32 Mon Sep 17 00:00:00 2001 From: ganfra Date: Tue, 25 Nov 2025 11:01:18 +0100 Subject: [PATCH 4/4] quality: fix test after api removal --- .../features/userprofile/impl/UserProfilePresenterTest.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/features/userprofile/impl/src/test/kotlin/io/element/android/features/userprofile/impl/UserProfilePresenterTest.kt b/features/userprofile/impl/src/test/kotlin/io/element/android/features/userprofile/impl/UserProfilePresenterTest.kt index 8dcf6aab20..aa984f0066 100644 --- a/features/userprofile/impl/src/test/kotlin/io/element/android/features/userprofile/impl/UserProfilePresenterTest.kt +++ b/features/userprofile/impl/src/test/kotlin/io/element/android/features/userprofile/impl/UserProfilePresenterTest.kt @@ -386,14 +386,12 @@ class UserProfilePresenterTest { } private fun createFakeMatrixClient( - isUserVerified: Boolean = true, userIdentityState: IdentityState? = null, ignoreUserResult: (UserId) -> Result = { Result.success(Unit) }, unIgnoreUserResult: (UserId) -> Result = { Result.success(Unit) }, ignoredUsersFlow: StateFlow> = MutableStateFlow(persistentListOf()) ) = FakeMatrixClient( encryptionService = FakeEncryptionService( - isUserVerifiedResult = { Result.success(isUserVerified) }, getUserIdentityResult = { Result.success(userIdentityState) } ), ignoreUserResult = ignoreUserResult,