Revert "Update room previews once we have decryption keys"

Upstream implemented this now as well (differently).
This reverts commit 0d6eda56f5

Change-Id: I74a59ed3e9baf8122c506b4af66a9d1809720600
This commit is contained in:
SpiritCroc 2022-04-26 17:10:44 +02:00
parent c5e69cf35a
commit 130fe7f887
2 changed files with 0 additions and 30 deletions

View file

@ -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)
}
}

View file

@ -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 -> {