Store in DB events which failed to be decrypted
This commit is contained in:
parent
3ba2c47d1e
commit
6b6dea0c45
|
@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.session.room.event
|
||||||
|
|
||||||
import com.zhuinden.monarchy.Monarchy
|
import com.zhuinden.monarchy.Monarchy
|
||||||
import org.matrix.android.sdk.api.session.events.model.Event
|
import org.matrix.android.sdk.api.session.events.model.Event
|
||||||
|
import org.matrix.android.sdk.api.session.events.model.EventType
|
||||||
import org.matrix.android.sdk.api.session.room.send.SendState
|
import org.matrix.android.sdk.api.session.room.send.SendState
|
||||||
import org.matrix.android.sdk.internal.crypto.EventDecryptor
|
import org.matrix.android.sdk.internal.crypto.EventDecryptor
|
||||||
import org.matrix.android.sdk.internal.database.mapper.toEntity
|
import org.matrix.android.sdk.internal.database.mapper.toEntity
|
||||||
|
@ -48,7 +49,9 @@ internal class DefaultFilterAndStoreEventsTask @Inject constructor(
|
||||||
override suspend fun execute(params: FilterAndStoreEventsTask.Params) {
|
override suspend fun execute(params: FilterAndStoreEventsTask.Params) {
|
||||||
val filteredEvents = params.events
|
val filteredEvents = params.events
|
||||||
.map { decryptEventIfNeeded(it) }
|
.map { decryptEventIfNeeded(it) }
|
||||||
.filter { params.filterPredicate(it) }
|
// we also filter in the encrypted events since it means there was decryption error for them
|
||||||
|
// and they may be decrypted later
|
||||||
|
.filter { params.filterPredicate(it) || it.getClearType() == EventType.ENCRYPTED }
|
||||||
|
|
||||||
addMissingEventsInDB(params.roomId, filteredEvents)
|
addMissingEventsInDB(params.roomId, filteredEvents)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue