Implemented showAddAccountDialog() and TransferMoneyDialog()

This commit is contained in:
dankito 2020-10-21 15:01:28 +02:00
parent 5a32ef4958
commit eff4e131df
2 changed files with 26 additions and 27 deletions

View File

@ -6,7 +6,7 @@ class SwiftUiRouter : IRouter {
func showAddAccountDialog(presenter: BankingPresenter) { func showAddAccountDialog(presenter: BankingPresenter) {
SceneDelegate.navigateToView(AddAccountDialog())
} }
func getTanFromUserFromNonUiThread(bank: IBankData, tanChallenge: TanChallenge, presenter: BankingPresenter, callback: @escaping (EnterTanResult) -> Void) { func getTanFromUserFromNonUiThread(bank: IBankData, tanChallenge: TanChallenge, presenter: BankingPresenter, callback: @escaping (EnterTanResult) -> Void) {
@ -20,7 +20,7 @@ class SwiftUiRouter : IRouter {
} }
func showTransferMoneyDialog(presenter: BankingPresenter, preselectedValues: TransferMoneyData?) { func showTransferMoneyDialog(presenter: BankingPresenter, preselectedValues: TransferMoneyData?) {
SceneDelegate.navigateToView(TransferMoneyDialog(preselectedValues))
} }
func showSendMessageLogDialog(presenter: BankingPresenter) { func showSendMessageLogDialog(presenter: BankingPresenter) {

View File

@ -70,14 +70,12 @@ struct TransferMoneyDialog: View {
@Inject private var presenter: BankingPresenterSwift @Inject private var presenter: BankingPresenterSwift
init() { init(_ preselectedValues: TransferMoneyData? = nil) {
self.accountsSupportingTransferringMoney = self.presenter.accountsSupportingTransferringMoneySortedByDisplayIndex self.accountsSupportingTransferringMoney = self.presenter.accountsSupportingTransferringMoneySortedByDisplayIndex
self.showAccounts = self.accountsSupportingTransferringMoney.count > 1 self.showAccounts = self.accountsSupportingTransferringMoney.count > 1
}
init(preselectedValues: TransferMoneyData) { if let preselectedValues = preselectedValues {
self.init()
let preselectedBankAccount = preselectedValues.account let preselectedBankAccount = preselectedValues.account
self._selectedAccountIndex = State(initialValue: accountsSupportingTransferringMoney.firstIndex(where: { account in account == preselectedBankAccount }) ?? 0) self._selectedAccountIndex = State(initialValue: accountsSupportingTransferringMoney.firstIndex(where: { account in account == preselectedBankAccount }) ?? 0)
@ -102,6 +100,7 @@ struct TransferMoneyDialog: View {
_validateDataWhenShowingDialog = State(initialValue: true) _validateDataWhenShowingDialog = State(initialValue: true)
} }
}
var body: some View { var body: some View {