taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit efd0bc8c9f6ef02537a085d011fd3e928c1ed041
parent 83d63347890a2ca0ccca2e282fe8bb390a45d99c
Author: Marc Stibane <marc@taler.net>
Date:   Sat, 27 Jul 2024 18:51:24 +0200

ConfirmationButton

Diffstat:
MTalerWallet1/Views/HelperViews/Buttons.swift | 28++++++++++++++++++++++++++++
MTalerWallet1/Views/Transactions/TransactionSummaryV.swift | 23++++-------------------
2 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift b/TalerWallet1/Views/HelperViews/Buttons.swift @@ -28,6 +28,34 @@ struct HamburgerButton : View { } } +struct ConfirmationButton: View { + let destination: URL + let hintTitle: String + let buttonTitle: String + let a11yHint: String + + @AppStorage("minimalistic") var minimalistic: Bool = false + + var body: some View { + VStack(alignment: .leading) { + if !minimalistic { // show hint that the user should authorize on bank website + Text(hintTitle) +// .fixedSize(horizontal: false, vertical: true) // wrap in scrollview + .multilineTextAlignment(.leading) // otherwise + .listRowSeparator(.hidden) + } + Link(destination: destination) { + HStack(spacing: 8.0) { + Image(systemName: "link") + Text(buttonTitle) + } + } + .buttonStyle(TalerButtonStyle(type: .prominent, badge: CONFIRM_BANK)) + .accessibilityHint(a11yHint) + } + } +} + struct QRButton : View { let action: () -> Void diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -218,24 +218,6 @@ struct TransactionSummaryV: View { } } - struct ConfirmationButton: View { - let destination: URL - @AppStorage("minimalistic") var minimalistic: Bool = false - - var body: some View { - VStack(alignment: .leading) { - if !minimalistic { // show hint that the user should authorize on bank website - Text("The bank is waiting for your authorization.") -// .fixedSize(horizontal: false, vertical: true) // wrap in scrollview - .multilineTextAlignment(.leading) // otherwise - .listRowSeparator(.hidden) - } - Link("Authorize now: 􀉣", destination: destination) - .buttonStyle(TalerButtonStyle(type: .prominent, badge: CONFIRM_BANK)) - .accessibilityHint(String(localized: "Will go to bank website to authorize this withdrawal.")) - } - } - } struct PendingWithdrawalDetails: View { @Binding var transaction: Transaction @@ -261,7 +243,10 @@ struct TransactionSummaryV: View { if !confirmed { if let confirmationUrl = withdrawalDetails.bankConfirmationUrl { if let destination = URL(string: confirmationUrl) { - ConfirmationButton(destination: destination) + ConfirmationButton(destination: destination, + hintTitle: String(localized: "The bank is waiting for your authorization."), + buttonTitle: String(localized: "Authorize now"), + a11yHint: String(localized: "Will go to bank website to authorize this withdrawal.")) } } } } } // switch }