gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 05/12: Minimalistic


From: gnunet
Subject: [taler-taler-ios] 05/12: Minimalistic
Date: Tue, 31 Oct 2023 08:53:02 +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 2eef469c2be69c1fa5c78109e472b9449f5aeb78
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sun Oct 29 15:19:43 2023 +0100

    Minimalistic
---
 TalerWallet1/Views/Balances/BalanceRowView.swift   | 18 +++++++----
 .../Views/Balances/BalancesSectionView.swift       |  7 +++--
 TalerWallet1/Views/Balances/TwoRowButtons.swift    | 35 +++++++++++++---------
 TalerWallet1/Views/Exchange/ExchangeRowView.swift  | 11 ++++---
 4 files changed, 45 insertions(+), 26 deletions(-)

diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift 
b/TalerWallet1/Views/Balances/BalanceRowView.swift
index 9c36bbd..afead75 100644
--- a/TalerWallet1/Views/Balances/BalanceRowView.swift
+++ b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -22,7 +22,8 @@ struct BalanceButton: View {
                     let needVStack = !iconOnly && Self.needVStack(titles, 
width: width,
                                                                   
sizeCategory: sizeCategory,
                                                                   padding: 20, 
sameSize: false)
-                    AmountRowV(amountStr: amountStr, largeAmountFont: true, 
fitsHorizontal: !needVStack) {
+                    AmountRowV(amountStr: amountStr, largeAmountFont: true,
+                               fitsHorizontal: !needVStack) {
                         Text(iconOnly ? "" : balanceTitle)
                             .accessibilityFont(.title2)
                             .foregroundColor(.secondary)
@@ -38,7 +39,8 @@ struct BalanceButton: View {
 
 
 /// This view shows the currency row in a currency section
-/// [Send Coins]  [Receive Coins]     Balance
+///  Balance:                          amount
+/// [Send Money]  [Request Payment]
 struct BalanceRowView: View {
     let amount: Amount
     let currencyInfo: CurrencyInfo?
@@ -46,10 +48,13 @@ struct BalanceRowView: View {
     let recvAction: () -> Void
     let rowAction: () -> Void
     @Environment(\.sizeCategory) var sizeCategory
+    @AppStorage("iconOnly") var iconOnly: Bool = false
     @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
 
+    let sendTitle0 = String(localized: "Send", comment: "Abbreviation <Send 
Money>")
     let sendTitle1 = String(localized: "Send", comment: "Top of button <Send 
Money>")
     let sendTitle2 = String(localized: "Money", comment: "Bottom of button 
<Send Money>")
+    let requestTitle0 = String(localized: "Request", comment: "Abbreviation 
<Request Payment>")
     let requestTitle1 = String(localized: "Request", comment: "Top of button 
<Request Payment>")
     let requestTitle2 = String(localized: "Payment", comment: "Bottom of 
button <Request Payment>")
 
@@ -62,11 +67,12 @@ struct BalanceRowView: View {
                               sizeCategory: sizeCategory,
                               rowAction: rowAction)
                 let uiFont = TalerFont.uiFont(.title3)
-                let titles = [(requestTitle1, uiFont), (requestTitle2, 
uiFont), (sendTitle1, uiFont), (sendTitle2, uiFont)]
+                let titles = iconOnly ? [(sendTitle0, uiFont), (requestTitle0, 
uiFont)]
+                           : [(sendTitle1, uiFont), (sendTitle2, uiFont), 
(requestTitle1, uiFont), (requestTitle2, uiFont)]
                 let needVStack = Self.needVStack(titles, width: width, 
sizeCategory: sizeCategory, padding: 10)
-                let twoRowButtons = TwoRowButtons(sendTitles: (sendTitle1, 
sendTitle2),
-                                                  recvTitles: (requestTitle1, 
requestTitle2),
-                                                  horizontal: needVStack,
+                let twoRowButtons = TwoRowButtons(sendTitles: iconOnly ? 
(sendTitle0, nil) : (sendTitle1, sendTitle2),
+                                                  recvTitles: iconOnly ? 
(requestTitle0, nil) : (requestTitle1, requestTitle2),
+                                                isHorizontal: needVStack,
                                                    lineLimit: 5, sendDisabled: 
amount.isZero,
                                                   sendAction: sendAction,
                                                   recvAction: recvAction)
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift 
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index 91872a8..ea56359 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -22,6 +22,7 @@ struct BalancesSectionView {
     @Binding var centsToTransfer: UInt64
     @Binding var summary: String
 
+    @AppStorage("iconOnly") var iconOnly: Bool = false
     @EnvironmentObject private var model: WalletModel
     @EnvironmentObject private var controller: Controller
 
@@ -150,8 +151,10 @@ extension BalancesSectionView: View {
                                transactions: threeTransactions,
                             reloadOneAction: reloadOneAction)
             } header: {
-                Text("Recent transactions")
-                    .accessibilityFont(.callout)
+                if !iconOnly {
+                    Text("Recent transactions")
+                        .accessibilityFont(.callout)
+                }
             }
         }
     } // body
diff --git a/TalerWallet1/Views/Balances/TwoRowButtons.swift 
b/TalerWallet1/Views/Balances/TwoRowButtons.swift
index 3627734..08b62bc 100644
--- a/TalerWallet1/Views/Balances/TwoRowButtons.swift
+++ b/TalerWallet1/Views/Balances/TwoRowButtons.swift
@@ -6,27 +6,34 @@ import SwiftUI
 import taler_swift
 
 struct TwoRowButtons: View {
-    let sendTitles: (String, String)
-    let recvTitles: (String, String)
-    let horizontal:Bool
+    let sendTitles: (String, String?)
+    let recvTitles: (String, String?)
+    let isHorizontal: Bool
     let lineLimit: Int
     let sendDisabled: Bool
     let sendAction: () -> Void
     let recvAction: () -> Void
     @Environment(\.sizeCategory) var sizeCategory
+    
+    func title(_ titles: (String, String?), _ horizontal: Bool) -> String {
+        let delimiter = horizontal ? " " : "\n"
+        let (title1, title2) = titles
+        if let title2 {
+            return title1 + delimiter + title2
+        } else {
+            return title1
+        }
+    }
 
     var body: some View {
-        let delimiter = horizontal ? " " : "\n"
-        let (sendTitle1, sendTitle2) = sendTitles
-        let (recvTitle1, recvTitle2) = recvTitles
         Group {
-            Button(sendTitle1 + delimiter + sendTitle2, action: sendAction)
+            Button(title(sendTitles, isHorizontal), action: sendAction)
                 .lineLimit(lineLimit)
                 .disabled(sendDisabled)
                 .buttonStyle(TalerButtonStyle(type: .bordered,
                                             dimmed: false,
                                            aligned: .center))
-            Button(recvTitle1 + delimiter + recvTitle2, action: recvAction)
+            Button(title(recvTitles, isHorizontal), action: recvAction)
                 .lineLimit(lineLimit)
                 .disabled(false)
                 .buttonStyle(TalerButtonStyle(type: .bordered,
@@ -41,15 +48,15 @@ struct TwoRowButtons_Previews: PreviewProvider {
         List {
                 TwoRowButtons(sendTitles: ("Send", TESTCURRENCY),
                               recvTitles: ("Receive", LONGCURRENCY),
-                             horizontal: true,
-                              lineLimit: 2, sendDisabled: true,
-                             sendAction: {}, recvAction: {})
+                            isHorizontal: true,
+                               lineLimit: 2, sendDisabled: true,
+                              sendAction: {}, recvAction: {})
                 .listRowSeparator(.hidden)
                 TwoRowButtons(sendTitles: ("Send", DEMOCURRENCY),
                               recvTitles: ("Receive", DEMOCURRENCY),
-                             horizontal: true,
-                              lineLimit: 2, sendDisabled: true,
-                             sendAction: {}, recvAction: {})
+                            isHorizontal: true,
+                               lineLimit: 2, sendDisabled: true,
+                              sendAction: {}, recvAction: {})
                 .listRowSeparator(.hidden)
         }
     }
diff --git a/TalerWallet1/Views/Exchange/ExchangeRowView.swift 
b/TalerWallet1/Views/Exchange/ExchangeRowView.swift
index c0cc2f4..2848e58 100644
--- a/TalerWallet1/Views/Exchange/ExchangeRowView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeRowView.swift
@@ -11,6 +11,7 @@ struct ExchangeRowView: View {
 //    let amount: Amount
     let currency: String
     @Binding var centsToTransfer: UInt64
+    @AppStorage("iconOnly") var iconOnly: Bool = false
 
     @Environment(\.sizeCategory) var sizeCategory
     @State private var buttonSelected: Int? = nil
@@ -52,11 +53,13 @@ struct ExchangeRowView: View {
         SingleAxisGeometryReader { width in
             Group {
                 let uiFont = TalerFont.uiFont(.title3)
-                let titles = [(depositTitle, uiFont), (withdrawTitle, uiFont), 
(currency, uiFont)]
+                let titles = iconOnly ? [(depositTitle, uiFont), 
(withdrawTitle, uiFont)]
+                                      : [(depositTitle, uiFont), 
(withdrawTitle, uiFont), (currency, uiFont)]
                 let needVStack = Self.needVStack(titles, width: width, 
sizeCategory: sizeCategory, padding: 10)
-                let twoRowButtons = TwoRowButtons(sendTitles: (depositTitle, 
currency),     // TODO:  amount.currencyStr
-                                                  recvTitles: (withdrawTitle, 
currency),    // TODO:  amount.currencyStr
-                                                  horizontal: needVStack,
+                                                                               
     // TODO:  amount.currencyStr
+                let twoRowButtons = TwoRowButtons(sendTitles: iconOnly ? 
(depositTitle, nil)  : (depositTitle, currency),
+                                                  recvTitles: iconOnly ? 
(withdrawTitle, nil) : (withdrawTitle, currency),
+                                                isHorizontal: needVStack,
                                                    lineLimit: 5, sendDisabled: 
true,         // TODO: amount.isZero
                                                   sendAction: { 
selectAndUpdate(1) },
                                                   recvAction: { 
selectAndUpdate(2) })

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