Changed order

This commit is contained in:
dankito 2024-08-29 00:08:45 +02:00
parent 7d3a30ca7f
commit 5832a877c0
2 changed files with 11 additions and 13 deletions

View File

@ -1,8 +1,6 @@
package net.codinux.banking.ui.composables
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.*
import net.codinux.banking.ui.dialogs.ApplicationErrorDialog
import net.codinux.banking.ui.dialogs.BankingClientErrorDialog
import net.codinux.banking.ui.dialogs.EnterTanDialog
@ -10,13 +8,13 @@ import net.codinux.banking.ui.state.UiState
@Composable
fun StateHandler(uiState: UiState) {
val applicationError by uiState.applicationErrorOccurred.collectAsState()
val bankingClientError by uiState.bankingClientErrorOccurred.collectAsState()
val tanChallengeReceived by uiState.tanChallengeReceived.collectAsState()
val bankingClientError by uiState.bankingClientErrorOccurred.collectAsState()
val applicationError by uiState.applicationErrorOccurred.collectAsState()
applicationError?.let { error ->
ApplicationErrorDialog(error) {
uiState.applicationErrorOccurred.value = null
tanChallengeReceived?.let { tanChallengeReceived ->
EnterTanDialog(tanChallengeReceived) {
uiState.tanChallengeReceived.value = null
}
}
@ -26,9 +24,9 @@ fun StateHandler(uiState: UiState) {
}
}
tanChallengeReceived?.let { tanChallengeReceived ->
EnterTanDialog(tanChallengeReceived) {
uiState.tanChallengeReceived.value = null
applicationError?.let { error ->
ApplicationErrorDialog(error) {
uiState.applicationErrorOccurred.value = null
}
}

View File

@ -25,11 +25,11 @@ class UiState : ViewModel() {
val accountFilter = MutableStateFlow<List<BankAccountFilter>>(emptyList())
val applicationErrorOccurred = MutableStateFlow<ApplicationError?>(null)
val tanChallengeReceived = MutableStateFlow<TanChallengeReceived?>(null)
val bankingClientErrorOccurred = MutableStateFlow<BankingClientError?>(null)
val tanChallengeReceived = MutableStateFlow<TanChallengeReceived?>(null)
val applicationErrorOccurred = MutableStateFlow<ApplicationError?>(null)
fun applicationErrorOccurred(erroneousAction: ErroneousAction, exception: Throwable, errorMessage: String? = null) {