gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 04/07: Abbreviations


From: gnunet
Subject: [taler-taler-ios] 04/07: Abbreviations
Date: Thu, 26 Oct 2023 13:21:30 +0200

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 4e340f58b33d0c65d705998e5d8e8851422f3c00
Author: Marc Stibane <marc@taler.net>
AuthorDate: Thu Oct 26 07:39:24 2023 +0200

    Abbreviations
---
 .../Views/Sheets/P2P_Sheets/P2pPayURIView.swift    | 12 ++++----
 .../Sheets/P2P_Sheets/P2pReceiveURIView.swift      |  4 ++-
 .../Views/Sheets/Payment/PayTemplateView.swift     | 25 ++++++++++-------
 .../Views/Sheets/Payment/PaymentView.swift         | 25 ++++++++++-------
 .../WithdrawBankIntegrated/WithdrawURIView.swift   |  4 ++-
 TalerWallet1/Views/Transactions/ThreeAmounts.swift | 32 +++++++++++++++++-----
 .../Views/Transactions/TransactionDetailView.swift | 29 +++++++++++++-------
 7 files changed, 87 insertions(+), 44 deletions(-)

diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift 
b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
index 30251d8..905670d 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
@@ -30,11 +30,13 @@ struct P2pPayURIView: View {
                     let currency = raw.currencyStr
                     let fee = try! Amount.diff(raw, effective)
                     ThreeAmountsView(topTitle: String(localized: "Amount to 
pay:"),
-                                     topAmount: raw, fee: fee,
-                                     bottomTitle: String(localized: 
"\(currency) to be spent:"),
-                                     bottomAmount: effective,
-                                     large: false, pending: false, incoming: 
false,
-                                     baseURL: nil)
+                                    topAbbrev: String(localized: "Pay:"),
+                                    topAmount: raw, fee: fee,
+                                  bottomTitle: String(localized: "Amount to be 
spent:"),
+                                 bottomAbbrev: String(localized: "Effective:"),
+                                 bottomAmount: effective,
+                                        large: false, pending: false, 
incoming: false,
+                                      baseURL: nil)
                 }
                 .listStyle(myListStyle.style).anyView
                 .navigationTitle(navTitle)
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift 
b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
index 26fc4a3..d8521e5 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
@@ -30,8 +30,10 @@ struct P2pReceiveURIView: View {
                     let currency = raw.currencyStr
                     let fee = try! Amount.diff(raw, effective)
                     ThreeAmountsView(topTitle: String(localized: "Amount to 
receive:"),
+                                    topAbbrev: String(localized: "Receive:"),
                                     topAmount: raw, fee: fee,
-                                  bottomTitle: String(localized: "\(currency) 
to be obtained:"),
+                                  bottomTitle: String(localized: "Amount to be 
obtained:"),
+                                 bottomAbbrev: String(localized: "Effective:"),
                                  bottomAmount: effective,
                                         large: false, pending: false, 
incoming: true,
                                       baseURL: nil)
diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift 
b/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift
index ea6c73a..e626cc2 100644
--- a/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift
@@ -56,25 +56,30 @@ struct PayTemplateView: View {
                 let raw = preparePayResult.amountRaw
                 let currency = raw.currencyStr
                 let topTitle = String(localized: "Amount to pay:")
+                let topAbbrev = String(localized: "Pay:")
                 if let effective {
                     // TODO: already paid
                     let fee = try! Amount.diff(raw, effective)      // TODO: 
different currencies
                     ThreeAmountsView(topTitle: topTitle,
-                                     topAmount: raw, fee: fee,
-                                     bottomTitle: String(localized: 
"\(currency) to be spent:"),
-                                     bottomAmount: effective,
-                                     large: false, pending: false, incoming: 
false,
-                                     baseURL: baseURL)
+                                    topAbbrev: topAbbrev,
+                                    topAmount: raw, fee: fee,
+                                  bottomTitle: String(localized: "Amount to be 
spent:"),
+                                 bottomAbbrev: String(localized: "Effective:"),
+                                 bottomAmount: effective,
+                                        large: false, pending: false, 
incoming: false,
+                                      baseURL: baseURL)
                     // TODO: payment: popup with all possible exchanges, check 
fees
                 } else if let balanceDetails = preparePayResult.balanceDetails 
{    // Insufficient
                     Text("You don't have enough \(currency)")
                         .accessibilityFont(.body)
                     ThreeAmountsView(topTitle: topTitle,
-                                     topAmount: raw, fee: nil,
-                                     bottomTitle: String(localized: 
"\(currency) available:"),
-                                     bottomAmount: 
balanceDetails.balanceAvailable,
-                                     large: false, pending: false, incoming: 
false,
-                                     baseURL: baseURL)
+                                    topAbbrev: topAbbrev,
+                                    topAmount: raw, fee: nil,
+                                  bottomTitle: String(localized: "Amount 
available:"),
+                                 bottomAbbrev: String(localized: "Available:"),
+                                 bottomAmount: balanceDetails.balanceAvailable,
+                                        large: false, pending: false, 
incoming: false,
+                                      baseURL: baseURL)
                 } else {
                     // TODO: Error - neither effective nor balanceDetails
                     Text("Error")
diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift 
b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
index 6bc9a08..7a14aeb 100644
--- a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
@@ -49,25 +49,30 @@ struct PaymentView: View {
                 let raw = preparePayResult.amountRaw
                 let currency = raw.currencyStr
                 let topTitle = String(localized: "Amount to pay:")
+                let topAbbrev = String(localized: "Pay:")
                 if let effective {
                     // TODO: already paid
                     let fee = try! Amount.diff(raw, effective)      // TODO: 
different currencies
                     ThreeAmountsView(topTitle: topTitle,
-                                     topAmount: raw, fee: fee,
-                                     bottomTitle: String(localized: 
"\(currency) to be spent:"),
-                                     bottomAmount: effective,
-                                     large: false, pending: false, incoming: 
false,
-                                     baseURL: baseURL)
+                                    topAbbrev: topAbbrev,
+                                    topAmount: raw, fee: fee,
+                                  bottomTitle: String(localized: "Amount to be 
spent:"),
+                                 bottomAbbrev: String(localized: "Effective:"),
+                                 bottomAmount: effective,
+                                        large: false, pending: false, 
incoming: false,
+                                      baseURL: baseURL)
                     // TODO: payment: popup with all possible exchanges, check 
fees
                 } else if let balanceDetails = preparePayResult.balanceDetails 
{    // Insufficient
                     Text("You don't have enough \(currency)")
                         .accessibilityFont(.body)
                     ThreeAmountsView(topTitle: topTitle,
-                                     topAmount: raw, fee: nil,
-                                     bottomTitle: String(localized: 
"\(currency) available:"),
-                                     bottomAmount: 
balanceDetails.balanceAvailable,
-                                     large: false, pending: false, incoming: 
false,
-                                     baseURL: baseURL)
+                                    topAbbrev: topAbbrev,
+                                    topAmount: raw, fee: nil,
+                                  bottomTitle: String(localized: "Available:"),
+                                 bottomAbbrev: String(localized: "Available:"),
+                                 bottomAmount: balanceDetails.balanceAvailable,
+                                        large: false, pending: false, 
incoming: false,
+                                      baseURL: baseURL)
                 } else {
                     // TODO: Error - neither effective nor balanceDetails
                     Text("Error")
diff --git 
a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift 
b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
index 0dc3a9e..89eda47 100644
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -37,8 +37,10 @@ struct WithdrawURIView: View {
                     let inColor = WalletColors().transactionColor(true)
 
                     ThreeAmountsView(topTitle: String(localized: "Chosen 
amount to withdraw:"),
+                                    topAbbrev: String(localized: "Chosen:"),
                                     topAmount: raw, fee: fee,
-                                  bottomTitle: String(localized: "\(currency) 
to be withdrawn:"),
+                                  bottomTitle: String(localized: "Amount to be 
withdrawn:"),
+                                 bottomAbbrev: String(localized: "Effective:"),
                                  bottomAmount: effective,
                                         large: false, pending: false, 
incoming: true,
                                       baseURL: exchangeBaseUrl)
diff --git a/TalerWallet1/Views/Transactions/ThreeAmounts.swift 
b/TalerWallet1/Views/Transactions/ThreeAmounts.swift
index 83d8d73..ef77848 100644
--- a/TalerWallet1/Views/Transactions/ThreeAmounts.swift
+++ b/TalerWallet1/Views/Transactions/ThreeAmounts.swift
@@ -7,8 +7,10 @@ import taler_swift
 
 struct ThreeAmountsSheet: View {
     var common: TransactionCommon
+    var topAbbrev: String
     var topTitle: String
     var bottomTitle: String?
+    var bottomAbbrev: String?
     let baseURL: String?
     let large: Bool               // set to false for QR or IBAN
 
@@ -22,8 +24,13 @@ struct ThreeAmountsSheet: View {
         let defaultBottomTitle = incoming ? (pending ? String(localized: 
"Pending amount to obtain:")
                                                      : String(localized: 
"Obtained amount:") )
                                           :            String(localized: "Paid 
amount:")
-        ThreeAmountsView(topTitle: topTitle, topAmount: raw, fee: fee,
-                      bottomTitle: bottomTitle ?? defaultBottomTitle, 
bottomAmount: effective,
+        let defaultBottomAbbre = incoming ? (pending ? String(localized: 
"Pending:")
+                                                     : String(localized: 
"Obtained:") )
+                                          :            String(localized: 
"Paid:")
+        ThreeAmountsView(topTitle: topTitle, topAbbrev: topAbbrev, topAmount: 
raw, fee: fee,
+                      bottomTitle: bottomTitle ?? defaultBottomTitle,
+                     bottomAbbrev: bottomAbbrev ?? defaultBottomAbbre,
+                     bottomAmount: effective,
                             large: large, pending: pending, incoming: incoming,
                           baseURL: baseURL,
                            status: common.txState.major.localizedState)
@@ -32,9 +39,11 @@ struct ThreeAmountsSheet: View {
 // MARK: -
 struct ThreeAmountsView: View {
     var topTitle: String
+    var topAbbrev: String
     var topAmount: Amount
     var fee: Amount?
     var bottomTitle: String
+    var bottomAbbrev: String
     var bottomAmount: Amount
     let large: Bool
     let pending: Bool
@@ -42,30 +51,33 @@ struct ThreeAmountsView: View {
     let baseURL: String?
     var status: String?
 
+    @AppStorage("iconOnly") var iconOnly: Bool = false
+    
     var body: some View {
         let labelColor = Color(UIColor.label)
         let foreColor = pending ? WalletColors().pendingColor(incoming)
                                 : WalletColors().transactionColor(incoming)
         Section {
-            AmountView(title: topTitle,
+            AmountView(title: iconOnly ? topAbbrev : topTitle,
                        value: topAmount.readableDescription,
                        color: labelColor,
                        large: large)
                 .padding(.bottom, 4)
             if let fee {
-                AmountView(title: String(localized: "Exchange fee:"),
+                AmountView(title: iconOnly ? String(localized: "Fee:")
+                                           : String(localized: "Exchange 
fee:"),
                            value: fee.readableDescription,
                            color: labelColor,
                            large: false)
                 .padding(.bottom, 4)
             }
-            AmountView(title: bottomTitle,
+            AmountView(title: iconOnly ? bottomAbbrev : bottomTitle,
                        value: bottomAmount.readableDescription,
                        color: foreColor,
                        large: large)
             if let baseURL {
                 VStack(alignment: .leading) {
-                    Text("Using Exchange:")
+                    Text(iconOnly ? "Exchange:" : "Using Exchange:")
                         .multilineTextAlignment(.leading)
                         .accessibilityFont(.body)
                     HStack {
@@ -81,6 +93,11 @@ struct ThreeAmountsView: View {
                 .frame(maxWidth: .infinity, alignment: .leading)
                 .listRowSeparator(.hidden)
             }
+        } header: {
+            if !iconOnly {
+                Text("Summary")
+                    .accessibilityFont(.title3)
+            }
         }
     }
 }
@@ -96,7 +113,8 @@ struct ThreeAmounts_Previews: PreviewProvider {
                                   txActions: [])
         Group {
             List {
-                ThreeAmountsSheet(common: common, topTitle: "Withdrawal", 
baseURL: DEMOEXCHANGE, large: 1==0)
+                ThreeAmountsSheet(common: common, topAbbrev: "Withdrawal",
+                                topTitle: "Withdrawal", baseURL: DEMOEXCHANGE, 
large: 1==0)
                     .safeAreaInset(edge: .bottom) {
                         Button(String(localized: "Accept"), action: {})
                             .buttonStyle(TalerButtonStyle(type: .prominent))
diff --git a/TalerWallet1/Views/Transactions/TransactionDetailView.swift 
b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
index 899bd43..2da1d91 100644
--- a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
@@ -188,6 +188,7 @@ struct TransactionDetailView: View {
     struct SwitchCase: View {
         @Binding var transaction: Transaction
         let hasDone: Bool
+        @AppStorage("iconOnly") var iconOnly: Bool = false
 
         var body: some View {
             let common = transaction.common
@@ -211,10 +212,12 @@ struct TransactionDetailView: View {
                                         if let confirmationUrl = 
withdrawalDetails.bankConfirmationUrl {
                                             if let destination = URL(string: 
confirmationUrl) {
                                                 VStack(alignment: .leading) {  
// Show Hint that User should Confirm on bank website
-                                                    Text("Waiting for bank 
confirmation")
-                                                        .fixedSize(horizontal: 
false, vertical: true)       // wrap in scrollview
-                                                        
.multilineTextAlignment(.leading)                   // otherwise
-                                                        
.listRowSeparator(.hidden)
+                                                    if !iconOnly {
+                                                        Text("Waiting for bank 
confirmation")
+                                                            
.fixedSize(horizontal: false, vertical: true)       // wrap in scrollview
+                                                            
.multilineTextAlignment(.leading)                   // otherwise
+                                                            
.listRowSeparator(.hidden)
+                                                    }
                                                     Link("Confirm with bank", 
destination: destination)
                                                         
.buttonStyle(TalerButtonStyle(type: .prominent, narrow: false, aligned: 
.center))
                                                         .padding(.horizontal)  
                                                  
@@ -224,7 +227,8 @@ struct TransactionDetailView: View {
                                     }
                             }
                         } // ManualDetails or Confirm with bank
-                        ThreeAmountsSheet(common: common, topTitle: 
String(localized: "Chosen amount to withdraw:"),
+                        ThreeAmountsSheet(common: common, topAbbrev: 
String(localized: "Chosen:"),
+                                        topTitle: String(localized: "Chosen 
amount to withdraw:"),
                                          baseURL: details.exchangeBaseUrl, 
large: false)
                     case .payment(let paymentTransaction):
                         let details = paymentTransaction.details
@@ -232,19 +236,23 @@ struct TransactionDetailView: View {
                             .accessibilityFont(.title2)
                             .lineLimit(4)
                             .padding(.bottom)
-                        ThreeAmountsSheet(common: common, topTitle: 
String(localized: "Sum to be paid:"),
+                        ThreeAmountsSheet(common: common, topAbbrev: 
String(localized: "Pay:"),
+                                        topTitle: String(localized: "Sum to be 
paid:"),
                                          baseURL: nil, large: true)     // 
TODO: baseURL
                     case .refund(let refundTransaction):
                         let details = refundTransaction.details                
 // TODO: more details
-                        ThreeAmountsSheet(common: common, topTitle: 
String(localized: "Refunded amount:"),
+                        ThreeAmountsSheet(common: common, topAbbrev: 
String(localized: "Refunded:"),
+                                        topTitle: String(localized: "Refunded 
amount:"),
                                          baseURL: nil, large: true)     // 
TODO: baseURL
                     case .reward(let rewardTransaction):
                         let details = rewardTransaction.details                
 // TODO: more details
-                        ThreeAmountsSheet(common: common, topTitle: 
String(localized: "Received Reward:"),
+                        ThreeAmountsSheet(common: common, topAbbrev: 
String(localized: "Reward:"),
+                                        topTitle: String(localized: "Received 
Reward:"),
                                          baseURL: details.exchangeBaseUrl, 
large: true)
                     case .refresh(let refreshTransaction):
                         let details = refreshTransaction.details               
 // TODO: details
-                        ThreeAmountsSheet(common: common, topTitle: 
String(localized: "Refreshed amount:"),
+                        ThreeAmountsSheet(common: common, topAbbrev: 
String(localized: "Refreshed:"),
+                                        topTitle: String(localized: "Refreshed 
amount:"),
                                          baseURL: nil, large: true)     // 
TODO: baseURL
                     case .peer2peer(let p2pTransaction):
                         let details = p2pTransaction.details                   
 // TODO: details
@@ -262,7 +270,8 @@ struct TransactionDetailView: View {
                                     .padding(.top)
                             }
                         }
-                        ThreeAmountsSheet(common: common, topTitle: 
transaction.localizedType,
+                        ThreeAmountsSheet(common: common, topAbbrev: 
transaction.localizedType,
+                                        topTitle: transaction.localizedType,
                                          baseURL: details.exchangeBaseUrl, 
large: false)
                 } // switch
             } // Group

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