From d499b597f97bb3faec7e4ace8099e61612c6986c Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 26 Oct 2020 18:18:00 +0100 Subject: [PATCH] Fixed that when saveAllBanks() has been called readBanks (now allBanks) hasn't been updated --- .../dankito/banking/persistence/BankingPersistenceJson.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/BankingPersistenceJson.kt b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/BankingPersistenceJson.kt index c1300d4d..e67b7ff0 100644 --- a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/BankingPersistenceJson.kt +++ b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/BankingPersistenceJson.kt @@ -24,7 +24,7 @@ open class BankingPersistenceJson( protected val appSettingsJsonFile: File - protected var readBanks: List? = null + protected var allBanks: List? = null init { @@ -57,7 +57,7 @@ open class BankingPersistenceJson( override fun readPersistedBanks(): List { val banks = serializer.deserializeListOr(banksJsonFile, BankDataEntity::class).map { it as TypedBankData } - this.readBanks = banks + this.allBanks = banks return banks } @@ -70,6 +70,8 @@ open class BankingPersistenceJson( protected open fun saveAllBanks(allBanks: List) { + this.allBanks = allBanks + serializer.serializeObject(allBanks, banksJsonFile) } @@ -86,7 +88,7 @@ open class BankingPersistenceJson( override fun saveBankIcon(bank: TypedBankData, iconUrl: String, fileExtension: String?) { bank.iconData = downloadIcon(iconUrl) - readBanks?.let { + allBanks?.let { saveOrUpdateBank(bank, it) } }