From b7d94e8a17f11e0df0cacd5f54ad586bc73087d4 Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 8 Sep 2020 15:47:56 +0200 Subject: [PATCH] Implemented specifying detaily if a bank, an account or only display index got updated --- .../banking/ui/presenter/BankingPresenter.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 779c5cee..13633ddf 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 @@ -253,7 +253,7 @@ open class BankingPresenter( for (i in IntRange(displayIndex, sortedBanks.size - 1)) { val bank = sortedBanks[i] bank.displayIndex = i - accountUpdated(bank) + accountDisplayIndexUpdated(bank) } callAccountsChangedListeners() @@ -384,14 +384,22 @@ open class BankingPresenter( open fun allAccountsUpdated() { customers.forEach { account -> - accountUpdated(account) + accountDisplayIndexUpdated(account) } } - open fun accountUpdated(account: Customer) { + open fun accountDisplayIndexUpdated(account: Customer) { persistAccount(account) } + open fun accountUpdated(bank: Customer) { + persistAccount(bank) + } + + open fun accountUpdated(account: BankAccount) { + persistAccount(account.customer) + } + protected open fun persistAccount(customer: Customer) { persister.saveOrUpdateAccount(customer, customers) }