From 130fe7f887fe4851ec35305da23c5ffdbecad591 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Tue, 26 Apr 2022 17:10:44 +0200 Subject: [PATCH] Revert "Update room previews once we have decryption keys" Upstream implemented this now as well (differently). This reverts commit 0d6eda56f53bf796d8816974a6ac884f31f6d7d5 Change-Id: I74a59ed3e9baf8122c506b4af66a9d1809720600 --- .../crypto/actions/MegolmSessionDataImporter.kt | 15 --------------- .../session/room/summary/RoomSummaryUpdater.kt | 15 --------------- 2 files changed, 30 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MegolmSessionDataImporter.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MegolmSessionDataImporter.kt index 2d5e87d9ab..8f1723d052 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MegolmSessionDataImporter.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/actions/MegolmSessionDataImporter.kt @@ -17,9 +17,6 @@ package org.matrix.android.sdk.internal.crypto.actions import androidx.annotation.WorkerThread -import com.zhuinden.monarchy.Monarchy -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch import org.matrix.android.sdk.api.listeners.ProgressListener import org.matrix.android.sdk.api.session.crypto.model.ImportRoomKeysResult import org.matrix.android.sdk.api.session.crypto.model.RoomKeyRequestBody @@ -29,17 +26,12 @@ import org.matrix.android.sdk.internal.crypto.OutgoingGossipingRequestManager import org.matrix.android.sdk.internal.crypto.RoomDecryptorProvider import org.matrix.android.sdk.internal.crypto.algorithms.megolm.MXMegolmDecryption import org.matrix.android.sdk.internal.crypto.store.IMXCryptoStore -import org.matrix.android.sdk.internal.di.SessionDatabase import org.matrix.android.sdk.internal.session.room.summary.RoomSummaryUpdater -import org.matrix.android.sdk.internal.util.awaitTransaction import timber.log.Timber import javax.inject.Inject internal class MegolmSessionDataImporter @Inject constructor(private val olmDevice: MXOlmDevice, private val roomDecryptorProvider: RoomDecryptorProvider, - @SessionDatabase private val monarchy: Monarchy, - private val roomSummaryUpdater: RoomSummaryUpdater, - private val cryptoCoroutineScope: CoroutineScope, private val outgoingGossipingRequestManager: OutgoingGossipingRequestManager, private val cryptoStore: IMXCryptoStore) { @@ -116,13 +108,6 @@ internal class MegolmSessionDataImporter @Inject constructor(private val olmDevi Timber.v("## importMegolmSessionsData : sessions import " + (t1 - t0) + " ms (" + megolmSessionsData.size + " sessions)") - // Retry decrypting room previews for the room list - cryptoCoroutineScope.launch { - monarchy.awaitTransaction { realm -> - roomSummaryUpdater.updateRoomPreviews(realm) - } - } - return ImportRoomKeysResult(totalNumbersOfKeys, totalNumbersOfImportedKeys) } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt index c60d2cbb40..f239c921d8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt @@ -215,21 +215,6 @@ internal class RoomSummaryUpdater @Inject constructor( } } - suspend fun updateRoomPreviews(realm: Realm) { - RoomSummaryEntity.where(realm).findAll().forEach { entity -> - val previewEvent = entity.scLatestPreviewableEvent() - val root = previewEvent?.root - if (root?.type == EventType.ENCRYPTED && root.decryptionResultJson == null) { - Timber.v("Retry decrypt ${previewEvent.eventId}") - // mmm i want to decrypt now or is it ok to do it async? - tryOrNull { - eventDecryptor.decryptEvent(root.asDomain(), "") - } - ?.let { root.setDecryptionResult(it) } - } - } - } - private fun TimelineEventEntity.attemptToDecrypt() { when (val root = this.root) { null -> {