taler-ios

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

commit 563d123acbbeed4c1ba0dc1073f6db31695d0a68
parent df8e8b11bde025aad22e53bcb1e02c44464e6435
Author: Marc Stibane <marc@taler.net>
Date:   Tue,  8 Oct 2024 07:51:47 +0200

QRButton in Actions

Diffstat:
MTalerWallet1/Views/Actions/ActionsSheet.swift | 2+-
MTalerWallet1/Views/HelperViews/Buttons.swift | 29+++++++++++++++++++++++------
2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/TalerWallet1/Views/Actions/ActionsSheet.swift b/TalerWallet1/Views/Actions/ActionsSheet.swift @@ -75,7 +75,7 @@ struct ActionsSheet: View { .padding(.bottom, 20) } - QRButton(action: qrButtonTapped) + QRButton(isNavBarItem: false, action: qrButtonTapped) .lineLimit(5) .buttonStyle(TalerButtonStyle(type: .bordered, narrow: true, aligned: .center)) diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift b/TalerWallet1/Views/HelperViews/Buttons.swift @@ -58,20 +58,37 @@ struct LinkButton: View { } struct QRButton : View { + let isNavBarItem: Bool let action: () -> Void @AppStorage("minimalistic") var minimalistic: Bool = false var body: some View { + let scanText = String(localized: "Scan QR codes", comment: "Button title, a11y") + let qr = "qrcode.viewfinder" Button(action: action) { - if !minimalistic { - Text("Scan QR") - .talerFont(.title3) + if isNavBarItem { + if !minimalistic { + Text("Scan QR", comment: "Button title") + .talerFont(.title3) + } + Text("\(Image(systemName: qr))") + .talerFont(.title2) + } else if minimalistic { + let width = UIScreen.screenWidth / 7 + Text("\(Image(systemName: qr))") + .talerFont(.largeTitle) + .padding(.horizontal, width) +// .padding(.vertical) + } else { + HStack { + Text("\(Image(systemName: qr)) ") + .talerFont(.title) + Text("\(scanText) ") + }//.padding() } - Image(systemName: "qrcode.viewfinder") - .talerFont(.title2) } - .accessibilityLabel("Scan QR codes") + .accessibilityLabel(scanText) } }