gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 03/32: Settings, About


From: gnunet
Subject: [taler-taler-ios] 03/32: Settings, About
Date: Sat, 10 Feb 2024 15:04:29 +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 c38420b5c3c7f1a0f59a6152a590e1227e21483d
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sun Jan 28 14:44:26 2024 +0100

    Settings, About
---
 TalerWallet1/Model/WalletModel.swift           |  2 ++
 TalerWallet1/Views/Settings/AboutView.swift    | 42 ++++++++++++++++++--------
 TalerWallet1/Views/Settings/SettingsView.swift | 10 ++++--
 3 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/TalerWallet1/Model/WalletModel.swift 
b/TalerWallet1/Model/WalletModel.swift
index b309c38..dadf3fa 100644
--- a/TalerWallet1/Model/WalletModel.swift
+++ b/TalerWallet1/Model/WalletModel.swift
@@ -79,6 +79,8 @@ fileprivate struct GetTransactionById: 
WalletBackendFormattedRequest {
 // MARK: -
 /// The info returned from Wallet-core init
 struct VersionInfo: Decodable {
+    var implementationSemver: String?
+    var implementationGitHash: String?
     var version: String
     var exchange: String
     var merchant: String
diff --git a/TalerWallet1/Views/Settings/AboutView.swift 
b/TalerWallet1/Views/Settings/AboutView.swift
index a00230f..5ccdb27 100644
--- a/TalerWallet1/Views/Settings/AboutView.swift
+++ b/TalerWallet1/Views/Settings/AboutView.swift
@@ -21,6 +21,7 @@ struct AboutView: View {
     @AppStorage("iconOnly") var iconOnly: Bool = false
 
     @State private var rotationEnabled = false
+    @State private var showGitHash = false
     @State private var listID = UUID()
 
     var body: some View {
@@ -34,9 +35,7 @@ struct AboutView: View {
                 HStack {
                     Spacer()
                     RotatingTaler(size: 100, rotationEnabled: $rotationEnabled)
-                        .onTapGesture(count: 2) {
-                            rotationEnabled.toggle()
-                        }
+                        .onTapGesture(count: 1) { rotationEnabled.toggle() }
                     Spacer()
                 }
                 SettingsItem(name: "Visit the taler.net website", id1: "web",
@@ -50,9 +49,17 @@ struct AboutView: View {
                 SettingsItem(name: "App Version", id1: "app") {
                     Text(verbatim: "\(Bundle.main.releaseVersionNumberPretty)")
                 }
-                SettingsItem(name: "Wallet Core Version", id1: "wallet-core") {
-                    Text(verbatim: "\(walletCore.versionInfo?.version ?? 
"unknown")")
-                }
+                Group {
+                    if showGitHash {
+                        SettingsItem(name: "Wallet-Core Git", id1: 
"wallet-coreG") {
+                            Text(verbatim: 
"\(walletCore.versionInfo?.implementationGitHash ?? "unknown")")
+                        }
+                    } else {
+                        SettingsItem(name: "Wallet-Core Version", id1: 
"wallet-coreV") {
+                            Text(verbatim: 
"\(walletCore.versionInfo?.implementationSemver ?? "unknown")")
+                        }
+                    }
+                }.onTapGesture(count: 1) { showGitHash.toggle() }
 //                SettingsItem(name: "Supported Exchange Versions", id1: 
"exchange") {
 //                    Text(verbatim: "\(walletCore.versionInfo?.exchange ?? 
"unknown")")
 //                }
@@ -72,21 +79,30 @@ struct AboutView: View {
         }
         .onDisappear() {
         }
-        .task {
-            try? await Task.sleep(nanoseconds: 1_000_000_000 * UInt64(5))
-            rotationEnabled.toggle()
-        }
+//        .task {
+//            try? await Task.sleep(nanoseconds: 1_000_000_000 * UInt64(5))
+//            rotationEnabled.toggle()
+//        }
     }
 }
 extension Bundle {
+    var bundleName: String? {
+        return infoDictionary?["CFBundleDisplayName"] as? String
+    }
     var releaseVersionNumber: String? {
         return infoDictionary?["CFBundleShortVersionString"] as? String
     }
-    var buildVersionNumber: String? {
-        return infoDictionary?["CFBundleVersion"] as? String
+    var buildVersionNumber: String {
+        let build = infoDictionary?["CFBundleVersion"]
+        let zero = "0"
+        if let build {
+            return build as? String ?? zero
+        }
+        return zero
     }
     var releaseVersionNumberPretty: String {
-        return "v\(releaseVersionNumber ?? "1.0.0")"
+        let release = releaseVersionNumber ?? "1.0.0"
+        return "v\(release) (\(buildVersionNumber))"
     }
 }
 // MARK: -
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift 
b/TalerWallet1/Views/Settings/SettingsView.swift
index 06d552d..6484c2e 100644
--- a/TalerWallet1/Views/Settings/SettingsView.swift
+++ b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -85,7 +85,13 @@ struct SettingsView: View {
         let walletCore = WalletCore.shared
         Group {
             List {
-                let aboutStr = String(localized: "About GNU Taler")
+#if TALER_WALLET
+                let appName = "Taler Wallet"
+#else
+                let appName = "GNU Taler"
+#endif
+                let localizedAppName = Bundle.main.bundleName ?? appName
+                let aboutStr = String(localized: "About \(localizedAppName)")
                 NavigationLink {        // whole row like in a tableView
                     LazyView { AboutView(stack: stack.push(), navTitle: 
aboutStr) }
                 } label: {
@@ -136,7 +142,7 @@ struct SettingsView: View {
                 if diagnosticModeEnabled {
                     SettingsToggle(name: String("Developer Mode"), value: 
$developerMode, id1: "devMode",
                             description: hideDescriptions ? nil : String("More 
information intended for debugging")) {
-                        withAnimation { showDevelopItems = developerMode }
+                        withAnimation(Animation.linear.delay(0.8)) { 
showDevelopItems = developerMode }
                     }
                     if showDevelopItems {  // show or hide the following items
                         SettingsItem(name: String("Withdraw \(DEMOCURRENCY)"), 
id1: "demo1with",

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