Extracted receivedTanChallenge()

This commit is contained in:
dankito 2024-09-09 22:55:45 +02:00
parent f440a01531
commit 91ccfc1844
2 changed files with 7 additions and 1 deletions

View File

@ -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()

View File

@ -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<TanChallengeReceived?>(null)
fun receivedTanChallenge(tanChallenge: TanChallenge, callback: (EnterTanResult) -> Unit) {
tanChallengeReceived.value = TanChallengeReceived(tanChallenge, callback)
}
val bankingClientErrorOccurred = MutableStateFlow<BankingClientError?>(null)
val applicationErrorOccurred = MutableStateFlow<ApplicationError?>(null)