Sending queue : reintroduce failed status for unrecoverable error
This commit is contained in:
parent
05ab1500c7
commit
a92ce8d004
7 changed files with 49 additions and 27 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue