Fix close error dialog has no effect.
This commit is contained in:
parent
fc2dfacd7e
commit
8302af2dc6
4 changed files with 12 additions and 0 deletions
|
|
@ -19,6 +19,8 @@ package io.element.android.features.rageshake.impl.bugreport
|
|||
sealed interface BugReportEvents {
|
||||
object SendBugReport : BugReportEvents
|
||||
object ResetAll : BugReportEvents
|
||||
object ClearError : BugReportEvents
|
||||
|
||||
data class SetDescription(val description: String) : BugReportEvents
|
||||
data class SetSendLog(val sendLog: Boolean) : BugReportEvents
|
||||
data class SetSendCrashLog(val sendCrashlog: Boolean) : BugReportEvents
|
||||
|
|
|
|||
|
|
@ -109,6 +109,10 @@ class BugReportPresenter @Inject constructor(
|
|||
is BugReportEvents.SetSendScreenshot -> updateFormState(formState) {
|
||||
copy(sendScreenshot = event.sendScreenshot)
|
||||
}
|
||||
BugReportEvents.ClearError -> {
|
||||
sendingProgress.value = 0f
|
||||
sendingAction.value = Async.Uninitialized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ fun BugReportView(
|
|||
}
|
||||
is Async.Failure -> ErrorDialog(
|
||||
content = state.sending.error.toString(),
|
||||
onDismiss = { state.eventSink(BugReportEvents.ClearError) }
|
||||
)
|
||||
else -> Unit
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,6 +222,11 @@ class BugReportPresenterTest {
|
|||
// Failure
|
||||
assertThat(awaitItem().sendingProgress).isEqualTo(0f)
|
||||
assertThat((awaitItem().sending as Async.Failure).error.message).isEqualTo(A_FAILURE_REASON)
|
||||
// Reset failure
|
||||
initialState.eventSink.invoke(BugReportEvents.ClearError)
|
||||
val lastItem = awaitItem()
|
||||
assertThat(lastItem.sendingProgress).isEqualTo(0f)
|
||||
assertThat(lastItem.sending).isInstanceOf(Async.Uninitialized::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue