mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-24 10:25:51 +03:00
refactor: StreamEventsManager report MXCryptoError instead of throwable
This commit is contained in:
parent
3fa3eb1129
commit
72d2199f1a
3 changed files with 6 additions and 3 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package org.matrix.android.sdk.api.session
|
package org.matrix.android.sdk.api.session
|
||||||
|
|
||||||
|
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||||
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.util.JsonDict
|
import org.matrix.android.sdk.api.util.JsonDict
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ interface LiveEventListener {
|
||||||
|
|
||||||
fun onEventDecrypted(event: Event, clearEvent: JsonDict)
|
fun onEventDecrypted(event: Event, clearEvent: JsonDict)
|
||||||
|
|
||||||
fun onEventDecryptionError(event: Event, throwable: Throwable)
|
fun onEventDecryptionError(event: Event, cryptoError: MXCryptoError)
|
||||||
|
|
||||||
fun onLiveToDeviceEvent(event: Event)
|
fun onLiveToDeviceEvent(event: Event)
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||||
import org.matrix.android.sdk.api.session.LiveEventListener
|
import org.matrix.android.sdk.api.session.LiveEventListener
|
||||||
|
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||||
import org.matrix.android.sdk.api.session.crypto.model.MXEventDecryptionResult
|
import org.matrix.android.sdk.api.session.crypto.model.MXEventDecryptionResult
|
||||||
import org.matrix.android.sdk.api.session.events.model.Event
|
import org.matrix.android.sdk.api.session.events.model.Event
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
@ -75,7 +76,7 @@ internal class StreamEventsManager @Inject constructor() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun dispatchLiveEventDecryptionFailed(event: Event, error: Throwable) {
|
fun dispatchLiveEventDecryptionFailed(event: Event, error: MXCryptoError) {
|
||||||
Timber.v("## dispatchLiveEventDecryptionFailed ${event.eventId}")
|
Timber.v("## dispatchLiveEventDecryptionFailed ${event.eventId}")
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
listeners.forEach {
|
listeners.forEach {
|
||||||
|
|
|
@ -18,6 +18,7 @@ package im.vector.app
|
||||||
|
|
||||||
import org.matrix.android.sdk.api.extensions.orFalse
|
import org.matrix.android.sdk.api.extensions.orFalse
|
||||||
import org.matrix.android.sdk.api.session.LiveEventListener
|
import org.matrix.android.sdk.api.session.LiveEventListener
|
||||||
|
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||||
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.content.EncryptedEventContent
|
import org.matrix.android.sdk.api.session.events.model.content.EncryptedEventContent
|
||||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||||
|
@ -84,7 +85,7 @@ class UISIDetector(private val timeoutMillis: Long = 30_000L) : LiveEventListene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onEventDecryptionError(event: Event, throwable: Throwable) {
|
override fun onEventDecryptionError(event: Event, cryptoError: MXCryptoError) {
|
||||||
val eventId = event.eventId
|
val eventId = event.eventId
|
||||||
val roomId = event.roomId
|
val roomId = event.roomId
|
||||||
if (!enabled || eventId == null || roomId == null) return
|
if (!enabled || eventId == null || roomId == null) return
|
||||||
|
|
Loading…
Reference in a new issue