From 572f8d81ec9000347356e5a3428fa804a3b0716a Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 30 Sep 2020 02:43:12 +0200 Subject: [PATCH] Removed as e.g. when on first attempt there's no network connection, then no further attempt would be taken during whole lifetime of app --- .../net/dankito/banking/fints4kBankingClient.kt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt index e75d22e5..c44ad01c 100644 --- a/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt +++ b/ui/fints4kBankingClient/src/commonMain/kotlin/net/dankito/banking/fints4kBankingClient.kt @@ -46,8 +46,6 @@ open class fints4kBankingClient( protected val mapper = net.dankito.banking.mapper.fints4kModelMapper(modelCreator) - protected var didTryToGetAccountDataFromBank = false - protected val fintsBank = restoreDataOrMapFromUiModel(bank) @@ -157,17 +155,16 @@ open class fints4kBankingClient( if (mappedAccount != null) { findAccountResult(mappedAccount, null) } - else if (didTryToGetAccountDataFromBank == false) { // then try to get account data by fetching data from bank + else { // then try to get account data by fetching data from bank addAccountAsync { response -> - didTryToGetAccountDataFromBank = !!! response.successful - - findAccountResult(mapper.findMatchingAccount(fintsBank, account), - response.errorToShowToUser) + if (response.successful) { + findAccountResult(mapper.findMatchingAccount(fintsBank, account), response.errorToShowToUser) + } + else { + findAccountResult(null, response.errorToShowToUser) + } } } - else { - findAccountResult(null, "Cannot find account for ${account.identifier}") // TODO: translate - } }