Implemented specifying detaily if a bank, an account or only display index got updated

This commit is contained in:
dankito 2020-09-08 15:47:56 +02:00
parent 0ea9fad7a0
commit b7d94e8a17
1 changed files with 11 additions and 3 deletions

View File

@ -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)
}