Fixed that in some cases accountsChangedListeners got called with only one bank as parameter instead of all banks

This commit is contained in:
dankito 2020-09-14 23:06:42 +02:00
parent 79b61dcb52
commit 4d50b12fa9
1 changed files with 3 additions and 11 deletions

View File

@ -396,13 +396,13 @@ open class BankingPresenter constructor(
open fun accountDisplayIndexUpdated(account: TypedCustomer) { open fun accountDisplayIndexUpdated(account: TypedCustomer) {
persistAccount(account) persistAccount(account)
callAccountsChangedListeners(account) callAccountsChangedListeners()
} }
open fun accountUpdated(bank: TypedCustomer) { open fun accountUpdated(bank: TypedCustomer) {
persistAccount(bank) persistAccount(bank)
callAccountsChangedListeners(bank) callAccountsChangedListeners()
getBankingClientForAccount(bank)?.dataChanged(bank) getBankingClientForAccount(bank)?.dataChanged(bank)
} }
@ -410,7 +410,7 @@ open class BankingPresenter constructor(
open fun accountUpdated(account: TypedBankAccount) { open fun accountUpdated(account: TypedBankAccount) {
persistAccount(account.customer) persistAccount(account.customer)
callAccountsChangedListeners(account.customer as TypedCustomer) callAccountsChangedListeners()
} }
protected open fun persistAccount(customer: ICustomer<*, *>) { protected open fun persistAccount(customer: ICustomer<*, *>) {
@ -749,14 +749,6 @@ open class BankingPresenter constructor(
} }
} }
protected open fun callAccountsChangedListeners(account: TypedCustomer) {
val accounts = ArrayList(listOf(account))
ArrayList(accountsChangedListeners).forEach {
it(accounts) // TODO: use RxJava for this
}
}
open fun addRetrievedAccountTransactionsResponseListener(listener: (GetTransactionsResponse) -> Unit): Boolean { open fun addRetrievedAccountTransactionsResponseListener(listener: (GetTransactionsResponse) -> Unit): Boolean {
return retrievedAccountTransactionsResponseListeners.add(listener) return retrievedAccountTransactionsResponseListeners.add(listener)