commit e45dd7de86e10db36ff6a8b99a9de30bc0a08b25
parent 9dd6a9c4be80bd02c0389bcf7300dd97cd95ea7c
Author: Marc Stibane <marc@taler.net>
Date: Fri, 18 Oct 2024 19:03:15 +0200
CurrencySpecification
Diffstat:
2 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift b/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift
@@ -15,6 +15,7 @@ struct QRCodeDetailView: View {
let talerCopyShare: String
let incoming: Bool
let amount: Amount
+ let specs: CurrencySpecification
@EnvironmentObject private var controller: Controller
@AppStorage("minimalistic") var minimalistic: Bool = false
@@ -39,7 +40,7 @@ struct QRCodeDetailView: View {
.accessibilityLabel("QR Code")
.listRowSeparator(.hidden)
if !minimalistic {
- let amountStr = amount.formatted(isNegative: false)
+ let amountStr = amount.formatted(specs: specs, isNegative: false)
let scanLong = incoming ? String(localized: "(payer) 1",
defaultValue: "Let the payer scan this QR code to pay \(amountStr).",
comment: "e.g. '5,3 €'")
@@ -62,20 +63,20 @@ struct QRCodeDetailView: View {
}
// MARK: -
#if DEBUG
-fileprivate struct ContentView: View {
- @State var previewURI: String = "taler://pay-push/exchange.demo.taler.net/95ZG4D1AGFGZQ7CNQ1V49D3FT18HXKA6HQT4X3XME9YSJQVFQ520"
-
- var body: some View {
- let amount = Amount(currency: LONGCURRENCY, cent: 123)
- List {
- QRCodeDetailView(talerURI: previewURI, talerCopyShare: previewURI, incoming: false, amount: amount)
- }
- }
-}
-struct QRCodeDetailView_Previews: PreviewProvider {
-
- static var previews: some View {
- ContentView()
- }
-}
+//fileprivate struct ContentView: View {
+// @State var previewURI: String = "taler://pay-push/exchange.demo.taler.net/95ZG4D1AGFGZQ7CNQ1V49D3FT18HXKA6HQT4X3XME9YSJQVFQ520"
+//
+// var body: some View {
+// let amount = Amount(currency: LONGCURRENCY, cent: 123)
+// List {
+// QRCodeDetailView(talerURI: previewURI, talerCopyShare: previewURI, incoming: false, amount: amount)
+// }
+// }
+//}
+//struct QRCodeDetailView_Previews: PreviewProvider {
+//
+// static var previews: some View {
+// ContentView()
+// }
+//}
#endif
diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift
@@ -463,7 +463,7 @@ struct TransactionSummaryV: View {
// TODO: isSendCoins should show QR only while not yet expired - either set timer or wallet-core should do so and send a state-changed notification
if pending {
if transaction.isPendingReady {
- QRCodeDetails(transaction: transaction)
+ QRCodeDetails(transaction: transaction, specs: currencyInfo.specs)
if hasDone {
Text("QR code and link can also be scanned or copied / shared from Transactions later.")
.multilineTextAlignment(.leading)
@@ -527,6 +527,7 @@ struct TransactionSummaryV: View {
struct QRCodeDetails: View {
var transaction : Transaction
+ var specs: CurrencySpecification
var body: some View {
let details = transaction.detailsToShow()
let keys = details.keys
@@ -536,7 +537,8 @@ struct TransactionSummaryV: View {
QRCodeDetailView(talerURI: talerURI,
talerCopyShare: talerURI,
incoming: transaction.isP2pIncoming,
- amount: transaction.common.amountRaw)
+ amount: transaction.common.amountRaw,
+ specs: specs)
}
}
} else if keys.contains(EXCHANGEBASEURL) {