Let AsyncAction.Confirming be an interface, with a AsyncAction.ConfirmingNoParams data object.

This will allow inheritance of `AsyncAction.Confirming` with parameter(s).
This commit is contained in:
Benoit Marty 2024-10-14 10:49:55 +02:00
parent c46896be09
commit 97fb7bc2fa
46 changed files with 86 additions and 84 deletions

View file

@ -122,7 +122,7 @@ private fun ColumnScope.TroubleshootTestView(
private fun ColumnScope.TroubleshootNotificationsContent(state: TroubleshootNotificationsState) {
when (state.testSuiteState.mainState) {
AsyncAction.Loading,
AsyncAction.Confirming,
is AsyncAction.Confirming,
is AsyncAction.Success,
is AsyncAction.Failure -> {
TestSuiteView(
@ -150,7 +150,7 @@ private fun ColumnScope.TroubleshootNotificationsContent(state: TroubleshootNoti
})
RunTestButton(state = state)
}
AsyncAction.Confirming -> {
is AsyncAction.Confirming -> {
ListItem(headlineContent = {
Text(
text = stringResource(id = R.string.troubleshoot_notifications_screen_waiting)

View file

@ -102,7 +102,7 @@ fun List<NotificationTroubleshootTestState>.computeMainState(): AsyncAction<Unit
isRunning -> AsyncAction.Loading
else -> {
if (any { it.status is NotificationTroubleshootTestState.Status.WaitingForUser }) {
AsyncAction.Confirming
AsyncAction.ConfirmingNoParams
} else if (any { it.status is NotificationTroubleshootTestState.Status.Failure }) {
AsyncAction.Failure(Exception("Some tests failed"))
} else {