diff options
author | Marc Stibane <marc@taler.net> | 2023-10-21 20:59:28 +0200 |
---|---|---|
committer | Marc Stibane <marc@taler.net> | 2023-10-21 20:59:28 +0200 |
commit | fba7fcf6cc4b2cbab2d11d430de13288803ab57f (patch) | |
tree | 95b705076e8d999a30a865340fdc86a07fbdab8d | |
parent | cefa3ed84304f474f45929d0b8793a322586a0bf (diff) | |
download | taler-ios-fba7fcf6cc4b2cbab2d11d430de13288803ab57f.tar.gz taler-ios-fba7fcf6cc4b2cbab2d11d430de13288803ab57f.tar.bz2 taler-ios-fba7fcf6cc4b2cbab2d11d430de13288803ab57f.zip |
AboutView
-rw-r--r-- | TalerWallet.xcodeproj/project.pbxproj | 6 | ||||
-rw-r--r-- | TalerWallet1/Controllers/DebugViewC.swift | 7 | ||||
-rw-r--r-- | TalerWallet1/Views/Settings/AboutView.swift | 111 | ||||
-rw-r--r-- | TalerWallet1/Views/Settings/SettingsView.swift | 11 |
4 files changed, 121 insertions, 14 deletions
diff --git a/TalerWallet.xcodeproj/project.pbxproj b/TalerWallet.xcodeproj/project.pbxproj index cfa1c37..cbefbd1 100644 --- a/TalerWallet.xcodeproj/project.pbxproj +++ b/TalerWallet.xcodeproj/project.pbxproj @@ -231,6 +231,8 @@ 4EBA56412A7FF5200084948B /* PayTemplateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EBA56402A7FF5200084948B /* PayTemplateView.swift */; }; 4EBA82AB2A3EB2CA00E5F39A /* TransactionButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EBA82AA2A3EB2CA00E5F39A /* TransactionButton.swift */; }; 4EBA82AD2A3F580500E5F39A /* QuiteSomeCoins.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EBA82AC2A3F580500E5F39A /* QuiteSomeCoins.swift */; }; + 4EC400892AE3E7E800DF72C7 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EC400882AE3E7E800DF72C7 /* AboutView.swift */; }; + 4EC4008A2AE3E7E800DF72C7 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EC400882AE3E7E800DF72C7 /* AboutView.swift */; }; 4EC90C782A1B528B0071DC58 /* ExchangeSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EC90C772A1B528B0071DC58 /* ExchangeSectionView.swift */; }; 4ECB62802A0BA6DF004ABBB7 /* Model+P2P.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ECB627F2A0BA6DF004ABBB7 /* Model+P2P.swift */; }; 4ECB62822A0BB01D004ABBB7 /* SelectDays.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ECB62812A0BB01D004ABBB7 /* SelectDays.swift */; }; @@ -399,6 +401,7 @@ 4EBA56402A7FF5200084948B /* PayTemplateView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PayTemplateView.swift; sourceTree = "<group>"; }; 4EBA82AA2A3EB2CA00E5F39A /* TransactionButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionButton.swift; sourceTree = "<group>"; }; 4EBA82AC2A3F580500E5F39A /* QuiteSomeCoins.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuiteSomeCoins.swift; sourceTree = "<group>"; }; + 4EC400882AE3E7E800DF72C7 /* AboutView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; }; 4EC90C772A1B528B0071DC58 /* ExchangeSectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExchangeSectionView.swift; sourceTree = "<group>"; }; 4ECB627F2A0BA6DF004ABBB7 /* Model+P2P.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Model+P2P.swift"; sourceTree = "<group>"; }; 4ECB62812A0BB01D004ABBB7 /* SelectDays.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectDays.swift; sourceTree = "<group>"; }; @@ -643,6 +646,7 @@ isa = PBXGroup; children = ( 4EB095252989CBFE0043A8A1 /* SettingsView.swift */, + 4EC400882AE3E7E800DF72C7 /* AboutView.swift */, 4EB095262989CBFE0043A8A1 /* SettingsItem.swift */, 4EB0954B2989CBFE0043A8A1 /* Pending */, ); @@ -1037,6 +1041,7 @@ 4E605DB72AB05E48002FB9A7 /* View+flippedDirection.swift in Sources */, 4E983C2C2ADC416800FA9CC5 /* View+needVStack.swift in Sources */, 4E3EAE272A990778009F1BE8 /* WalletColors.swift in Sources */, + 4EC400892AE3E7E800DF72C7 /* AboutView.swift in Sources */, 4E3EAE282A990778009F1BE8 /* BalancesListView.swift in Sources */, 4E3EAE292A990778009F1BE8 /* WalletBackendError.swift in Sources */, 4E3EAE2A2A990778009F1BE8 /* PendingRowView.swift in Sources */, @@ -1142,6 +1147,7 @@ 4E605DB82AB05E48002FB9A7 /* View+flippedDirection.swift in Sources */, 4E983C2D2ADC416800FA9CC5 /* View+needVStack.swift in Sources */, 4E9320432A14F6EA00A87B0E /* WalletColors.swift in Sources */, + 4EC4008A2AE3E7E800DF72C7 /* AboutView.swift in Sources */, 4EB0955D2989CBFE0043A8A1 /* BalancesListView.swift in Sources */, 4EB095212989CBCB0043A8A1 /* WalletBackendError.swift in Sources */, 4EB0955E2989CBFE0043A8A1 /* PendingRowView.swift in Sources */, diff --git a/TalerWallet1/Controllers/DebugViewC.swift b/TalerWallet1/Controllers/DebugViewC.swift index 78ef45b..990f53a 100644 --- a/TalerWallet1/Controllers/DebugViewC.swift +++ b/TalerWallet1/Controllers/DebugViewC.swift @@ -27,9 +27,10 @@ import os.log // MARK: - Main View public let VIEW_EMPTY = 10 // 10 WalletEmptyView public let VIEW_BALANCES = VIEW_EMPTY + 1 // 11 BalancesListView -public let VIEW_SETTINGS = VIEW_BALANCES + 1 // 12 SettingsView -public let VIEW_PENDING = VIEW_SETTINGS + 1 // 13 PendingOpsListView -public let VIEW_EXCHANGES = VIEW_PENDING + 1 // 14 ExchangeListView +public let VIEW_EXCHANGES = VIEW_BALANCES + 1 // 12 ExchangeListView +public let VIEW_SETTINGS = VIEW_EXCHANGES + 1 // 13 SettingsView +public let VIEW_ABOUT = VIEW_SETTINGS + 1 // 14 AboutView +public let VIEW_PENDING = VIEW_ABOUT + 1 // 15 PendingOpsListView // MARK: Transactions public let VIEW_TRANSACTIONLIST = VIEW_EMPTY + 10 // 20 TransactionsListView diff --git a/TalerWallet1/Views/Settings/AboutView.swift b/TalerWallet1/Views/Settings/AboutView.swift new file mode 100644 index 0000000..e6de724 --- /dev/null +++ b/TalerWallet1/Views/Settings/AboutView.swift @@ -0,0 +1,111 @@ +/* + * This file is part of GNU Taler, ©2022-23 Taler Systems S.A. + * See LICENSE.md + */ +import SwiftUI +import taler_swift +import SymLog + +struct AboutView: View { + private let symLog = SymLogV(0) + let stack: CallStack + let navTitle: String + + @EnvironmentObject private var controller: Controller +#if DEBUG + @AppStorage("developerMode") var developerMode: Bool = true +#else + @AppStorage("developerMode") var developerMode: Bool = false +#endif + @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic + @AppStorage("iconOnly") var iconOnly: Bool = false + +#if TABBAR // Taler Wallet +#else // GNU Taler + var hamburgerAction: () -> Void +#endif + + @EnvironmentObject private var model: WalletModel + + @State private var rotationEnabled = false + + @State private var listID = UUID() + + var body: some View { +#if DEBUG + let _ = Self._printChanges() + let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear +#endif + let walletCore = WalletCore.shared + Group { + List { +// VStack { + HStack { + Spacer() + RotatingTaler(size: 100, rotationEnabled: $rotationEnabled) + .onTapGesture(count: 2) { + rotationEnabled.toggle() + } + .onLongPressGesture(minimumDuration: 0.3) { + UIApplication.shared.open(URL(string:"https://taler.net")!, options: [:]) + } + Spacer() + } + SettingsItem(name: "App Version", id1: "app") { + Text(verbatim: "\(Bundle.main.releaseVersionNumberPretty)") + } + SettingsItem(name: "Wallet Core Version", id1: "wallet-core") { + Text(verbatim: "\(walletCore.versionInfo!.version)") + } + SettingsItem(name: "Wallet Core DevMode", id1: "devMode") { + Text(verbatim: "\(walletCore.versionInfo!.devMode ? "YES" : "NO")") + } + SettingsItem(name: "Supported Exchange Versions", id1: "exchange") { + Text(verbatim: "\(walletCore.versionInfo!.exchange)") + } + SettingsItem(name: "Supported Merchant Versions", id1: "merchant") { + Text(verbatim: "\(walletCore.versionInfo!.merchant)") + } + SettingsItem(name: "Used Bank", id1: "bank") { + Text(verbatim: "\(walletCore.versionInfo!.bank)") + } +// } // App version info + } + .id(listID) + .listStyle(myListStyle.style).anyView + } + .navigationTitle(navTitle) + .onAppear() { + DebugViewC.shared.setViewID(VIEW_ABOUT, stack: stack.push()) + } + .onDisappear() { + } + .task { + try? await Task.sleep(nanoseconds: 1_000_000_000 * UInt64(5)) + rotationEnabled.toggle() + } + } +} +extension Bundle { + var releaseVersionNumber: String? { + return infoDictionary?["CFBundleShortVersionString"] as? String + } + var buildVersionNumber: String? { + return infoDictionary?["CFBundleVersion"] as? String + } + var releaseVersionNumberPretty: String { + return "v\(releaseVersionNumber ?? "1.0.0")" + } +} +// MARK: - +#if DEBUG +struct AboutView_Previews: PreviewProvider { + static var previews: some View { +#if TABBAR // Taler Wallet + AboutView(stack: CallStack("Preview"), navTitle: "About") +#else // GNU Taler + SettingsView(stack: CallStack("Preview"), navTitle: "About") { } +#endif + } +} +#endif diff --git a/TalerWallet1/Views/Settings/SettingsView.swift b/TalerWallet1/Views/Settings/SettingsView.swift index 3bf5b69..37a9b48 100644 --- a/TalerWallet1/Views/Settings/SettingsView.swift +++ b/TalerWallet1/Views/Settings/SettingsView.swift @@ -287,17 +287,6 @@ struct SettingsView: View { #endif } } -extension Bundle { - var releaseVersionNumber: String? { - return infoDictionary?["CFBundleShortVersionString"] as? String - } - var buildVersionNumber: String? { - return infoDictionary?["CFBundleVersion"] as? String - } - var releaseVersionNumberPretty: String { - return "v\(releaseVersionNumber ?? "1.0.0")" - } -} // MARK: - #if DEBUG struct SettingsView_Previews: PreviewProvider { |