Fixed that allAccounts and allTransactions also contained hidden accounts
This commit is contained in:
parent
43450ebc4f
commit
ab9de8ebdb
|
@ -388,7 +388,7 @@ open class BankingPresenter(
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun updateAllAccountsTransactionsAsync(callback: ((GetTransactionsResponse?) -> Unit)? = null) {
|
open fun updateAllAccountsTransactionsAsync(callback: ((GetTransactionsResponse?) -> Unit)? = null) {
|
||||||
val accountsToUpdate = allAccounts.filter { considerAccountInAutomaticUpdates(it) }
|
val accountsToUpdate = allVisibleAccounts.filter { considerAccountInAutomaticUpdates(it) }
|
||||||
|
|
||||||
if (accountsToUpdate.isNotEmpty()) {
|
if (accountsToUpdate.isNotEmpty()) {
|
||||||
updateAccountsTransactionsAsync(accountsToUpdate, true, callback)
|
updateAccountsTransactionsAsync(accountsToUpdate, true, callback)
|
||||||
|
@ -641,7 +641,7 @@ open class BankingPresenter(
|
||||||
// TODO: show originatorInformation to user
|
// TODO: show originatorInformation to user
|
||||||
|
|
||||||
val transferMoneyData = TransferMoneyData(
|
val transferMoneyData = TransferMoneyData(
|
||||||
allAccounts.first(),
|
allVisibleAccounts.first(),
|
||||||
epcQrCode.receiverName,
|
epcQrCode.receiverName,
|
||||||
epcQrCode.iban,
|
epcQrCode.iban,
|
||||||
epcQrCode.bic ?: "",
|
epcQrCode.bic ?: "",
|
||||||
|
@ -671,7 +671,7 @@ open class BankingPresenter(
|
||||||
|
|
||||||
if (invoiceData.potentialTotalAmount != null || invoiceData.potentialIban != null) { // if at least an amount or IBAN could get extracted
|
if (invoiceData.potentialTotalAmount != null || invoiceData.potentialIban != null) { // if at least an amount or IBAN could get extracted
|
||||||
val transferMoneyData = TransferMoneyData(
|
val transferMoneyData = TransferMoneyData(
|
||||||
allAccounts.first(), "",
|
allVisibleAccounts.first(), "",
|
||||||
invoiceData.potentialIban ?: "",
|
invoiceData.potentialIban ?: "",
|
||||||
invoiceData.potentialBic ?: "",
|
invoiceData.potentialBic ?: "",
|
||||||
invoiceData.potentialTotalAmount ?: BigDecimal.Zero, "")
|
invoiceData.potentialTotalAmount ?: BigDecimal.Zero, "")
|
||||||
|
@ -954,7 +954,7 @@ open class BankingPresenter(
|
||||||
open fun selectedAllAccounts() {
|
open fun selectedAllAccounts() {
|
||||||
selectedAccountType = SelectedAccountType.AllAccounts
|
selectedAccountType = SelectedAccountType.AllAccounts
|
||||||
|
|
||||||
setSelectedAccounts(allAccounts)
|
setSelectedAccounts(allVisibleAccounts)
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun selectedBank(bank: TypedBankData) {
|
open fun selectedBank(bank: TypedBankData) {
|
||||||
|
@ -970,7 +970,7 @@ open class BankingPresenter(
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun setSelectedAccounts(accounts: List<TypedBankAccount>) {
|
protected open fun setSelectedAccounts(accounts: List<TypedBankAccount>) {
|
||||||
this._selectedAccounts = ArrayList(accounts.filter { it.hideAccount == false }) // make a copy
|
this._selectedAccounts = ArrayList(accounts.withoutHiddenOnes()) // make a copy
|
||||||
|
|
||||||
callSelectedAccountsChangedListeners(_selectedAccounts)
|
callSelectedAccountsChangedListeners(_selectedAccounts)
|
||||||
}
|
}
|
||||||
|
@ -982,24 +982,24 @@ open class BankingPresenter(
|
||||||
open val allBanksSortedByDisplayIndex: List<TypedBankData>
|
open val allBanksSortedByDisplayIndex: List<TypedBankData>
|
||||||
get() = allBanks.sortedByDisplayIndex()
|
get() = allBanks.sortedByDisplayIndex()
|
||||||
|
|
||||||
open val allAccounts: List<TypedBankAccount>
|
open val allVisibleAccounts: List<TypedBankAccount>
|
||||||
get() = allBanks.flatMap { it.accounts }
|
get() = allBanks.flatMap { it.accounts }.withoutHiddenOnes()
|
||||||
|
|
||||||
open val allTransactions: List<IAccountTransaction>
|
open val allTransactions: List<IAccountTransaction>
|
||||||
get() = getTransactionsForAccounts(allAccounts)
|
get() = getTransactionsForAccounts(allVisibleAccounts)
|
||||||
|
|
||||||
open val allTransactionsSorted: List<IAccountTransaction>
|
open val allTransactionsSorted: List<IAccountTransaction>
|
||||||
get() = getTransactionsForAccountsSorted(allAccounts)
|
get() = getTransactionsForAccountsSorted(allVisibleAccounts)
|
||||||
|
|
||||||
open val balanceOfAllAccounts: BigDecimal
|
open val balanceOfAllAccounts: BigDecimal
|
||||||
get() = getBalanceForBanks(allBanks)
|
get() = getBalanceForBanks(allBanks)
|
||||||
|
|
||||||
|
|
||||||
open val accountsSupportingRetrievingAccountTransactions: List<TypedBankAccount>
|
open val accountsSupportingRetrievingAccountTransactions: List<TypedBankAccount>
|
||||||
get() = allAccounts.filter { it.supportsRetrievingAccountTransactions }
|
get() = allVisibleAccounts.filter { it.supportsRetrievingAccountTransactions }
|
||||||
|
|
||||||
open val hasAccountsSupportingRetrievingTransactions: Boolean
|
open val hasAccountsSupportingRetrievingTransactions: Boolean
|
||||||
get() = doAccountsSupportRetrievingTransactions(allAccounts)
|
get() = doAccountsSupportRetrievingTransactions(allVisibleAccounts)
|
||||||
|
|
||||||
open val doSelectedAccountsSupportRetrievingTransactions: Boolean
|
open val doSelectedAccountsSupportRetrievingTransactions: Boolean
|
||||||
get() = doAccountsSupportRetrievingTransactions(selectedAccounts)
|
get() = doAccountsSupportRetrievingTransactions(selectedAccounts)
|
||||||
|
@ -1010,10 +1010,10 @@ open class BankingPresenter(
|
||||||
|
|
||||||
|
|
||||||
open val accountsSupportingRetrievingBalance: List<TypedBankAccount>
|
open val accountsSupportingRetrievingBalance: List<TypedBankAccount>
|
||||||
get() = allAccounts.filter { it.supportsRetrievingBalance }
|
get() = allVisibleAccounts.filter { it.supportsRetrievingBalance }
|
||||||
|
|
||||||
open val hasAccountsSupportingRetrievingBalance: Boolean
|
open val hasAccountsSupportingRetrievingBalance: Boolean
|
||||||
get() = doAccountsSupportRetrievingBalance(allAccounts)
|
get() = doAccountsSupportRetrievingBalance(allVisibleAccounts)
|
||||||
|
|
||||||
open val doSelectedAccountsSupportRetrievingBalance: Boolean
|
open val doSelectedAccountsSupportRetrievingBalance: Boolean
|
||||||
get() = doAccountsSupportRetrievingBalance(selectedAccounts)
|
get() = doAccountsSupportRetrievingBalance(selectedAccounts)
|
||||||
|
@ -1024,14 +1024,14 @@ open class BankingPresenter(
|
||||||
|
|
||||||
|
|
||||||
open val accountsSupportingTransferringMoney: List<TypedBankAccount>
|
open val accountsSupportingTransferringMoney: List<TypedBankAccount>
|
||||||
get() = allAccounts.filter { it.supportsTransferringMoney }
|
get() = allVisibleAccounts.filter { it.supportsTransferringMoney }
|
||||||
|
|
||||||
open val accountsSupportingTransferringMoneySortedByDisplayIndex: List<TypedBankAccount>
|
open val accountsSupportingTransferringMoneySortedByDisplayIndex: List<TypedBankAccount>
|
||||||
get() = accountsSupportingTransferringMoney
|
get() = accountsSupportingTransferringMoney
|
||||||
.sortedWith(BankAccountComparator())
|
.sortedWith(BankAccountComparator())
|
||||||
|
|
||||||
open val hasAccountsSupportTransferringMoney: Boolean
|
open val hasAccountsSupportTransferringMoney: Boolean
|
||||||
get() = doAccountsSupportTransferringMoney(allAccounts)
|
get() = doAccountsSupportTransferringMoney(allVisibleAccounts)
|
||||||
|
|
||||||
open val doSelectedAccountsSupportTransferringMoney: Boolean
|
open val doSelectedAccountsSupportTransferringMoney: Boolean
|
||||||
get() = doAccountsSupportTransferringMoney(selectedAccounts)
|
get() = doAccountsSupportTransferringMoney(selectedAccounts)
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package net.dankito.banking.util
|
package net.dankito.banking.util
|
||||||
|
|
||||||
import net.dankito.banking.ui.model.IAccountTransaction
|
import net.dankito.banking.ui.model.IAccountTransaction
|
||||||
|
import net.dankito.banking.ui.model.IBankAccount
|
||||||
import net.dankito.banking.ui.model.OrderedDisplayable
|
import net.dankito.banking.ui.model.OrderedDisplayable
|
||||||
|
import net.dankito.banking.ui.model.TypedBankAccount
|
||||||
|
|
||||||
|
|
||||||
fun String.ofMaxLength(maxLength: Int): String {
|
fun String.ofMaxLength(maxLength: Int): String {
|
||||||
|
@ -43,4 +45,8 @@ fun <T : OrderedDisplayable> Collection<T>.sortedByDisplayIndex(): Collection<T>
|
||||||
|
|
||||||
fun <T : IAccountTransaction> Iterable<T>.sortedByDate(): List<T> {
|
fun <T : IAccountTransaction> Iterable<T>.sortedByDate(): List<T> {
|
||||||
return this.sortedByDescending { it.valueDate.millisSinceEpoch }
|
return this.sortedByDescending { it.valueDate.millisSinceEpoch }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T : TypedBankAccount> Iterable<T>.withoutHiddenOnes(): List<T> {
|
||||||
|
return this.filter { it.hideAccount == false }
|
||||||
}
|
}
|
Loading…
Reference in New Issue