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) {
SceneDelegate.navigateToView(AddAccountDialog())
}
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?) {
SceneDelegate.navigateToView(TransferMoneyDialog(preselectedValues))
}
func showSendMessageLogDialog(presenter: BankingPresenter) {

View File

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