Skip to content

Commit

Permalink
Fix StreamEventsManager not signaling event decryptions
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Mar 12, 2024
1 parent 737b18d commit ee59171
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ import org.matrix.android.sdk.api.session.crypto.model.OlmDecryptionResult
import org.matrix.android.sdk.api.session.events.model.Event
import javax.inject.Inject

internal class DecryptRoomEventUseCase @Inject constructor(private val olmMachine: OlmMachine) {
internal class DecryptRoomEventUseCase @Inject constructor(
private val cryptoService: RustCryptoService
) {

suspend operator fun invoke(event: Event): MXEventDecryptionResult {
return olmMachine.decryptRoomEvent(event)
return cryptoService.decryptEvent(event, "")
}

suspend fun decryptAndSaveResult(event: Event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,11 @@ internal class RustCryptoService @Inject constructor(
@Throws(MXCryptoError::class)
override suspend fun decryptEvent(event: Event, timeline: String): MXEventDecryptionResult {
return try {
olmMachine.decryptRoomEvent(event)
olmMachine.decryptRoomEvent(event).also {
liveEventManager.get().dispatchLiveEventDecrypted(event, it)
}
} catch (mxCryptoError: MXCryptoError) {
liveEventManager.get().dispatchLiveEventDecryptionFailed(event, mxCryptoError)
if (mxCryptoError is MXCryptoError.Base && (
mxCryptoError.errorType == MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID ||
mxCryptoError.errorType == MXCryptoError.ErrorType.UNKNOWN_MESSAGE_INDEX)) {
Expand Down

0 comments on commit ee59171

Please sign in to comment.