Fixed that some clients need a response
This commit is contained in:
parent
b7f9a2a5f7
commit
8a2750a21c
|
@ -348,18 +348,18 @@ open class BankingPresenter(
|
|||
updateAllAccountsTransactionsAsync()
|
||||
}
|
||||
|
||||
open fun updateAllAccountsTransactionsAsync(done: (() -> Unit)? = null) {
|
||||
open fun updateAllAccountsTransactionsAsync(callback: ((GetTransactionsResponse?) -> Unit)? = null) {
|
||||
val accountsToUpdate = allAccounts.filter { considerAccountInAutomaticUpdates(it) }
|
||||
|
||||
if (accountsToUpdate.isNotEmpty()) {
|
||||
updateAccountsTransactionsAsync(accountsToUpdate, true) { done?.invoke() }
|
||||
updateAccountsTransactionsAsync(accountsToUpdate, true, callback)
|
||||
}
|
||||
else if (allAccounts.isNotEmpty()) {
|
||||
done?.invoke()
|
||||
callback?.invoke(null)
|
||||
}
|
||||
}
|
||||
|
||||
open fun updateSelectedAccountsTransactionsAsync(done: (() -> Unit)? = null) {
|
||||
open fun updateSelectedAccountsTransactionsAsync(done: ((GetTransactionsResponse?) -> Unit)? = null) {
|
||||
var accountsToUpdate = selectedAccounts.filter { considerAccountInAutomaticUpdates(it) }
|
||||
if (accountsToUpdate.isEmpty() && (selectedAccountType == SelectedAccountType.SingleAccount
|
||||
|| (selectedAccountType == SelectedAccountType.SingleBank && selectedAccounts.size == 1))) {
|
||||
|
@ -367,10 +367,10 @@ open class BankingPresenter(
|
|||
}
|
||||
|
||||
if (accountsToUpdate.isNotEmpty()) {
|
||||
updateAccountsTransactionsAsync(accountsToUpdate, false) { done?.invoke() }
|
||||
updateAccountsTransactionsAsync(accountsToUpdate, false, done)
|
||||
}
|
||||
else if (allAccounts.isNotEmpty()) {
|
||||
done?.invoke()
|
||||
done?.invoke(null)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -206,6 +206,7 @@ struct AccountTransactionsDialog: View {
|
|||
|
||||
self.balanceOfAllTransactions = self.presenter.balanceOfSelectedAccounts
|
||||
|
||||
if let response = response {
|
||||
if response.successful {
|
||||
self.filterTransactions(self.searchText)
|
||||
}
|
||||
|
@ -216,6 +217,7 @@ struct AccountTransactionsDialog: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func fetchTransactions() {
|
||||
presenter.fetchTransactionsOfSelectedAccounts(callback: self.handleGetTransactionsResult)
|
||||
|
|
Loading…
Reference in New Issue