gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] 62/69: cleanup, preview


From: gnunet
Subject: [taler-taler-ios] 62/69: cleanup, preview
Date: Fri, 19 Jan 2024 09:02:35 +0100

This is an automated email from the git hooks/post-receive script.

marc-stibane pushed a commit to branch master
in repository taler-ios.

commit f6d7c049423170d88d85ed77f226ab4eead63fb2
Author: Marc Stibane <marc@taler.net>
AuthorDate: Thu Jan 18 09:36:59 2024 +0100

    cleanup, preview
---
 TalerWallet1/Helper/CurrencySpecification.swift      | 14 ++++++++++++++
 .../Views/HelperViews/QRCodeDetailView.swift         | 20 +++++++++-----------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/TalerWallet1/Helper/CurrencySpecification.swift 
b/TalerWallet1/Helper/CurrencySpecification.swift
index 7cae270..2fbf7a0 100644
--- a/TalerWallet1/Helper/CurrencySpecification.swift
+++ b/TalerWallet1/Helper/CurrencySpecification.swift
@@ -253,3 +253,17 @@ public class CurrencyFormatter: NumberFormatter {
         fatalError("init(coder:) has not been implemented")
     }
 }
+// MARK: -
+#if DEBUG
+func PreviewCurrencyInfo(_ currency: String, digits: Int) -> CurrencyInfo {
+    let unitName = digits == 0 ? "テ" : "ク"  // do not use real currency 
symbols like "¥" : "€"
+    let scope = ScopeInfo(type: .global, currency: currency)
+    let specs = CurrencySpecification(name: currency,
+                                      fractionalInputDigits: digits,
+                                      fractionalNormalDigits: digits,
+                                      fractionalTrailingZeroDigits: digits,
+                                      altUnitNames: [0 : unitName])
+    let previewFormatter = CurrencyFormatter.formatter(scope: scope, specs: 
specs)
+    return CurrencyInfo(scope: scope, specs: specs, formatter: 
previewFormatter)
+}
+#endif
diff --git a/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift 
b/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift
index 807b74a..0a2dcfc 100644
--- a/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift
+++ b/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift
@@ -10,12 +10,12 @@ import AVFoundation
 struct QRCodeDetailView: View {
     let talerURI: String
     let incoming: Bool
-    let amount: Amount?
+    let amount: Amount
 
     var body: some View {
         if talerURI.count > 10 {
             Section {
-                Text("Either", comment: "Either (copy/share)")
+                Text("Either", comment: "Either (copy/share the payment link 
to the ...)")
                     .multilineTextAlignment(.leading)
                     .accessibilityFont(.title3)
 //                    .padding(.vertical)
@@ -28,7 +28,8 @@ struct QRCodeDetailView: View {
 
                 let otherParty = incoming ? String(localized: "payer", 
comment: "the payment link to the (otherParty), or")
                                           : String(localized: "payee", 
comment: "the payment link to the (otherParty), or")
-                Text("the payment link to the \(otherParty), or", comment:  
"...the payment link to the (payer/payee), or")
+                Text("the payment link to the \(otherParty), or", 
+                     comment: "(Either copy/share the payment link) to the 
(payer/payee), or")
                     .multilineTextAlignment(.leading)
                     .accessibilityFont(.title3)
                     .listRowSeparator(.hidden)
@@ -41,14 +42,11 @@ struct QRCodeDetailView: View {
                 }
                 .listRowSeparator(.hidden)
 
-                // TODO: use currency formatter instead of .readableDescription
-                let hintStr = (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: "e.g. '5,3 €'")
-                              : String(localized: "let the payee scan this QR 
code to receive \(amount!.readableDescription).",
-                                       comment: "e.g. '$ 7.41'"))
+                let amountStr = amount.readableDescription       // TODO: 
currency formatter?
+                let hintStr = incoming ? String(localized: "let the payer scan 
this QR code to pay \(amountStr).",
+                                                  comment: "e.g. '5,3 €'")
+                                       : String(localized: "let the payee scan 
this QR code to receive \(amountStr).",
+                                                  comment: "e.g. '$ 7.41'")
                 Text(hintStr)
                     .fixedSize(horizontal: false, vertical: true)       // 
wrap in scrollview
                     .accessibilityFont(.title3)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]