diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt index ec830bb..fc48593 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt @@ -20,9 +20,8 @@ import net.codinux.banking.ui.IOorDefault import net.codinux.banking.ui.composables.BankIcon import net.codinux.banking.ui.config.Colors import net.codinux.banking.ui.config.DI -import net.codinux.banking.ui.forms.AutocompleteTextField +import net.codinux.banking.ui.forms.* import net.codinux.banking.ui.forms.OutlinedTextField -import net.codinux.banking.ui.forms.PasswordTextField import net.codinux.banking.ui.model.BankInfo @@ -38,6 +37,7 @@ fun AddAccountDialog( var selectedBank by remember { mutableStateOf(null) } var loginName by remember { mutableStateOf("") } var password by remember { mutableStateOf("") } + var retrieveAllTransactions by remember { mutableStateOf(false) } val isRequiredDataEntered by remember(selectedBank, loginName, password) { derivedStateOf { selectedBank != null && loginName.length > 3 && password.length > 3 } @@ -54,7 +54,7 @@ fun AddAccountDialog( isAddingAccount = true coroutineScope.launch(Dispatchers.IOorDefault) { - val successful = DI.bankingService.addAccount(bank, loginName, password) + val successful = DI.bankingService.addAccount(bank, loginName, password, retrieveAllTransactions) withContext(Dispatchers.Main) { isAddingAccount = false @@ -142,6 +142,10 @@ fun AddAccountDialog( PasswordTextField(password, forceHidePassword = if (isAddingAccount) true else null, onChange = { password = it }, onEnterPressed = { confirmCalled() }) Spacer(modifier = Modifier.height(16.dp)) + + BooleanOption("Alle Umsätze abholen (erfordert meistens eine TAN)", retrieveAllTransactions) { newValue -> + retrieveAllTransactions = newValue + } } } } \ No newline at end of file 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 4424994..80e94cc 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 @@ -71,9 +71,10 @@ class BankingService( suspend fun findBanks(query: String): List = bankFinder.findBankByNameBankCodeOrCity(query, 25) - suspend fun addAccount(bank: BankInfo, loginName: String, password: String): Boolean { + suspend fun addAccount(bank: BankInfo, loginName: String, password: String, retrieveAllTransactions: Boolean = false): Boolean { try { - val response = client.getAccountDataAsync(GetAccountDataRequest(bank.bankCode, loginName, password, GetAccountDataOptions())) + val options = GetAccountDataOptions(retrieveTransactions = RetrieveTransactions.All) + val response = client.getAccountDataAsync(GetAccountDataRequest(bank.bankCode, loginName, password, options)) if (response.type == ResponseType.Success && response.data != null) { handleSuccessfulGetAccountDataResponse(response.data!!)