Fixed that when saveAllBanks() has been called readBanks (now allBanks) hasn't been updated
This commit is contained in:
parent
f19c3d882e
commit
d499b597f9
|
@ -24,7 +24,7 @@ open class BankingPersistenceJson(
|
||||||
|
|
||||||
protected val appSettingsJsonFile: File
|
protected val appSettingsJsonFile: File
|
||||||
|
|
||||||
protected var readBanks: List<TypedBankData>? = null
|
protected var allBanks: List<TypedBankData>? = null
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
@ -57,7 +57,7 @@ open class BankingPersistenceJson(
|
||||||
override fun readPersistedBanks(): List<TypedBankData> {
|
override fun readPersistedBanks(): List<TypedBankData> {
|
||||||
val banks = serializer.deserializeListOr(banksJsonFile, BankDataEntity::class).map { it as TypedBankData }
|
val banks = serializer.deserializeListOr(banksJsonFile, BankDataEntity::class).map { it as TypedBankData }
|
||||||
|
|
||||||
this.readBanks = banks
|
this.allBanks = banks
|
||||||
|
|
||||||
return banks
|
return banks
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ open class BankingPersistenceJson(
|
||||||
|
|
||||||
|
|
||||||
protected open fun saveAllBanks(allBanks: List<TypedBankData>) {
|
protected open fun saveAllBanks(allBanks: List<TypedBankData>) {
|
||||||
|
this.allBanks = allBanks
|
||||||
|
|
||||||
serializer.serializeObject(allBanks, banksJsonFile)
|
serializer.serializeObject(allBanks, banksJsonFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +88,7 @@ open class BankingPersistenceJson(
|
||||||
override fun saveBankIcon(bank: TypedBankData, iconUrl: String, fileExtension: String?) {
|
override fun saveBankIcon(bank: TypedBankData, iconUrl: String, fileExtension: String?) {
|
||||||
bank.iconData = downloadIcon(iconUrl)
|
bank.iconData = downloadIcon(iconUrl)
|
||||||
|
|
||||||
readBanks?.let {
|
allBanks?.let {
|
||||||
saveOrUpdateBank(bank, it)
|
saveOrUpdateBank(bank, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue