From 91ccfc1844915f02130881979e1be45491d07689 Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 9 Sep 2024 22:55:45 +0200 Subject: [PATCH] Extracted receivedTanChallenge() --- .../kotlin/net/codinux/banking/ui/service/BankingService.kt | 2 +- .../kotlin/net/codinux/banking/ui/state/UiState.kt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/service/BankingService.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/service/BankingService.kt index 65060be..c37a3cf 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/service/BankingService.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/service/BankingService.kt @@ -38,7 +38,7 @@ class BankingService( ) { private val client = FinTs4kBankingClient(FinTsClientConfiguration(FinTsClientOptions(true)), SimpleBankingClientCallback { tanChallenge, callback -> - uiState.tanChallengeReceived.value = TanChallengeReceived(tanChallenge, callback) + uiState.receivedTanChallenge(tanChallenge, callback) }) private val modelService = BankingModelService() diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/state/UiState.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/state/UiState.kt index ec1e93d..848bb9d 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/state/UiState.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/state/UiState.kt @@ -5,6 +5,8 @@ import androidx.compose.material.DrawerValue import androidx.lifecycle.ViewModel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow +import net.codinux.banking.client.model.tan.EnterTanResult +import net.codinux.banking.client.model.tan.TanChallenge import net.codinux.banking.dataaccess.entities.UserEntity import net.codinux.banking.ui.model.* import net.codinux.banking.ui.model.error.ApplicationError @@ -50,6 +52,10 @@ class UiState : ViewModel() { val tanChallengeReceived = MutableStateFlow(null) + fun receivedTanChallenge(tanChallenge: TanChallenge, callback: (EnterTanResult) -> Unit) { + tanChallengeReceived.value = TanChallengeReceived(tanChallenge, callback) + } + val bankingClientErrorOccurred = MutableStateFlow(null) val applicationErrorOccurred = MutableStateFlow(null)