File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,12 @@ import org.matrix.android.sdk.api.session.crypto.model.OlmDecryptionResult
22
22
import org.matrix.android.sdk.api.session.events.model.Event
23
23
import javax.inject.Inject
24
24
25
- internal class DecryptRoomEventUseCase @Inject constructor(private val olmMachine : OlmMachine ) {
25
+ internal class DecryptRoomEventUseCase @Inject constructor(
26
+ private val cryptoService : RustCryptoService
27
+ ) {
26
28
27
29
suspend operator fun invoke (event : Event ): MXEventDecryptionResult {
28
- return olmMachine.decryptRoomEvent (event)
30
+ return cryptoService.decryptEvent (event, " " )
29
31
}
30
32
31
33
suspend fun decryptAndSaveResult (event : Event ) {
Original file line number Diff line number Diff line change @@ -497,8 +497,11 @@ internal class RustCryptoService @Inject constructor(
497
497
@Throws(MXCryptoError ::class )
498
498
override suspend fun decryptEvent (event : Event , timeline : String ): MXEventDecryptionResult {
499
499
return try {
500
- olmMachine.decryptRoomEvent(event)
500
+ olmMachine.decryptRoomEvent(event).also {
501
+ liveEventManager.get().dispatchLiveEventDecrypted(event, it)
502
+ }
501
503
} catch (mxCryptoError: MXCryptoError ) {
504
+ liveEventManager.get().dispatchLiveEventDecryptionFailed(event, mxCryptoError)
502
505
if (mxCryptoError is MXCryptoError .Base && (
503
506
mxCryptoError.errorType == MXCryptoError .ErrorType .UNKNOWN_INBOUND_SESSION_ID ||
504
507
mxCryptoError.errorType == MXCryptoError .ErrorType .UNKNOWN_MESSAGE_INDEX )) {
You can’t perform that action at this time.
0 commit comments