gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 05/54: cleanup, back to Swift 5.8 (for now until Xcode


From: gnunet
Subject: [taler-taler-ios] 05/54: cleanup, back to Swift 5.8 (for now until Xcode 15 is usable)
Date: Fri, 30 Jun 2023 22:33:37 +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 24f4aceb707668285d76c6231542e2beda894867
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Jun 17 14:43:38 2023 +0200

    cleanup, back to Swift 5.8 (for now until Xcode 15 is usable)
---
 TalerWallet1/Controllers/PublicConstants.swift   | 14 ++++---
 TalerWallet1/Views/Balances/BalanceRowView.swift |  2 +-
 TalerWallet1/Views/HelperViews/Buttons.swift     | 32 +++++++++------
 TalerWallet1/Views/HelperViews/ListStyle.swift   | 52 ++++++++----------------
 TalerWallet1/Views/HelperViews/LoadingView.swift |  2 +-
 5 files changed, 48 insertions(+), 54 deletions(-)

diff --git a/TalerWallet1/Controllers/PublicConstants.swift 
b/TalerWallet1/Controllers/PublicConstants.swift
index 386f6f6..11f6d50 100644
--- a/TalerWallet1/Controllers/PublicConstants.swift
+++ b/TalerWallet1/Controllers/PublicConstants.swift
@@ -4,12 +4,14 @@
  */
 import Foundation
 
-public let DEMOBANK = "https://bAnK.dEmO.tAlEr.nEt";             // should be 
weird to read, but still work
-public let DEMOSHOP = "https://shop.demo.taler.net";
-//public let DEMOEXCHANGE = "https://eXcHaNgE.dEmO.tAlEr.nEt";
-public let DEMOEXCHANGE = "https://exchange.demo.taler.net";
-public let DEMO_AGE_EXCHANGE = "https://exchange-age.taler.ar";
-public let DEMO_EXP_EXCHANGE = "https://exchange-expensive.taler.ar";
+public let HTTPS = "https://";
+public let DEMOBANK = HTTPS + "bAnK.dEmO.tAlEr.nEt"             // should be 
weird to read, but still work
+public let DEMOSHOP = HTTPS + "shop.demo.taler.net"
+public let DEMOBACKEND = HTTPS + "backend.demo.taler.net"
+//public let DEMOEXCHANGE = HTTPS + "eXcHaNgE.dEmO.tAlEr.nEt"
+public let DEMOEXCHANGE = HTTPS + "exchange.demo.taler.net"
+public let DEMO_AGE_EXCHANGE = HTTPS + "exchange-age.taler.ar"
+public let DEMO_EXP_EXCHANGE = HTTPS + "exchange-expensive.taler.ar"
 public let DEMOCURRENCY = "KUDOS"
 //public let LONGCURRENCY = "gold-pressed Latinum"                // 20 
characters, with dash and space
 public let LONGCURRENCY = "GOLDLATINUM"                         // 11 
characters, no dash, no space
diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift 
b/TalerWallet1/Views/Balances/BalanceRowView.swift
index cb847ec..b46099c 100644
--- a/TalerWallet1/Views/Balances/BalanceRowView.swift
+++ b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -28,7 +28,7 @@ struct BalanceRowView: View {
                     Text("Balance")
                         .font(.footnote)
                         .accessibility(sortPriority: 2)
-                    Text("\(amount.valueStr)")  // TODO: CurrencyFormatter
+                    Text("\(amount.valueStr)")  // TODO: CurrencyFormatter?
                         .font(.title)
                         .accessibility(sortPriority: 1)
                 }
diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift 
b/TalerWallet1/Views/HelperViews/Buttons.swift
index 7b9d074..69d1179 100644
--- a/TalerWallet1/Views/HelperViews/Buttons.swift
+++ b/TalerWallet1/Views/HelperViews/Buttons.swift
@@ -119,22 +119,30 @@ struct TalerButtonStyle: ButtonStyle {
     }
 
     func foreColor(type: TalerButtonStyleType, pressed: Bool) -> Color {
-        return if type == .plain {
-            WalletColors().fieldForeground
-        } else {
+//        return if type == .plain {
+//            WalletColors().fieldForeground
+//        } else {
+//            WalletColors().buttonForeColor(pressed: pressed,
+//                                          disabled: disabled(),
+//                                         prominent: type == .prominent)
+//        }
+        return type == .plain ? WalletColors().fieldForeground :
             WalletColors().buttonForeColor(pressed: pressed,
-                                          disabled: disabled(),
-                                         prominent: type == .prominent)
-        }
+                                           disabled: disabled(),
+                                           prominent: type == .prominent)
     }
     func backColor(type: TalerButtonStyleType, pressed: Bool) -> Color {
-        return if type == .plain {
-            Color.clear
-        } else {
+//        return if type == .plain {
+//            Color.clear
+//        } else {
+//            WalletColors().buttonBackColor(pressed: pressed,
+//                                           disabled: disabled(),
+//                                           prominent: type == .prominent)
+//        }
+        return type == .plain ? Color.clear :
             WalletColors().buttonBackColor(pressed: pressed,
                                            disabled: disabled(),
                                            prominent: type == .prominent)
-        }
     }
     struct BackgroundView: View {
         let color: Color
@@ -207,7 +215,7 @@ struct Buttons_Previews: PreviewProvider {
 }
 
 #if DEBUG
-struct ContentView: View {
+fileprivate struct ContentView: View {
     @State var isOn = false
     //The better route is to have a separate variable to control the animations
     // This prevents unpleasant side-effects.
@@ -235,7 +243,7 @@ struct ContentView: View {
         }
     }
 }
-struct ContentView_Previews: PreviewProvider {
+fileprivate struct ContentView_Previews: PreviewProvider {
     static var previews: some View {
         ContentView()
     }
diff --git a/TalerWallet1/Views/HelperViews/ListStyle.swift 
b/TalerWallet1/Views/HelperViews/ListStyle.swift
index 409e275..c3f625a 100644
--- a/TalerWallet1/Views/HelperViews/ListStyle.swift
+++ b/TalerWallet1/Views/HelperViews/ListStyle.swift
@@ -31,12 +31,12 @@ public extension View {
 // Here we make it CaseIterable for SwiftUI.ForEach
 // and the UI Display name
 public enum MyListStyle: String, CaseIterable, Hashable {
-    case automatic    = "Automatic"
-    case grouped      = "Grouped"
-    case inset        = "Inset"
-    case insetGrouped = "InsetGrouped"
-    case plain        = "Plain"
-    case sidebar      = "Sidebar"
+    case automatic
+    case grouped
+    case inset
+    case insetGrouped
+    case plain
+    case sidebar
 
     // map to SwiftUI ListStyle
     var style: any SwiftUI.ListStyle {
@@ -59,45 +59,29 @@ public enum MyListStyle: String, CaseIterable, Hashable {
 struct AnyViewDemo: View {
     @State private var selectedStyle = MyListStyle.automatic
 
-    let sections = ["Breakfast", "Lunch", "Dinner"]
-    let breakfast = ["pancakes", "bacon", "orange juice"]
+    let sections  = ["Breakfast" : ["pancakes", "bacon", "orange juice"],
+                                    "Lunch"     : ["sandwich", "chips", 
"lemonade"],
+                                    "Dinner"    : ["spaghetti", "bread", 
"water"]]
+
+
     var body: some View {
         VStack {
             Picker("List Style", selection: $selectedStyle) {
                 ForEach(MyListStyle.allCases, id: \.self) {
-                    Text($0.displayName).tag($0)
+                    Text($0.displayName.capitalized).tag($0)
                 }
             }
 
-            List(sections, id: \.self) { section in
-                Section(section) {
-                    if "Breakfast" == section {
-                        ForEach(breakfast, id: \.self) { item in
+            let keys = Array(sections.keys)
+            List(keys.indices, id: \.self) { index in
+                let key = keys[index]
+                if let section = sections[key] {
+                    Section(key) {
+                        ForEach(section, id: \.self) { item in
                             Text(item)
                         }
-                    } else {
-                        Text("row")
                     }
                 }
-//                Section("Breakfast") {
-//                    Text("pancakes")
-//                    Text("bacon")
-//                    Text("orange juice")
-//                }
-//                Section("Lunch") {
-//                    Text("sandwich")
-//                    Text("chips")
-//                    Text("lemonade")
-//                }
-//                Section("Dinner") {
-//                    Text("spaghetti")
-//                    Text("bread")
-//                    Text("water")
-//                }
-            }
-            .refreshable {
-                print("refreshing")
-                // this closure is already async, no need for a Task
             }
             .listStyle(selectedStyle.style)
             .anyView
diff --git a/TalerWallet1/Views/HelperViews/LoadingView.swift 
b/TalerWallet1/Views/HelperViews/LoadingView.swift
index 0601ae0..0c1c452 100644
--- a/TalerWallet1/Views/HelperViews/LoadingView.swift
+++ b/TalerWallet1/Views/HelperViews/LoadingView.swift
@@ -15,7 +15,7 @@ struct LoadingView: View {
             .navigationBarBackButtonHidden(backButtonHidden)
             .navigationTitle(navTitle)
             .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: 
.center)
-            .background(WalletColors().backgroundColor)
+//            
.background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all))
     }
 }
 // MARK: -

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