mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Sending queue : reintroduce failed status for unrecoverable error
This commit is contained in:
+4
-5
@@ -22,11 +22,10 @@ import io.element.android.libraries.matrix.api.core.EventId
|
||||
@Immutable
|
||||
sealed interface LocalEventSendState {
|
||||
data object NotSentYet : LocalEventSendState
|
||||
|
||||
data class SendingFailed(
|
||||
val error: String
|
||||
) : LocalEventSendState
|
||||
|
||||
sealed class SendingFailed(open val error: String) : LocalEventSendState {
|
||||
data class Recoverable(override val error: String) : SendingFailed(error)
|
||||
data class Unrecoverable(override val error: String) : SendingFailed(error)
|
||||
}
|
||||
data class Sent(
|
||||
val eventId: EventId
|
||||
) : LocalEventSendState
|
||||
|
||||
+7
-1
@@ -77,7 +77,13 @@ fun RustEventSendState?.map(): LocalEventSendState? {
|
||||
return when (this) {
|
||||
null -> null
|
||||
RustEventSendState.NotSentYet -> LocalEventSendState.NotSentYet
|
||||
is RustEventSendState.SendingFailed -> LocalEventSendState.SendingFailed(error)
|
||||
is RustEventSendState.SendingFailed -> {
|
||||
if (this.isRecoverable) {
|
||||
LocalEventSendState.SendingFailed.Recoverable(this.error)
|
||||
} else {
|
||||
LocalEventSendState.SendingFailed.Unrecoverable(this.error)
|
||||
}
|
||||
}
|
||||
is RustEventSendState.Sent -> LocalEventSendState.Sent(EventId(eventId))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user