Updated to new data model that their is now BankAccess.clientData and serializedClientData
This commit is contained in:
parent
f547b76c7b
commit
1c7fa49de5
|
@ -31,7 +31,7 @@ interface BankingRepository {
|
|||
|
||||
suspend fun updateBank(bank: BankAccessEntity, loginName: String, password: String, bankName: String?)
|
||||
|
||||
suspend fun updateBank(bank: BankAccessEntity, clientData: String?)
|
||||
suspend fun updateBank(bank: BankAccessEntity, serializedClientData: String?)
|
||||
|
||||
suspend fun updateAccount(account: BankAccountEntity, userSetDisplayName: String?, hideAccount: Boolean, includeInAutomaticAccountsUpdate: Boolean)
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class InMemoryBankingRepository(
|
|||
// no-op
|
||||
}
|
||||
|
||||
override suspend fun updateBank(bank: BankAccessEntity, clientData: String?) {
|
||||
override suspend fun updateBank(bank: BankAccessEntity, serializedClientData: String?) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
|
|
@ -95,9 +95,9 @@ open class SqliteBankingRepository : BankingRepository {
|
|||
val tanMedia = getAllTanMedia().groupBy { it.bankId }.mapValues { it.value.toMutableList() }
|
||||
val holdings = getAllHoldings().groupBy { it.accountId }
|
||||
|
||||
return bankQueries.getAllBanks { id, domesticBankCode, loginName, password, bankName, bic, customerName, userId, selectedTanMethodIdentifier, selectedTanMediumIdentifier, bankingGroup, serverAddress, countryCode, clientData, userSetDisplayName, displayIndex, iconUrl, wrongCredentialsEntered ->
|
||||
return bankQueries.getAllBanks { id, domesticBankCode, loginName, password, bankName, bic, customerName, userId, selectedTanMethodIdentifier, selectedTanMediumIdentifier, bankingGroup, serverAddress, countryCode, serializedClientData, userSetDisplayName, displayIndex, iconUrl, wrongCredentialsEntered ->
|
||||
BankAccessEntity(id, domesticBankCode, loginName, password, bankName, bic, customerName, userId, getAccountsOfBank(id, bankAccounts, holdings), selectedTanMethodIdentifier, tanMethods[id] ?: mutableListOf(), selectedTanMediumIdentifier, tanMedia[id] ?: mutableListOf(),
|
||||
bankingGroup?.let { BankingGroup.valueOf(it) }, serverAddress, countryCode, userSetDisplayName, displayIndex.toInt(), iconUrl, wrongCredentialsEntered, clientData)
|
||||
bankingGroup?.let { BankingGroup.valueOf(it) }, serverAddress, countryCode, userSetDisplayName, displayIndex.toInt(), iconUrl, wrongCredentialsEntered, null, serializedClientData)
|
||||
}.executeAsList()
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ open class SqliteBankingRepository : BankingRepository {
|
|||
return bankQueries.transactionWithResult {
|
||||
bankQueries.insertBank(bank.domesticBankCode, bank.loginName, bank.password, bank.bankName, bank.bic,
|
||||
bank.customerName, bank.userId, bank.selectedTanMethodIdentifier, bank.selectedTanMediumIdentifier,
|
||||
bank.bankingGroup?.name, bank.serverAddress, bank.countryCode, bank.clientData, bank.userSetDisplayName, bank.displayIndex.toLong(), bank.iconUrl, bank.wrongCredentialsEntered
|
||||
bank.bankingGroup?.name, bank.serverAddress, bank.countryCode, bank.serializedClientData, bank.userSetDisplayName, bank.displayIndex.toLong(), bank.iconUrl, bank.wrongCredentialsEntered
|
||||
)
|
||||
|
||||
val bankId = getLastInsertedId() // getLastInsertedId() / last_insert_rowid() has to be called in a transaction with the insert operation, otherwise it will not work
|
||||
|
@ -141,10 +141,10 @@ open class SqliteBankingRepository : BankingRepository {
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun updateBank(bank: BankAccessEntity, clientData: String?) {
|
||||
override suspend fun updateBank(bank: BankAccessEntity, serializedClientData: String?) {
|
||||
bankQueries.transaction {
|
||||
if (clientData != null) {
|
||||
bankQueries.updateBankClientData(clientData, bank.id)
|
||||
if (serializedClientData != null) {
|
||||
bankQueries.updateBankClientData(serializedClientData, bank.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ class BankAccessEntity(
|
|||
iconUrl: String? = null,
|
||||
wrongCredentialsEntered: Boolean = false,
|
||||
|
||||
clientData: String? = null
|
||||
clientData: Any? = null,
|
||||
serializedClientData: String? = null
|
||||
) : BankAccess(domesticBankCode, loginName, password, bankName, bic, customerName, userId, accounts, selectedTanMethodIdentifier, tanMethods, selectedTanMediumIdentifier, tanMedia, bankingGroup, serverAddress, countryCode) {
|
||||
|
||||
init {
|
||||
|
@ -45,6 +46,7 @@ class BankAccessEntity(
|
|||
this.wrongCredentialsEntered = wrongCredentialsEntered
|
||||
|
||||
this.clientData = clientData
|
||||
this.serializedClientData = serializedClientData
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ class BankingService(
|
|||
bankingRepository.updateAccount(account, response.balance ?: account.balance, response.transactionsRetrievalTime, response.retrievedTransactionsFrom ?: account.retrievedTransactionsFrom)
|
||||
}
|
||||
|
||||
bankingRepository.updateBank(bank, bank.clientData)
|
||||
bankingRepository.updateBank(bank, bank.serializedClientData)
|
||||
|
||||
notifyBanksListUpdated() // notify about updated values like account balance
|
||||
} catch (e: Throwable) {
|
||||
|
|
Loading…
Reference in New Issue