taler-ios

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

commit 71bdc77649055c39e8462623b7ba0108ee4aab55
parent 73dc3c18fc5d571d68d45d939803afaeab53d8a0
Author: Marc Stibane <marc@taler.net>
Date:   Tue, 25 Jul 2023 16:34:19 +0200

QRcode rendering and hint

Diffstat:
MTalerWallet1/Views/HelperViews/QRCodeDetailView.swift | 32++++++++++++++++++++++----------
MTalerWallet1/Views/Transactions/TransactionDetailView.swift | 3++-
2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift b/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift @@ -10,25 +10,37 @@ import AVFoundation struct QRCodeDetailView: View { let talerURI: String let incoming: Bool + let amount: Amount? var body: some View { if talerURI.count > 10 { - VStack { - Text(incoming ? "Let the payer scan this QR code to pay:" - : "Let the payee scan this QR code to receive:") - .fixedSize(horizontal: false, vertical: true) - .padding(.top, 30) + VStack (alignment: .leading) { + // TODO: use currency formatter instead of .readableDescription + let amountStr = (amount == nil) ? + (incoming ? String(localized: "Let the payer scan this QR code to pay:") + : String(localized: "Let the payee scan this QR code to receive:")) + : (incoming ? String(localized: "Let the payer scan this QR code to pay \(amount!.readableDescription):", + comment: "amount.readableDescription: 5,3 €") + : String(localized: "Let the payee scan this QR code to receive \(amount!.readableDescription):", + comment: "amount.readableDescription: 7.41 $")) + Text(amountStr) + .fixedSize(horizontal: false, vertical: true) // wrap in scrollview +// .padding(.top, 30) .font(.title3) - - QRGeneratorView(text: talerURI) -// Text(talerURI) + HStack { + Spacer() + QRGeneratorView(text: talerURI) + Spacer() + } Text("Alternatively, copy and send this link:") - .fixedSize(horizontal: false, vertical: true) + .multilineTextAlignment(.leading) .font(.title3) .padding(.vertical) Text(talerURI) + .multilineTextAlignment(.center) + .fixedSize(horizontal: false, vertical: true) // wrap in scrollview .padding(.bottom) CopyShare(textToCopy: talerURI) @@ -44,7 +56,7 @@ fileprivate struct ContentView: View { var body: some View { List { - QRCodeDetailView(talerURI: talerURI, incoming: false) + QRCodeDetailView(talerURI: talerURI, incoming: false, amount: nil) } } } diff --git a/TalerWallet1/Views/Transactions/TransactionDetailView.swift b/TalerWallet1/Views/Transactions/TransactionDetailView.swift @@ -252,7 +252,8 @@ struct TransactionDetailView: View { if let talerURI = details[TALERURI] { if talerURI.count > 10 { QRCodeDetailView(talerURI: talerURI, - incoming: transaction.isP2pIncoming) + incoming: transaction.isP2pIncoming, + amount: transaction.common.amountRaw) } } } else if keys.contains(EXCHANGEBASEURL) {