Changed order
This commit is contained in:
parent
7d3a30ca7f
commit
5832a877c0
|
@ -1,8 +1,6 @@
|
||||||
package net.codinux.banking.ui.composables
|
package net.codinux.banking.ui.composables
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.runtime.collectAsState
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import net.codinux.banking.ui.dialogs.ApplicationErrorDialog
|
import net.codinux.banking.ui.dialogs.ApplicationErrorDialog
|
||||||
import net.codinux.banking.ui.dialogs.BankingClientErrorDialog
|
import net.codinux.banking.ui.dialogs.BankingClientErrorDialog
|
||||||
import net.codinux.banking.ui.dialogs.EnterTanDialog
|
import net.codinux.banking.ui.dialogs.EnterTanDialog
|
||||||
|
@ -10,13 +8,13 @@ import net.codinux.banking.ui.state.UiState
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun StateHandler(uiState: UiState) {
|
fun StateHandler(uiState: UiState) {
|
||||||
val applicationError by uiState.applicationErrorOccurred.collectAsState()
|
|
||||||
val bankingClientError by uiState.bankingClientErrorOccurred.collectAsState()
|
|
||||||
val tanChallengeReceived by uiState.tanChallengeReceived.collectAsState()
|
val tanChallengeReceived by uiState.tanChallengeReceived.collectAsState()
|
||||||
|
val bankingClientError by uiState.bankingClientErrorOccurred.collectAsState()
|
||||||
|
val applicationError by uiState.applicationErrorOccurred.collectAsState()
|
||||||
|
|
||||||
applicationError?.let { error ->
|
tanChallengeReceived?.let { tanChallengeReceived ->
|
||||||
ApplicationErrorDialog(error) {
|
EnterTanDialog(tanChallengeReceived) {
|
||||||
uiState.applicationErrorOccurred.value = null
|
uiState.tanChallengeReceived.value = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +24,9 @@ fun StateHandler(uiState: UiState) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tanChallengeReceived?.let { tanChallengeReceived ->
|
applicationError?.let { error ->
|
||||||
EnterTanDialog(tanChallengeReceived) {
|
ApplicationErrorDialog(error) {
|
||||||
uiState.tanChallengeReceived.value = null
|
uiState.applicationErrorOccurred.value = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@ class UiState : ViewModel() {
|
||||||
val accountFilter = MutableStateFlow<List<BankAccountFilter>>(emptyList())
|
val accountFilter = MutableStateFlow<List<BankAccountFilter>>(emptyList())
|
||||||
|
|
||||||
|
|
||||||
val applicationErrorOccurred = MutableStateFlow<ApplicationError?>(null)
|
val tanChallengeReceived = MutableStateFlow<TanChallengeReceived?>(null)
|
||||||
|
|
||||||
val bankingClientErrorOccurred = MutableStateFlow<BankingClientError?>(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) {
|
fun applicationErrorOccurred(erroneousAction: ErroneousAction, exception: Throwable, errorMessage: String? = null) {
|
||||||
|
|
Loading…
Reference in New Issue