gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 24/32: Balance button


From: gnunet
Subject: [taler-taler-ios] 24/32: Balance button
Date: Mon, 16 Oct 2023 00:03:22 +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 a622afd518f9adf02a9f856bb70bf406c3512184
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Oct 14 09:13:54 2023 +0200

    Balance button
---
 TalerWallet1/Helper/WalletColors.swift           | 12 ++++++++----
 TalerWallet1/Views/Balances/BalanceRowView.swift |  8 +++++---
 TalerWallet1/Views/HelperViews/Buttons.swift     | 21 +++++++++++++--------
 TalerWallet1/Views/Settings/SettingsView.swift   |  2 +-
 4 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/TalerWallet1/Helper/WalletColors.swift 
b/TalerWallet1/Helper/WalletColors.swift
index 1f037cf..815da41 100644
--- a/TalerWallet1/Helper/WalletColors.swift
+++ b/TalerWallet1/Helper/WalletColors.swift
@@ -14,14 +14,18 @@ public struct WalletColors {
     let gray5 = Color(.systemGray5)
     let gray6 = Color(.systemGray6)
 
-    func buttonForeColor(pressed: Bool, disabled: Bool, prominent: Bool = 
false) -> Color {
-            disabled ? gray2
+    func buttonForeColor(pressed: Bool, disabled: Bool,
+                       prominent: Bool = false, balance: Bool = false) -> 
Color {
+             balance ? Color.primary
+          : disabled ? gray2
         : !prominent ? tint
            : pressed ? gray6 : gray5
     }
 
-    func buttonBackColor(pressed: Bool, disabled: Bool, prominent: Bool = 
false) -> Color {
-            disabled ? gray5
+    func buttonBackColor(pressed: Bool, disabled: Bool,
+                       prominent: Bool = false, balance: Bool = false) -> 
Color {
+             balance ? (pressed ? gray5 : gray6)
+          : disabled ? gray5
          : prominent ? tint
            : pressed ? gray5 : gray4
     }
diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift 
b/TalerWallet1/Views/Balances/BalanceRowView.swift
index c3168d9..be6de61 100644
--- a/TalerWallet1/Views/Balances/BalanceRowView.swift
+++ b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -11,12 +11,14 @@ import taler_swift
 struct BalanceButton: View {
     let amount: Amount
     let rowAction: () -> Void
+    @AppStorage("iconOnly") var iconOnly: Bool = false
 
     var body: some View {
         Button(action: rowAction) {
-            HStack() {
+            HStack(alignment: .lastTextBaseline) {
                 Text("Balance:", comment: "Balance in main view")
-                    .accessibilityFont(.title)
+                    .accessibilityFont(.title2)
+                    .foregroundColor(iconOnly ? .clear : .secondary)        // 
hide if iconOnly
                 Spacer()
                 Text(verbatim: "\(amount.valueStr)")  // TODO: 
CurrencyFormatter?
                     .accessibilityFont(.title)
@@ -26,7 +28,7 @@ struct BalanceButton: View {
         }   .disabled(false)
             .accessibilityElement(children: 
/*@START_MENU_TOKEN@*/.ignore/*@END_MENU_TOKEN@*/)
             .accessibilityLabel("Balance \(amount.readableDescription)")    // 
TODO: CurrencyFormatter!
-            .buttonStyle(TalerButtonStyle(type: .plain, aligned: .trailing))
+            .buttonStyle(TalerButtonStyle(type: iconOnly ? .plain : .balance, 
aligned: .trailing))
 //                .background(Color.yellow)
     }
 }
diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift 
b/TalerWallet1/Views/HelperViews/Buttons.swift
index 650ad36..fb7f57b 100644
--- a/TalerWallet1/Views/HelperViews/Buttons.swift
+++ b/TalerWallet1/Views/HelperViews/Buttons.swift
@@ -23,6 +23,7 @@ struct HamburgerButton : View  {
     var body: some View {
         Button(action: action) {
             Image(systemName: "line.3.horizontal")
+//            Image(systemName: "sidebar.squares.leading")
         }
         .accessibilityFont(.title)
         .accessibilityLabel("Main Menu")
@@ -97,6 +98,7 @@ struct TalerButtonStyle: ButtonStyle {
 
     enum TalerButtonStyleType {
         case plain
+        case balance
         case bordered
         case prominent
     }
@@ -106,7 +108,7 @@ struct TalerButtonStyle: ButtonStyle {
     var aligned: TextAlignment = .center
 
     public func makeBody(configuration: ButtonStyle.Configuration) -> some 
View {
-            MyBigButton(type: type,
+            MyBigButton(//type: type,
                    foreColor: foreColor(type: type, pressed: 
configuration.isPressed),
                    backColor: backColor(type: type, pressed: 
configuration.isPressed),
                       dimmed: dimmed,
@@ -124,10 +126,11 @@ struct TalerButtonStyle: ButtonStyle {
 //                                          disabled: disabled(),
 //                                         prominent: type == .prominent)
 //        }
-        return type == .plain ? WalletColors().fieldForeground :
+        return type == .plain ? WalletColors().fieldForeground :      // 
primary text color
             WalletColors().buttonForeColor(pressed: pressed,
-                                           disabled: disabled(),
-                                           prominent: type == .prominent)
+                                          disabled: disabled(),
+                                         prominent: type == .prominent,
+                                           balance: type == .balance)
     }
     func backColor(type: TalerButtonStyleType, pressed: Bool) -> Color {
 //        return if type == .plain {
@@ -137,11 +140,13 @@ struct TalerButtonStyle: ButtonStyle {
 //                                           disabled: disabled(),
 //                                           prominent: type == .prominent)
 //        }
-        return type == .plain ? Color.clear :
+        return type == .plain && !pressed ? Color.clear :
             WalletColors().buttonBackColor(pressed: pressed,
-                                           disabled: disabled(),
-                                           prominent: type == .prominent)
+                                          disabled: disabled(),
+                                         prominent: type == .prominent,
+                                           balance: type == .balance)
     }
+
     struct BackgroundView: View {
         let color: Color
         let dimmed: Bool
@@ -156,7 +161,7 @@ struct TalerButtonStyle: ButtonStyle {
     }
 
     struct MyBigButton: View {
-        var type: TalerButtonStyleType
+//        var type: TalerButtonStyleType
         let foreColor: Color
         let backColor: Color
         let dimmed: Bool
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift 
b/TalerWallet1/Views/Settings/SettingsView.swift
index 79512b4..3bf5b69 100644
--- a/TalerWallet1/Views/Settings/SettingsView.swift
+++ b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -101,7 +101,7 @@ struct SettingsView: View {
                                 description: String(localized: "When a 
transaction finished"))
                 SettingsFont(title: String(localized: "Font:"), value: 
talerFont, action: redraw)
                 SettingsStyle(title: String(localized: "Liststyle:"), 
myListStyle: $myListStyle)
-                SettingsToggle(name: String(localized: "Icon Only"), value: 
$iconOnly,
+                SettingsToggle(name: String(localized: "Minimalistic"), value: 
$iconOnly,
                                description: String(localized: "Omit text where 
possible"))
                 if diagnosticModeEnabled {
                     SettingsToggle(name: String(localized: "Developer Mode"), 
value: $developerMode,

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