gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 79/204: -Binding


From: gnunet
Subject: [taler-taler-ios] 79/204: -Binding
Date: Thu, 05 Dec 2024 23:50:47 +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 fe00a3cf63abeb0cc7429327e3257b992f9bf597
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Oct 19 16:46:07 2024 +0200

    -Binding
---
 TalerWallet1/Helper/CurrencySpecification.swift         |  2 +-
 TalerWallet1/Views/Actions/Banking/DepositAmountV.swift |  2 +-
 TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift |  2 +-
 TalerWallet1/Views/HelperViews/AmountInputV.swift       |  2 +-
 TalerWallet1/Views/HelperViews/CurrencyField.swift      | 10 +++++-----
 TalerWallet1/Views/HelperViews/CurrencyInputView.swift  | 12 ++++++------
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/TalerWallet1/Helper/CurrencySpecification.swift 
b/TalerWallet1/Helper/CurrencySpecification.swift
index 6001b41..b55da33 100644
--- a/TalerWallet1/Helper/CurrencySpecification.swift
+++ b/TalerWallet1/Helper/CurrencySpecification.swift
@@ -60,7 +60,7 @@ extension Amount {
 
     func formatted(_ scope: ScopeInfo, isNegative: Bool, useISO: Bool = false, 
a11y: String? = nil) -> String {
         let controller = Controller.shared
-        if let currencyInfo = controller.info2(for: self.currencyStr) {
+        if let currencyInfo = controller.info(for: scope) {
             return self.formatted(currencyInfo, isNegative: isNegative, 
useISO: useISO, a11y: a11y)
         }
         return self.readableDescription
diff --git a/TalerWallet1/Views/Actions/Banking/DepositAmountV.swift 
b/TalerWallet1/Views/Actions/Banking/DepositAmountV.swift
index 306835d..775e751 100644
--- a/TalerWallet1/Views/Actions/Banking/DepositAmountV.swift
+++ b/TalerWallet1/Views/Actions/Banking/DepositAmountV.swift
@@ -108,7 +108,7 @@ struct DepositAmountV: View {
                 Text("Available:\t\(available)")
                     .talerFont(.title3)
                     .padding(.bottom, 2)
-                CurrencyInputView(currencyInfo: $currencyInfo,
+                CurrencyInputView(currencyInfo: currencyInfo,
                                         amount: $amountToTransfer,
                                 amountLastUsed: amountLastUsed,
                                      available: nil,  // amountAvailable,
diff --git a/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift 
b/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
index fe1758f..f202381 100644
--- a/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
@@ -73,7 +73,7 @@ struct ManualWithdraw: View {
                     .multilineTextAlignment(.center)
                     .talerFont(.body)
                 if tosAccepted {
-                    CurrencyInputView(currencyInfo: $currencyInfo,
+                    CurrencyInputView(currencyInfo: currencyInfo,
                                             amount: $amountToTransfer,
                                     amountLastUsed: amountLastUsed,
                                          available: nil,
diff --git a/TalerWallet1/Views/HelperViews/AmountInputV.swift 
b/TalerWallet1/Views/HelperViews/AmountInputV.swift
index b2fdfed..9c5d2bc 100644
--- a/TalerWallet1/Views/HelperViews/AmountInputV.swift
+++ b/TalerWallet1/Views/HelperViews/AmountInputV.swift
@@ -93,7 +93,7 @@ struct AmountInputV: View {
 //                    .foregroundColor(WalletColors().secondary(colorScheme, 
colorSchemeContrast))
 //                    .padding(4)
 //            }
-            CurrencyInputView(currencyInfo: $currencyInfo,
+            CurrencyInputView(currencyInfo: currencyInfo,
                                     amount: $amountToTransfer,
                             amountLastUsed: amountLastUsed,
                                  available: amountAvailable,
diff --git a/TalerWallet1/Views/HelperViews/CurrencyField.swift 
b/TalerWallet1/Views/HelperViews/CurrencyField.swift
index cff189c..8507515 100644
--- a/TalerWallet1/Views/HelperViews/CurrencyField.swift
+++ b/TalerWallet1/Views/HelperViews/CurrencyField.swift
@@ -30,7 +30,7 @@ import SymLog
 @MainActor
 struct CurrencyField: View {
     private let symLog = SymLogV(0)
-    @Binding var currencyInfo: CurrencyInfo
+    let currencyInfo: CurrencyInfo
     @Binding var amount: Amount         // the `value´
 
     private var currencyFieldRepresentable: CurrencyTextfieldRepresentable! = 
nil
@@ -47,11 +47,11 @@ struct CurrencyField: View {
         currencyFieldRepresentable.updateText(amount: amount)
     }
 
-    public init(_ currencyInfo: Binding<CurrencyInfo>, amount: 
Binding<Amount>) {
+    public init(_ currencyInfo: CurrencyInfo, amount: Binding<Amount>) {
         self._amount = amount
-        self._currencyInfo = currencyInfo
+        self.currencyInfo = currencyInfo
         self.currencyFieldRepresentable =
-                CurrencyTextfieldRepresentable(currencyInfo: 
self.$currencyInfo,
+                CurrencyTextfieldRepresentable(currencyInfo: self.currencyInfo,
                                                      amount: self.$amount)
     }
 
@@ -97,7 +97,7 @@ class NoCaretTextField: UITextField {
 // MARK: -
 @MainActor
 struct CurrencyTextfieldRepresentable: UIViewRepresentable {
-    @Binding var currencyInfo: CurrencyInfo
+    let currencyInfo: CurrencyInfo
     @Binding var amount: Amount
 
     private let textField = NoCaretTextField(frame: .zero)
diff --git a/TalerWallet1/Views/HelperViews/CurrencyInputView.swift 
b/TalerWallet1/Views/HelperViews/CurrencyInputView.swift
index 9e535ad..9900ff7 100644
--- a/TalerWallet1/Views/HelperViews/CurrencyInputView.swift
+++ b/TalerWallet1/Views/HelperViews/CurrencyInputView.swift
@@ -12,7 +12,7 @@ fileprivate let replaceable = 500
 fileprivate let shortcutValues = [5000,2500,1000]        // TODO: adapt for ¥
 
 struct ShortcutButton: View {
-    @Binding var currencyInfo: CurrencyInfo
+    let currencyInfo: CurrencyInfo
     let currency: String
     let currencyField: CurrencyField
     let shortcut: Int
@@ -20,7 +20,7 @@ struct ShortcutButton: View {
     let action: (Int, CurrencyField) -> Void
 
     func makeButton(with newShortcut: Int) -> ShortcutButton {
-        ShortcutButton(currencyInfo: $currencyInfo,
+        ShortcutButton(currencyInfo: currencyInfo,
                            currency: currency,
                       currencyField: currencyField,
                            shortcut: newShortcut,
@@ -61,7 +61,7 @@ struct ShortcutButton: View {
 }
 // MARK: -
 struct CurrencyInputView: View {
-    @Binding var currencyInfo: CurrencyInfo
+    let currencyInfo: CurrencyInfo
     @Binding var amount: Amount         // the `value´
     let amountLastUsed: Amount
     let available: Amount?
@@ -97,7 +97,7 @@ struct CurrencyInputView: View {
                 if !shortcutValues.contains(lastUsedI) {
                     shortcut = lastUsedI
         }   }   }
-        return ShortcutButton(currencyInfo: $currencyInfo,
+        return ShortcutButton(currencyInfo: currencyInfo,
                                   currency: amount.currencyStr,
                              currencyField: currencyField,
                                   shortcut: shortcut,
@@ -135,7 +135,7 @@ struct CurrencyInputView: View {
 //        let _ = symLog.vlog()       // just to get the # to compare it with 
.onAppear & onDisappear
 #endif
         let currency = amount.currencyStr
-        let currencyField = CurrencyField($currencyInfo, amount: $amount)
+        let currencyField = CurrencyField(currencyInfo, amount: $amount)
         VStack (alignment: .center) {   // center shortcut buttons
             if let heading = heading() {
                 Text(heading)
@@ -226,7 +226,7 @@ fileprivate struct Previews: PreviewProvider {
         @State var amountLastUsed = Amount(currency: LONGCURRENCY, cent: 170)
         @State private var currencyInfoL: CurrencyInfo = 
CurrencyInfo.zero(LONGCURRENCY)
         var body: some View {
-            CurrencyInputView(currencyInfo: $currencyInfoL,
+            CurrencyInputView(currencyInfo: currencyInfoL,
                                     amount: $amountToPreview,
                             amountLastUsed: amountLastUsed,
                                  available: Amount(currency: LONGCURRENCY, 
cent: 2000),

-- 
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]