From 589e1e673a34a7ccf2b36b04f023c6aac564f11b Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 28 Sep 2020 23:14:36 +0200 Subject: [PATCH] Implemented hiding account and disabling automatic account update --- .../banking/persistence/model/BankAccount.kt | 4 ++ .../persistence/model/BankAccountEntity.kt | 2 + .../settings/BankAccountSettingsDialog.kt | 10 +++ .../dialogs/settings/SettingsDialog.kt | 2 +- .../banking/ui/android/home/HomeFragment.kt | 15 +---- .../banking/ui/android/views/DrawerView.kt | 4 +- .../layout/dialog_bank_account_settings.xml | 22 +++++++ .../src/main/res/values-de/strings.xml | 5 +- .../src/main/res/values/dimens.xml | 3 + .../src/main/res/values/strings.xml | 5 +- .../src/main/res/values/styles.xml | 12 ++++ .../AccountTransactionsControlView.kt | 3 +- .../ui/javafx/dialogs/AddAccountDialog.kt | 2 +- .../dankito/banking/ui/model/BankAccount.kt | 4 ++ .../dankito/banking/ui/model/IBankAccount.kt | 19 ++++++ .../net/dankito/banking/ui/model/IBankData.kt | 3 + .../banking/ui/presenter/BankingPresenter.kt | 64 ++++++++++++------- .../BankingiOSApp.xcdatamodel/contents | 4 +- .../Base.lproj/Localizable.strings | 3 + .../de.lproj/Localizable.strings | 3 + .../dialogs/AccountTransactionsDialog.swift | 13 +--- .../ui/dialogs/AccountsDialog.swift | 2 +- .../dialogs/BankAccountSettingsDialog.swift | 16 +++++ .../ui/views/listitems/BankListItem.swift | 2 +- 24 files changed, 163 insertions(+), 59 deletions(-) diff --git a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/BankAccount.kt b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/BankAccount.kt index 7d9ce5d7..6bc47ef7 100644 --- a/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/BankAccount.kt +++ b/persistence/database/RoomBankingPersistence/src/main/java/net/dankito/banking/persistence/model/BankAccount.kt @@ -66,6 +66,10 @@ open class BankAccount( override var displayIndex: Int = 0 + override var hideAccount = false + + override var updateAccountAutomatically = true + override var doNotShowStrikingFetchAllTransactionsView = false diff --git a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/BankAccountEntity.kt b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/BankAccountEntity.kt index 5993faab..0d79351a 100644 --- a/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/BankAccountEntity.kt +++ b/persistence/json/BankingPersistenceJson/src/main/kotlin/net/dankito/banking/persistence/model/BankAccountEntity.kt @@ -34,6 +34,8 @@ open class BankAccountEntity( override var haveAllTransactionsBeenRetrieved: Boolean = false, override var isAccountTypeSupportedByApplication: Boolean = true, override var displayIndex: Int = 0, + override var hideAccount: Boolean = false, + override var updateAccountAutomatically: Boolean = true, override var doNotShowStrikingFetchAllTransactionsView: Boolean = false ) : IBankAccount { diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankAccountSettingsDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankAccountSettingsDialog.kt index aad2b19e..b090ebed 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankAccountSettingsDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/BankAccountSettingsDialog.kt @@ -46,6 +46,11 @@ open class BankAccountSettingsDialog : SettingsDialogBase() { edtxtBankAccountName.text = account.displayName + swtchHideAccount.setOnCheckedChangeListener { _, hideAccount -> swtchUpdateAccountAutomatically.isEnabled = hideAccount == false } + + swtchHideAccount.isChecked = account.hideAccount + swtchUpdateAccountAutomatically.isChecked = account.updateAccountAutomatically + lvlAccountHolderName.value = account.accountHolderName lvlAccountIdentifier.value = account.identifier lvlSubAccountNumber.setValueAndVisibilityIfValueIsSet(account.subAccountNumber) @@ -66,10 +71,15 @@ open class BankAccountSettingsDialog : SettingsDialogBase() { override val hasUnsavedChanges: Boolean get() = didChange(edtxtBankAccountName, account.displayName) + || swtchHideAccount.isChecked != account.hideAccount + || swtchUpdateAccountAutomatically.isChecked != account.updateAccountAutomatically override fun saveChanges() { account.userSetDisplayName = edtxtBankAccountName.text + account.hideAccount = swtchHideAccount.isChecked + account.updateAccountAutomatically = swtchUpdateAccountAutomatically.isChecked + presenter.accountUpdated(account) } diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/SettingsDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/SettingsDialog.kt index d3b18d5e..163ccbf4 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/SettingsDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/settings/SettingsDialog.kt @@ -42,7 +42,7 @@ open class SettingsDialog : SettingsDialogBase() { protected open fun setupUI(rootView: View) { rootView.apply { toolbar.apply { - setupToolbar(this, rootView.context.getString(R.string.dialog_settings_title), false) + setupToolbar(this, rootView.context.getString(R.string.settings), false) } val items = createBanksAdapterItems() diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/home/HomeFragment.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/home/HomeFragment.kt index 0679f72f..270f8651 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/home/HomeFragment.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/home/HomeFragment.kt @@ -190,7 +190,7 @@ class HomeFragment : Fragment() { } private fun updateAccountsTransactions() { - presenter.updateSelectedAccountsTransactionsAsync { } + presenter.updateSelectedAccountsTransactionsAsync() } private fun handleGetTransactionsResponseOffUiThread(response: GetTransactionsResponse) { @@ -320,20 +320,11 @@ class HomeFragment : Fragment() { private fun fetchTransactions() { - presenter.selectedAccounts.forEach { account -> - if (account.haveAllTransactionsBeenRetrieved) { - presenter.updateAccountTransactionsAsync(account) - } - else { - presenter.fetchAllAccountTransactionsAsync(account) - } - } + presenter.fetchTransactionsOfSelectedAccounts() } private fun fetchAllTransactions() { - accountsForWhichNotAllTransactionsHaveBeenFetched.forEach { account -> - presenter.fetchAllAccountTransactionsAsync(account) - } + presenter.fetchAllTransactionsOfSelectedAccounts() } } \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/DrawerView.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/DrawerView.kt index 5850a818..3f84da20 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/DrawerView.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/views/DrawerView.kt @@ -105,7 +105,7 @@ open class DrawerView( , PrimaryDrawerItem() - .withName(R.string.drawer_menu_show_settings_dialog_title) + .withName(R.string.settings) .withIcon(R.drawable.ic_baseline_settings_24) .withIconColor(ContextCompat.getColorStateList(activity, R.color.primaryTextColor_Dark)!!) .withSelectable(false) @@ -163,7 +163,7 @@ open class DrawerView( } private fun createBankAccountsDrawerItems(bank: TypedBankData): List> { - return bank.accountsSorted.map { account -> + return bank.visibleAccountsSorted.map { account -> SecondaryDrawerItem() .withName(account.displayName) .withLevel(AccountLevel) diff --git a/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_account_settings.xml b/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_account_settings.xml index 2422a1f0..44bccbe0 100644 --- a/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_account_settings.xml +++ b/ui/BankingAndroidApp/src/main/res/layout/dialog_bank_account_settings.xml @@ -53,6 +53,13 @@ android:layout_height="wrap_content" > + + + + + + @@ -68,6 +89,7 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginTop="@dimen/form_section_extra_margin_top" > Suchen Konto hinzufügen + Einstellungen Online-Banking Zugangsdaten Login Name @@ -34,7 +35,6 @@ Version\u0020 Navigationsbereich Alle Konten - Einstellungen Konto Überweisung @@ -105,7 +105,6 @@ ATC muss eine Zahl sein.\n\nDer eingebene ATC Wert \'%s\' kann jedoch nicht in eine Zahl konvertiert werden. - Einstellungen Message Log senden @@ -115,6 +114,8 @@ Konto löschen Name + Konto ausblenden + Konto automatisch updaten Kontodaten Kontoinhaber Kontonummer diff --git a/ui/BankingAndroidApp/src/main/res/values/dimens.xml b/ui/BankingAndroidApp/src/main/res/values/dimens.xml index 5d15501d..76618ebe 100644 --- a/ui/BankingAndroidApp/src/main/res/values/dimens.xml +++ b/ui/BankingAndroidApp/src/main/res/values/dimens.xml @@ -31,6 +31,9 @@ 15sp 4dp + 30dp + 15sp + 4dp 24dp 40dp diff --git a/ui/BankingAndroidApp/src/main/res/values/strings.xml b/ui/BankingAndroidApp/src/main/res/values/strings.xml index 87917061..0ca9164f 100644 --- a/ui/BankingAndroidApp/src/main/res/values/strings.xml +++ b/ui/BankingAndroidApp/src/main/res/values/strings.xml @@ -14,6 +14,7 @@ Search Add account + Settings Online banking login data Login name @@ -34,7 +35,6 @@ Version\u0020 Navigation header All accounts - Settings Account Transfer money @@ -105,7 +105,6 @@ ATC has to be a number.\n\nBut entered ATC value \'%s\' cannot be converted to a number. - Settings Send message log @@ -115,6 +114,8 @@ Delete account Name + Hide account + Update account automatically Account data Account holder name Account identifier diff --git a/ui/BankingAndroidApp/src/main/res/values/styles.xml b/ui/BankingAndroidApp/src/main/res/values/styles.xml index cf0393ec..8a9ce688 100644 --- a/ui/BankingAndroidApp/src/main/res/values/styles.xml +++ b/ui/BankingAndroidApp/src/main/res/values/styles.xml @@ -78,4 +78,16 @@ @drawable/fab_add + + + diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/controls/AccountTransactionsControlView.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/controls/AccountTransactionsControlView.kt index 93d3add9..2adab4be 100644 --- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/controls/AccountTransactionsControlView.kt +++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/controls/AccountTransactionsControlView.kt @@ -140,8 +140,7 @@ open class AccountTransactionsControlView( } protected open fun updateAccountTransactions(processingIndicatorButton: ProcessingIndicatorButton) { - // TODO: or only update transactions of selected accounts? - presenter.updateAccountsTransactionsAsync { + presenter.updateSelectedAccountsTransactionsAsync { runLater { processingIndicatorButton.resetIsProcessing() } diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt index 93ebccac..ef7a9594 100755 --- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt +++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt @@ -273,7 +273,7 @@ open class AddAccountDialog(protected val presenter: BankingPresenter) : Window( val userSelection = dialogService.showDialog(Alert.AlertType.CONFIRMATION, message, null, currentStage, ButtonType.YES, ButtonType.NO) when (userSelection) { - ButtonType.YES -> presenter.fetchAllAccountTransactionsAsync(response.bank) { } + ButtonType.YES -> presenter.fetchAllAccountTransactionsAsync(response.bank) else -> { } // nothing to do then, simply close dialog } diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt index ced2909a..2efcc619 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt @@ -50,6 +50,10 @@ open class BankAccount @JvmOverloads constructor( override var displayIndex: Int = 0 + override var hideAccount = false + + override var updateAccountAutomatically = true + override var doNotShowStrikingFetchAllTransactionsView = false diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/IBankAccount.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/IBankAccount.kt index f345ad66..95096530 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/IBankAccount.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/IBankAccount.kt @@ -30,6 +30,25 @@ interface IBankAccount : OrderedDisplayable { var haveAllTransactionsBeenRetrieved: Boolean var isAccountTypeSupportedByApplication: Boolean var userSetDisplayName: String? + + /** + * Account will not be visible in UI + */ + var hideAccount: Boolean + + /** + * Account is still visible in UI but will not be included in automatic accounts refresh (Kontorundruf) or if multiple accounts get updated. + * + * However it still can be updated if navigated to that single account and call update there. + */ + var updateAccountAutomatically: Boolean + + /** + * If there are still older transactions to fetch, that is [haveAllTransactionsBeenRetrieved] is [false], at a striking place, + * e.g. above transactions list or with an overlay, an information will be displayed to fetch all transactions. + * + * However this information can be dismissed by user. Than it still will be visible below transactions list where it's not that well visible to user. + */ var doNotShowStrikingFetchAllTransactionsView: Boolean diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/IBankData.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/IBankData.kt index c9f0eff1..688f7a50 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/IBankData.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/IBankData.kt @@ -43,6 +43,9 @@ interface IBankData, TAccountTransac val accountsSorted: List get() = accounts.sortedByDisplayIndex() + val visibleAccountsSorted: List + get() = accountsSorted.filter { it.hideAccount == false } + val balance: BigDecimal get() = accounts.map { it.balance }.sum() diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt index 40396be5..c80787b2 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt @@ -115,7 +115,7 @@ open class BankingPresenter( readAppSettings() readPersistedBanks() - updateAccountsTransactionsIfNoTanIsRequiredAsync() + updateAllAccountsTransactionsAsync() } // preloadBankList asynchronously; on Android it takes approximately 18 seconds till banks are indexed for first time -> do it as early as possible @@ -252,7 +252,7 @@ open class BankingPresenter( } protected open fun deleteAccountOffUiThread(bank: TypedBankData) { - val wasSelected = isSingleSelectedBank(bank) or // either account or one of its bank accounts is currently selected + val wasSelected = isSingleSelectedBank(bank) or // either bank or one of its bank accounts is currently selected (bank.accounts.firstOrNull { isSingleSelectedAccount(it) } != null) val client = bankingClientsForBanks.remove(bank) @@ -278,6 +278,28 @@ open class BankingPresenter( } + /** + * If for an account already all transactions have been fetch, then latest transactions get fetched. + * + * Otherwise all transactions are fetched. + */ + open fun fetchTransactionsOfSelectedAccounts(callback: ((GetTransactionsResponse) -> Unit)? = null) { + selectedAccounts.forEach { account -> + if (account.haveAllTransactionsBeenRetrieved) { + updateAccountTransactionsAsync(account, false, callback) + } + else { + fetchAllAccountTransactionsAsync(account, callback) + } + } + } + + open fun fetchAllTransactionsOfSelectedAccounts(callback: ((GetTransactionsResponse) -> Unit)? = null) { + selectedAccountsForWhichNotAllTransactionsHaveBeenFetched.forEach { account -> + fetchAllAccountTransactionsAsync(account, callback) + } + } + open fun fetchAllAccountTransactionsAsync(bank: TypedBankData, callback: ((GetTransactionsResponse) -> Unit)? = null) { @@ -288,13 +310,13 @@ open class BankingPresenter( } } - open fun fetchAllAccountTransactionsAsync(account: TypedBankAccount, + protected open fun fetchAllAccountTransactionsAsync(account: TypedBankAccount, callback: ((GetTransactionsResponse) -> Unit)? = null) { fetchAccountTransactionsAsync(account, null, false, callback) } - open fun fetchAccountTransactionsAsync(account: TypedBankAccount, fromDate: Date?, abortIfTanIsRequired: Boolean = false, + protected open fun fetchAccountTransactionsAsync(account: TypedBankAccount, fromDate: Date?, abortIfTanIsRequired: Boolean = false, callback: ((GetTransactionsResponse) -> Unit)? = null) { getBankingClientForBank(account.bank)?.let { client -> @@ -311,29 +333,25 @@ open class BankingPresenter( } } - open fun updateAccountsTransactionsAsync(callback: (GetTransactionsResponse) -> Unit) { - updateAccountsTransactionsAsync(false, callback) + + open fun updateAllAccountsTransactionsAsync(callback: ((GetTransactionsResponse) -> Unit)? = null) { + val accountsToUpdate = allAccounts.filter { it.hideAccount == false && it.updateAccountAutomatically } + + updateAccountsTransactionsAsync(accountsToUpdate, true, callback) } - open fun updateAccountsTransactionsIfNoTanIsRequiredAsync() { - updateAccountsTransactionsAsync(true) { } - } - - open fun updateSelectedAccountsTransactionsAsync(callback: (GetTransactionsResponse) -> Unit) { - updateAccountsTransactionsAsync(selectedAccounts, false, callback) - } - - protected open fun updateAccountsTransactionsAsync(abortIfTanIsRequired: Boolean = false, callback: (GetTransactionsResponse) -> Unit) { - bankingClientsForBanks.keys.forEach { account -> - account.accounts.forEach { account -> - if (account.supportsRetrievingAccountTransactions) { - updateAccountTransactionsAsync(account, abortIfTanIsRequired, callback) - } - } + open fun updateSelectedAccountsTransactionsAsync(callback: ((GetTransactionsResponse) -> Unit)? = null) { + var accountsToUpdate = selectedAccounts.filter { it.updateAccountAutomatically } + if (accountsToUpdate.isEmpty() && (selectedAccountType == SelectedAccountType.SingleAccount + || (selectedAccountType == SelectedAccountType.SingleBank && selectedAccounts.size == 1))) { + accountsToUpdate = selectedAccounts } + + updateAccountsTransactionsAsync(accountsToUpdate, false, callback) } - protected open fun updateAccountsTransactionsAsync(accounts: List, abortIfTanIsRequired: Boolean = false, callback: (GetTransactionsResponse) -> Unit) { + + protected open fun updateAccountsTransactionsAsync(accounts: List, abortIfTanIsRequired: Boolean = false, callback: ((GetTransactionsResponse) -> Unit)? = null) { accounts.forEach { account -> if (account.supportsRetrievingAccountTransactions) { updateAccountTransactionsAsync(account, abortIfTanIsRequired, callback) @@ -733,7 +751,7 @@ open class BankingPresenter( } protected open fun setSelectedAccounts(accounts: List) { - this._selectedAccounts = ArrayList(accounts) // make a copy + this._selectedAccounts = ArrayList(accounts.filter { it.hideAccount == false }) // make a copy callSelectedAccountsChangedListeners(_selectedAccounts) } diff --git a/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents b/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents index 5e0b3b2f..c8bc3c1a 100644 --- a/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents +++ b/ui/BankingiOSApp/BankingiOSApp/BankingiOSApp.xcdatamodeld/BankingiOSApp.xcdatamodel/contents @@ -44,6 +44,7 @@ + @@ -56,6 +57,7 @@ + @@ -91,7 +93,7 @@ - + diff --git a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings index c2c54441..854e0c48 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings +++ b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings @@ -178,6 +178,9 @@ Unfortunately, Bankmeister cannot know whether a bank charges for real-time tran /* BankAccountSettingsDialog */ "Account holder name" = "Account holder name"; +"Hide bank account" = "Hide account"; +"Update bank account automatically" = "Update account automatically"; + "Bank account identifier" = "Account identifier"; "Sub account number" = "Sub account number"; "Bank account type" = "Type"; diff --git a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings index b47f9297..af121385 100644 --- a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings +++ b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings @@ -179,6 +179,9 @@ Ob eine Bank Gebühren für Echtzeitüberweisungen erhebt, kann Bankmeister leid /* BankAccountSettingsDialog */ "Account holder name" = "Kontoinhaber"; +"Hide bank account" = "Konto ausblenden"; +"Update bank account automatically" = "Konto automatisch updaten"; + "Bank account identifier" = "Kontonummer"; "Sub account number" = "Unterkontenmerkmal"; "Bank account type" = "Typ"; diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AccountTransactionsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AccountTransactionsDialog.swift index aa05280f..b8a2ce1f 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AccountTransactionsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AccountTransactionsDialog.swift @@ -218,20 +218,11 @@ struct AccountTransactionsDialog: View { } private func fetchTransactions() { - for account in presenter.selectedAccounts { - if account.haveAllTransactionsBeenRetrieved { - presenter.updateAccountTransactionsAsync(account: account, abortIfTanIsRequired: false, callback: self.handleGetTransactionsResult) - } - else { - presenter.fetchAllAccountTransactionsAsync(account: account, callback: self.handleGetTransactionsResult) - } - } + presenter.fetchTransactionsOfSelectedAccounts(callback: self.handleGetTransactionsResult) } private func fetchAllTransactions() { - accountsForWhichNotAllTransactionsHaveBeenFetched.forEach { account in - presenter.fetchAllAccountTransactionsAsync(account: account, callback: self.handleGetTransactionsResult) - } + presenter.fetchAllTransactionsOfSelectedAccounts(callback: self.handleGetTransactionsResult) } private func handleGetTransactionsResult(_ response: GetTransactionsResponse) { diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AccountsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AccountsDialog.swift index 262be95b..bb45330f 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AccountsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AccountsDialog.swift @@ -37,7 +37,7 @@ struct AccountsDialog: View { .systemGroupedBackground() .showNavigationBarTitle("Accounts") .navigationBarItems(leading: data.hasAtLeastOneAccountBeenAdded == false ? nil : UpdateButton { _, executingDone in - self.presenter.updateAccountsTransactionsAsync { _ in executingDone() } + self.presenter.updateAllAccountsTransactionsAsync { _ in executingDone() } }) } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankAccountSettingsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankAccountSettingsDialog.swift index 0e8058eb..19176542 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankAccountSettingsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/BankAccountSettingsDialog.swift @@ -13,11 +13,17 @@ struct BankAccountSettingsDialog: View { @State private var displayName: String + @State private var hideAccount: Bool + + @State private var updateAccountAutomatically: Bool + @State private var unsavedChangesMessage: Message? = nil private var hasUnsavedData: Bool { return account.displayName != displayName + || account.hideAccount != hideAccount + || account.updateAccountAutomatically != updateAccountAutomatically } @@ -25,6 +31,8 @@ struct BankAccountSettingsDialog: View { self.account = account _displayName = State(initialValue: account.displayName) + _hideAccount = State(initialValue: account.hideAccount) + _updateAccountAutomatically = State(initialValue: account.updateAccountAutomatically) } @@ -32,6 +40,11 @@ struct BankAccountSettingsDialog: View { Form { Section { LabelledUIKitTextField(label: "Name", text: $displayName, autocapitalizationType: .none) + + Toggle("Hide bank account", isOn: $hideAccount) + + Toggle("Update bank account automatically", isOn: $updateAccountAutomatically) + .disabled(hideAccount) } Section { @@ -80,6 +93,9 @@ struct BankAccountSettingsDialog: View { if hasUnsavedData { account.userSetDisplayName = displayName + account.hideAccount = hideAccount + account.updateAccountAutomatically = updateAccountAutomatically + presenter.accountUpdated(account: account) } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/listitems/BankListItem.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/listitems/BankListItem.swift index 07fe21fa..883312e9 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/listitems/BankListItem.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/listitems/BankListItem.swift @@ -48,7 +48,7 @@ struct BankListItem : View { // if a constant id like \.technicalId is provided, list doesn't get updated on changes e.g. when balance changes - ForEach(bank.accountsSorted, id: \.randomId) { account in + ForEach(bank.visibleAccountsSorted, id: \.randomId) { account in BankAccountListItem(account: account) } .padding(.leading, Styles.AccountsIconWidth + Styles.DefaultSpaceBetweenIconAndText)