diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt index ac5d1118..cbeca2f9 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt @@ -87,6 +87,8 @@ open class BankingPresenter( protected val bankingClientsForBanks = mutableMapOf() + protected val messageLogsOfFailedAccountAdditions = mutableListOf() + protected var _selectedAccounts = mutableListOf() protected var selectedAccountType = SelectedAccountType.AllAccounts @@ -189,6 +191,9 @@ open class BankingPresenter( log.error(e) { "Could not save successfully added bank" } } } + else { + messageLogsOfFailedAccountAdditions.addAll(newClient.messageLogWithoutSensitiveData) + } callback(response) } @@ -777,11 +782,17 @@ open class BankingPresenter( } - open fun getMessageLogForAccounts(banks: List): List { - val logEntries = banks.flatMap { - getBankingClientForBank(it)?.messageLogWithoutSensitiveData ?: listOf() + open fun getMessageLogForAccounts(banks: List, includeFailedAccountAdditions: Boolean = true): List { + val logEntries = mutableListOf() + + if (includeFailedAccountAdditions) { + logEntries.addAll(messageLogsOfFailedAccountAdditions) } + logEntries.addAll(banks.flatMap { + getBankingClientForBank(it)?.messageLogWithoutSensitiveData ?: listOf() + }) + return logEntries.map { entry -> MessageLogEntryDateFormatter.format(entry.time) + " " + entry.bank.bankCode + " " + entry.message }