From ec96f4e0ae787cb5ef7800374ad6fa8644c8733a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 1 Feb 2024 18:03:34 +0100 Subject: [PATCH] Fix assignment issue. `sessionId` was used instead of `roomId`. This may fix issue of Event not decrypted if the key is coming late for the last Event displayed in the Room list. --- .../android/sdk/internal/crypto/RustCryptoService.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/RustCryptoService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/RustCryptoService.kt index e68cac31a3..c0407ca4e8 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/RustCryptoService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/RustCryptoService.kt @@ -627,7 +627,7 @@ internal class RustCryptoService @Inject constructor( } private fun notifyRoomKeyReceived( - roomId: String, + roomId: String?, sessionId: String, ) { megolmSessionImportManager.dispatchNewSession(roomId, sessionId) @@ -665,8 +665,8 @@ internal class RustCryptoService @Inject constructor( EventType.ROOM_KEY -> { val content = event.getClearContent().toModel() ?: return@forEach - val roomId = content.sessionId ?: return@forEach - val sessionId = content.sessionId + val roomId = content.roomId + val sessionId = content.sessionId ?: return@forEach notifyRoomKeyReceived(roomId, sessionId) matrixConfiguration.cryptoAnalyticsPlugin?.onRoomKeyImported(sessionId, EventType.ROOM_KEY) @@ -674,8 +674,8 @@ internal class RustCryptoService @Inject constructor( EventType.FORWARDED_ROOM_KEY -> { val content = event.getClearContent().toModel() ?: return@forEach - val roomId = content.sessionId ?: return@forEach - val sessionId = content.sessionId + val roomId = content.roomId + val sessionId = content.sessionId ?: return@forEach notifyRoomKeyReceived(roomId, sessionId) matrixConfiguration.cryptoAnalyticsPlugin?.onRoomKeyImported(sessionId, EventType.FORWARDED_ROOM_KEY)