taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 5449667134a736a87fb76c4394d86ff1e88895d1
parent 86071d0fb484d953f759d1b493ae80f22df3904d
Author: Marc Stibane <marc@taler.net>
Date:   Wed, 25 Feb 2026 20:36:47 +0100

separate view for debug-related settings

Diffstat:
ATalerWallet1/Views/Settings/DebugSettingsView.swift | 270+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MTalerWallet1/Views/Settings/Exchange/ExchangeListView.swift | 22+++++++++++++---------
MTalerWallet1/Views/Settings/Exchange/ExchangeRowView.swift | 6+++---
MTalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift | 9++-------
MTalerWallet1/Views/Settings/SettingsView.swift | 267++++++++-----------------------------------------------------------------------
5 files changed, 312 insertions(+), 262 deletions(-)

diff --git a/TalerWallet1/Views/Settings/DebugSettingsView.swift b/TalerWallet1/Views/Settings/DebugSettingsView.swift @@ -0,0 +1,270 @@ +/* + * This file is part of GNU Taler, ©2022-26 Taler Systems S.A. + * See LICENSE.md + */ +/** + * @author Marc Stibane + */ +import SwiftUI +import taler_swift +import SymLog +import LocalConsole + +struct DebugSettingsView: View { + private let symLog = SymLogV(0) + let stack: CallStack + let navTitle: String + + @EnvironmentObject private var controller: Controller + @EnvironmentObject private var model: WalletModel +// @Environment(\.colorSchemeContrast) private var colorSchemeContrast +#if DEBUG + @AppStorage("developerMode") var developerMode: Bool = true +#else + @AppStorage("developerMode") var developerMode: Bool = false +#endif + @AppStorage("logTransactions") var logTransactions: Bool = false + @AppStorage("useHaptics") var useHaptics: Bool = true + @AppStorage("developDelay") var developDelay: Bool = false + @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic + @AppStorage("minimalistic") var minimalistic: Bool = false + @AppStorage("localConsoleL") var localConsoleL: Bool = false // for Logs + @AppStorage("localConsoleO") var localConsoleO: Int = 0 // for Observability + + @State private var checkDisabled = false + @State private var withDrawDisabled = false + @State private var showDevelopItems = false + @State private var showResetAlert: Bool = false + @State private var didReset: Bool = false + + private var dismissAlertButton: some View { + Button("Cancel", role: .cancel) { + showResetAlert = false + } + } + private var resetButton: some View { + Button("Reset", role: .destructive) { // TODO: WalletColors().errorColor + didReset = true + showResetAlert = false + Task { // runs on MainActor + symLog.log("❗️Reset wallet-core❗️") + try? await model.resetWalletCore() + } + } + } + @State private var listID = UUID() + + var body: some View { +#if PRINT_CHANGES + let _ = Self._printChanges() + let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear +#endif + let walletCore = WalletCore.shared + Group { + List { + SettingsToggle(name: String("Developer Mode"), value: $developerMode, id1: "devMode", + description: minimalistic ? nil : String("More information intended for debugging")) { + withAnimation(Animation.linear.delay(0.8)) { showDevelopItems = developerMode } + } + if showDevelopItems { +#if DEBUG + SettingsToggle(name: String("Log Transactions"), value: $logTransactions.onChange({ isLogging in + walletCore.logTransactions = isLogging}), id1: "logTransactions", + description: minimalistic ? nil : String("full log with all tx")) {} +#endif + let localConsStr = String("on LocalConsole") + let observability = String("Observe walletCore") + SettingsTriState(name: observability, value: $localConsoleO.onChange({ isObserving in + walletCore.isObserving = isObserving}), + description: minimalistic ? nil : localConsStr) { isObserving in + let consoleManager = LCManager.shared + consoleManager.isVisible = localConsoleO != 0 || localConsoleL + consoleManager.clear() + } + let showLogs = String("Show logs") + SettingsToggle(name: showLogs, value: $localConsoleL.onChange({ isLogging in + walletCore.isLogging = isLogging}), id1: "localConsoleL", + description: minimalistic ? nil : localConsStr) { + let consoleManager = LCManager.shared + consoleManager.isVisible = localConsoleO != 0 || localConsoleL + consoleManager.clear() + } +#if DEBUG + let banks = ["glstest.taler.net", "taler.fdold.eu", "regio-taler.fdold.eu", + "taler.grothoff.org", "taler.ar", + "head.taler.net", "test.taler.net", "demo.taler.net", "kyctest.taler.net"] + ForEach(banks, id: \.self) { bank in + let urlStr = "https://bank." + bank + Link(bank, destination: URL(string: urlStr)!) + } +#endif + } // showDevelopItems + SettingsItem(name: String("DEMO"), id1: "demo1with", + description: minimalistic ? nil : String("Get money for testing")) { + let title = "Withdraw" + Button(title) { + withDrawDisabled = true // don't run twice + Task { // runs on MainActor + symLog.log("Withdraw DEMO KUDOS") + let amount = Amount(currency: DEMOCURRENCY, cent: 11100) + try? await model.loadTestKudos(0, amount: amount) + } + } + .buttonStyle(.bordered) + .disabled(withDrawDisabled) + }.id("demo1withdraw") + SettingsItem(name: String("TEST"), id1: "test1with", + description: minimalistic ? nil : String("Get money for testing")) { + let title = "Withdraw" + Button(title) { + withDrawDisabled = true // don't run twice + Task { // runs on MainActor + symLog.log("Withdraw TESTKUDOS") + let cent = UInt64.random(in: 110...195) * 100 + let amount = Amount(currency: TESTCURRENCY, cent: cent) + try? await model.loadTestKudos(1, amount: amount) + } + } + .buttonStyle(.bordered) + .disabled(withDrawDisabled) + }.id("test1withdraw") + if showDevelopItems { + SettingsItem(name: String("HEAD"), id1: "head1with", + description: minimalistic ? nil : String("Get money for testing")) { + let title = "Withdraw" + Button(title) { + withDrawDisabled = true // don't run twice + Task { // runs on MainActor + symLog.log("Withdraw HEAD KUDOS") + let amount = Amount(currency: DEMOCURRENCY, cent: 1100) + try? await model.loadTestKudos(2, amount: amount) + } + } + .buttonStyle(.bordered) + .disabled(withDrawDisabled) + }.id("head1withdraw") + SettingsToggle(name: String("Set 2 seconds delay"), + value: $developDelay.onChange({ delay in + walletCore.developDelay = delay}), + id1: "delay", + description: minimalistic ? nil : String("After each wallet-core action")) + .id("delay") +#if DEBUG + SettingsItem(name: String("Run Dev Experiment Refresh"), id1: "applyDevExperiment", + description: minimalistic ? nil : "dev-experiment/insert-pending-refresh") { + let title = "Refresh" + Button(title) { + Task { // runs on MainActor + symLog.log("running applyDevExperiment Refresh") + try? await model.setConfig(setTesting: true) + try? await model.devExperimentT(talerUri: "taler://dev-experiment/start-block-refresh") + try? await model.devExperimentT(talerUri: "taler://dev-experiment/insert-pending-refresh") + } + } + .buttonStyle(.bordered) + }.id("Refresh") +#endif + SettingsItem(name: String("Run Integration Test"), id1: "demo1test", + description: minimalistic ? nil : String("Perform basic test transactions")) { + let title = "Demo 1" + Button(title) { + checkDisabled = true // don't run twice + Task { // runs on MainActor + symLog.log("running integration test on demo") + try? await model.runIntegrationTest(newVersion: false, test: false) + } + } + .buttonStyle(.bordered) + .disabled(checkDisabled) + }.id("demo1runTest") + SettingsItem(name: String("Run Integration Test"), id1: "test1test", + description: minimalistic ? nil : "Perform basic test transactions") { + let title = "Test 1" + Button(title) { + checkDisabled = true // don't run twice + Task { // runs on MainActor + symLog.log("running integration test on test") + try? await model.runIntegrationTest(newVersion: false, test: true) + } + } + .buttonStyle(.bordered) + .disabled(checkDisabled) + }.id("test1runTest") + SettingsItem(name: String("Run Integration Test V2"), id1: "demo2test", + description: minimalistic ? nil : String("Perform more test transactions")) { + let title = "Demo 2" + Button(title) { + checkDisabled = true // don't run twice + Task { // runs on MainActor + symLog.log("running integration test V2 on demo") + try? await model.runIntegrationTest(newVersion: true, test: false) + } + } + .buttonStyle(.bordered) + .disabled(checkDisabled) + }.id("demo2runTest") + SettingsItem(name: String("Run Integration Test V2"), id1: "test2test", + description: minimalistic ? nil : String("Perform more test transactions")) { + let title = "Test 2" + Button(title) { + checkDisabled = true // don't run twice + Task { // runs on MainActor + symLog.log("running integration test V2 on test") + try? await model.runIntegrationTest(newVersion: true, test: true) + } + } + .buttonStyle(.bordered) + .disabled(checkDisabled) + }.id("test2runTest") + SettingsItem(name: String("Run Infinite Transaction Loop"), id1: "runInfinite", + description: minimalistic ? nil : String("Check DB in background")) { + let title = "Loop" + Button(title) { + checkDisabled = true // don't run twice + Task { // runs on MainActor + symLog.log("Running Infinite Transaction Loop") + try? await model.testingInfiniteTransaction(delayMs: 10_000, shouldFetch: true) + } + } + .buttonStyle(.bordered) + .disabled(checkDisabled) + }.id("runInfiniteLoop") + SettingsItem(name: String("Save Logfile"), id1: "save", + description: minimalistic ? nil : String("Help debugging wallet-core")) { + Button("Save") { + symLog.log("Saving Log") + // FIXME: Save Logfile + } + .buttonStyle(.bordered) + .disabled(true) + }.id("saveLog") + SettingsItem(name: String("Reset Wallet"), id1: "reset", + description: minimalistic ? nil : String("Throw away all your money")) { + Button("Reset") { + showResetAlert = true + } + .buttonStyle(.bordered) +// .disabled(didReset) + }.id("resetWallet") + } + } + .id(listID) + .listStyle(myListStyle.style).anyView + } + .navigationTitle(navTitle) + .onAppear() { + showDevelopItems = developerMode + DebugViewC.shared.setViewID(VIEW_SETTINGS, stack: stack.push()) + } + .onDisappear() { + checkDisabled = false // reset + withDrawDisabled = false + } + .alert("Reset Wallet", + isPresented: $showResetAlert, + actions: { dismissAlertButton + resetButton }, + message: { Text(verbatim: "Are you sure you want to reset your wallet?\nThis cannot be reverted, all money will be lost.") }) + + } // body +} diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift @@ -30,9 +30,13 @@ struct ExchangeListView: View { private let symLog = SymLogV(0) let stack: CallStack let navTitle: String - let showDevelopItems: Bool @EnvironmentObject private var model: WalletModel @EnvironmentObject private var controller: Controller +#if DEBUG + @AppStorage("developerMode") var developerMode: Bool = true +#else + @AppStorage("developerMode") var developerMode: Bool = false +#endif @State var showAlert: Bool = false @State var newExchange: String = TESTEXCHANGE @@ -46,7 +50,7 @@ struct ExchangeListView: View { let addButtonStr = String(localized: "Add", comment: "button in the addExchange alert") let enterURL = String(localized: "Enter the URL") if #available(iOS 16.4, *) { - ExchangeListCommonV(symLog: symLog, stack: stack.push(), showDevelopItems: showDevelopItems) + ExchangeListCommonV(symLog: symLog, stack: stack.push(), developerMode: developerMode) .navigationTitle(navTitle) .navigationBarItems(trailing: plusButton) .alert(addTitleStr, isPresented: $showAlert) { @@ -62,7 +66,7 @@ struct ExchangeListView: View { .accessibilityHidden(true) } } else { // iOS 15 cannot have a textfield in an alert, so we must - ExchangeListCommonV(symLog: symLog, stack: stack.push(), showDevelopItems: showDevelopItems) + ExchangeListCommonV(symLog: symLog, stack: stack.push(), developerMode: developerMode) .navigationTitle(navTitle) .navigationBarItems(trailing: plusButton) .textFieldAlert(isPresented: $showAlert, @@ -78,7 +82,7 @@ struct ExchangeListView: View { struct ExchangeListCommonV: View { let symLog: SymLogV? let stack: CallStack - let showDevelopItems: Bool + let developerMode: Bool @EnvironmentObject private var controller: Controller @EnvironmentObject private var model: WalletModel @@ -97,13 +101,13 @@ struct ExchangeListCommonV: View { addExchange(cyclos, model: model) } - let exchanges = ["glsint.fdold.eu", "taler.magnetbank.hu", "stage.taler-ops.ch"] + let exchanges = ["glsint.fdold.eu", "taler.magnetbank.hu", "stage.taler-ops.ch", "e.netzbon-basel.ch"] ForEach(exchanges, id: \.self) { exchange in let urlStr = "https://exchange." + exchange Button(urlStr) { addExchange(urlStr, model: model) } - // Link(exchange, destination: URL(string: urlStr)!) +// Link(exchange, destination: URL(string: urlStr)!) } } #endif @@ -112,10 +116,10 @@ struct ExchangeListCommonV: View { ExchangeSectionView(stack: stack.push(), balance: balance, thousand: index * MAXEXCHANGES, // unique ID - showDevelopItems: showDevelopItems) + developerMode: developerMode) } #if DEBUG - if showDevelopItems { + if developerMode { excSection } #endif @@ -138,7 +142,7 @@ struct ExchangeListCommonV: View { } .talerFont(.body) #if DEBUG - if showDevelopItems { + if developerMode { excSection } #endif diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeRowView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeRowView.swift @@ -14,7 +14,7 @@ struct ExchangeRowView: View { let stack: CallStack let exchange: Exchange let index: Int - let showDevelopItems: Bool + let developerMode: Bool @Environment(\.sizeCategory) var sizeCategory @EnvironmentObject private var controller: Controller @@ -68,7 +68,7 @@ struct ExchangeRowView: View { rowView .background(actions) - if showDevelopItems { + if developerMode { HStack { Text("Update Exchange") // VIEW_WITHDRAW_TOS .foregroundStyle(isUpdated ? .gray : .primary) @@ -151,7 +151,7 @@ fileprivate struct ExchangeRow_Previews: PreviewProvider { ExchangeRowView(stack: CallStack("Preview"), exchange: exchange1, index: 1, - showDevelopItems: true) + developerMode: true) } } diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift @@ -16,18 +16,13 @@ struct ExchangeSectionView: View { let stack: CallStack let balance: Balance let thousand: Int // index of balance times 1000 (MAXEXCHANGES per currency) - let showDevelopItems: Bool + let developerMode: Bool @EnvironmentObject private var model: WalletModel @EnvironmentObject private var controller: Controller @AppStorage("minimalistic") var minimalistic: Bool = false @AppStorage("demoHints") var demoHints: Bool = true @AppStorage("fakeNoFees") var fakeNoFees: Bool = true -#if DEBUG - @AppStorage("developerMode") var developerMode: Bool = true -#else - @AppStorage("developerMode") var developerMode: Bool = false -#endif @State private var exchanges: [Exchange] = [] @State private var reloadTransactions: Int = 0 @@ -109,7 +104,7 @@ struct ExchangeSectionView: View { ExchangeRowView(stack: stack.push(), exchange: exchange, index: thousand + index + 1, - showDevelopItems: showDevelopItems) + developerMode: developerMode) .listRowSeparator(.hidden) } if developerMode && (DEMOCURRENCY == currency || TESTCURRENCY == currency) { diff --git a/TalerWallet1/Views/Settings/SettingsView.swift b/TalerWallet1/Views/Settings/SettingsView.swift @@ -1,5 +1,5 @@ /* - * This file is part of GNU Taler, ©2022-25 Taler Systems S.A. + * This file is part of GNU Taler, ©2022-26 Taler Systems S.A. * See LICENSE.md */ /** @@ -10,15 +10,6 @@ import taler_swift import SymLog import LocalConsole -/* - * Backup - * Last backup: 5 hr. ago - * - * Debug log - * View/send internal log - * - */ - struct SettingsView: View { private let symLog = SymLogV(0) let stack: CallStack @@ -33,49 +24,21 @@ struct SettingsView: View { #else @AppStorage("developerMode") var developerMode: Bool = false #endif - @AppStorage("logTransactions") var logTransactions: Bool = false @AppStorage("useHaptics") var useHaptics: Bool = true @AppStorage("playSoundsI") var playSoundsI: Int = 1 @AppStorage("playSoundsB") var playSoundsB: Bool = false @AppStorage("shouldShowWarning") var shouldShowWarning: Bool = true // @AppStorage("increaseContrast") var increaseContrast: Bool = false @AppStorage("talerFontIndex") var talerFontIndex: Int = 0 - @AppStorage("developDelay") var developDelay: Bool = false @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic @AppStorage("minimalistic") var minimalistic: Bool = false - @AppStorage("localConsoleL") var localConsoleL: Bool = false // for Logs - @AppStorage("localConsoleO") var localConsoleO: Int = 0 // for Observability @AppStorage("useAuthentication") var useAuthentication: Bool = false @AppStorage("showQRauto16") var showQRauto16: Bool = true @AppStorage("showQRauto17") var showQRauto17: Bool = false @AppStorage("oimEuro") var oimEuro: Bool = false @AppStorage("oimChart") var oimChart: Bool = false - @State private var checkDisabled = false - @State private var withDrawDisabled = false -#if DEBUG - @State private var diagnosticModeEnabled = true -#endif - @State private var showDevelopItems = false @State private var hideDescriptions = false - @State private var showResetAlert: Bool = false - @State private var didReset: Bool = false - - private var dismissAlertButton: some View { - Button("Cancel", role: .cancel) { - showResetAlert = false - } - } - private var resetButton: some View { - Button("Reset", role: .destructive) { // TODO: WalletColors().errorColor - didReset = true - showResetAlert = false - Task { // runs on MainActor - symLog.log("❗️Reset wallet-core❗️") - try? await model.resetWalletCore() - } - } - } @State private var listID = UUID() func redraw(_ newFont: Int) -> Void { @@ -92,13 +55,6 @@ struct SettingsView: View { let walletCore = WalletCore.shared Group { List { -#if DEBUG - if showDevelopItems { - SettingsToggle(name: String("Log Transactions"), value: $logTransactions.onChange({ isLogging in - walletCore.logTransactions = isLogging}), id1: "logTransactions", - description: hideDescriptions ? nil : String("full log with all tx")) {} - } -#endif #if TALER_WALLET let appName = "Taler Wallet" #elseif TALER_NIGHTLY @@ -117,8 +73,7 @@ struct SettingsView: View { let exchangesTitle = String(localized: "TitleExchanges", defaultValue: "Payment Services") let exchangesDest = ExchangeListView(stack: stack.push(exchangesTitle), - navTitle: exchangesTitle, - showDevelopItems: showDevelopItems) + navTitle: exchangesTitle) NavigationLink { // whole row like in a tableView exchangesDest } label: { @@ -134,6 +89,7 @@ struct SettingsView: View { SettingsItem(name: bankAccountsTitle, id1: "bankAccounts", description: hideDescriptions ? nil : String(localized: "Your accounts for deposit...")) {} } + let showQRstring = String(localized: "Show QR codes") let showQRhint = String(localized: "Automatically for P2P transactions") if #available(iOS 17.7, *) { @@ -143,9 +99,17 @@ struct SettingsView: View { SettingsToggle(name: showQRstring, value: $showQRauto16, id1: "showQRautomatic", description: minimalistic ? nil : showQRhint) {} } - SettingsToggle(name: String(localized: "Use FaceID / TouchID"), value: $useAuthentication, id1: "useFaceID", - description: minimalistic ? nil : String(localized: "Protect your money")) { - biometricService.isAuthenticated = false + let biometryType = biometricService.biometryType() + let biometryString = biometryType == .faceID ? String(localized: "Use FaceID") + : biometryType == .touchID ? String(localized: "Use TouchID") + : EMPTYSTRING + if !biometryString.isEmpty { + SettingsToggle(name: biometryString, value: $useAuthentication, id1: "useFaceID", + description: minimalistic ? nil : String(localized: "Protect your money")) { + biometricService.isAuthenticated = false + } +// } else { +// biometricService.isAuthenticated = false } /// Backup @@ -193,193 +157,21 @@ struct SettingsView: View { description: hideDescriptions ? nil : String(localized: "For Delete, Abandon & Abort buttons")) // SettingsFont(title: String(localized: "Font:"), value: talerFontIndex, action: redraw) // .id("font") - SettingsStyle(title: String(localized: "List Style:"), myListStyle: $myListStyle) - .id("liststyle") + #if DEBUG - let showDiagnostic = diagnosticModeEnabled + let showDiagnostic = true #else let showDiagnostic = controller.diagnosticModeEnabled #endif if showDiagnostic { - let localConsStr = String("on LocalConsole") - let observability = String("Observe walletCore") - SettingsTriState(name: observability, value: $localConsoleO.onChange({ isObserving in - walletCore.isObserving = isObserving}), - description: hideDescriptions ? nil : localConsStr) { isObserving in - let consoleManager = LCManager.shared - consoleManager.isVisible = localConsoleO != 0 || localConsoleL - consoleManager.clear() - } - let showLogs = String("Show logs") - SettingsToggle(name: showLogs, value: $localConsoleL.onChange({ isLogging in - walletCore.isLogging = isLogging}), id1: "localConsoleL", - description: hideDescriptions ? nil : localConsStr) { - let consoleManager = LCManager.shared - consoleManager.isVisible = localConsoleO != 0 || localConsoleL - consoleManager.clear() - } - SettingsToggle(name: String("Developer Mode"), value: $developerMode, id1: "devMode", - description: hideDescriptions ? nil : String("More information intended for debugging")) { - withAnimation(Animation.linear.delay(0.8)) { showDevelopItems = developerMode } - } -#if DEBUG - if showDevelopItems { - let banks = ["glstest.taler.net", "taler.fdold.eu", "regio-taler.fdold.eu", - "taler.grothoff.org", "taler.ar", - "head.taler.net", "test.taler.net", "demo.taler.net", "kyctest.taler.net"] - ForEach(banks, id: \.self) { bank in - let urlStr = "https://bank." + bank - Link(bank, destination: URL(string: urlStr)!) - } - } -#endif - if showDevelopItems { // show or hide the following items - SettingsItem(name: String("DEMO"), id1: "demo1with", - description: hideDescriptions ? nil : String("Get money for testing")) { - let title = "Withdraw" - Button(title) { - withDrawDisabled = true // don't run twice - Task { // runs on MainActor - symLog.log("Withdraw DEMO KUDOS") - let amount = Amount(currency: DEMOCURRENCY, cent: 11100) - try? await model.loadTestKudos(0, amount: amount) - } - } - .buttonStyle(.bordered) - .disabled(withDrawDisabled) - }.id("demo1withdraw") - SettingsItem(name: String("TEST"), id1: "test1with", - description: hideDescriptions ? nil : String("Get money for testing")) { - let title = "Withdraw" - Button(title) { - withDrawDisabled = true // don't run twice - Task { // runs on MainActor - symLog.log("Withdraw TESTKUDOS") - let cent = UInt64.random(in: 110...195) * 100 - let amount = Amount(currency: TESTCURRENCY, cent: cent) - try? await model.loadTestKudos(1, amount: amount) - } - } - .buttonStyle(.bordered) - .disabled(withDrawDisabled) - }.id("test1withdraw") - SettingsItem(name: String("HEAD"), id1: "head1with", - description: hideDescriptions ? nil : String("Get money for testing")) { - let title = "Withdraw" - Button(title) { - withDrawDisabled = true // don't run twice - Task { // runs on MainActor - symLog.log("Withdraw HEAD KUDOS") - let amount = Amount(currency: DEMOCURRENCY, cent: 1100) - try? await model.loadTestKudos(2, amount: amount) - } - } - .buttonStyle(.bordered) - .disabled(withDrawDisabled) - }.id("head1withdraw") - SettingsToggle(name: String("Set 2 seconds delay"), - value: $developDelay.onChange({ delay in - walletCore.developDelay = delay}), - id1: "delay", - description: hideDescriptions ? nil : String("After each wallet-core action")) - .id("delay") -#if DEBUG - SettingsItem(name: String("Run Dev Experiment Refresh"), id1: "applyDevExperiment", - description: hideDescriptions ? nil : "dev-experiment/insert-pending-refresh") { - let title = "Refresh" - Button(title) { - Task { // runs on MainActor - symLog.log("running applyDevExperiment Refresh") - try? await model.setConfig(setTesting: true) - try? await model.devExperimentT(talerUri: "taler://dev-experiment/start-block-refresh") - try? await model.devExperimentT(talerUri: "taler://dev-experiment/insert-pending-refresh") - } - } - .buttonStyle(.bordered) - }.id("Refresh") -#endif - SettingsItem(name: String("Run Integration Test"), id1: "demo1test", - description: hideDescriptions ? nil : String("Perform basic test transactions")) { - let title = "Demo 1" - Button(title) { - checkDisabled = true // don't run twice - Task { // runs on MainActor - symLog.log("running integration test on demo") - try? await model.runIntegrationTest(newVersion: false, test: false) - } - } - .buttonStyle(.bordered) - .disabled(checkDisabled) - }.id("demo1runTest") - SettingsItem(name: String("Run Integration Test"), id1: "test1test", - description: hideDescriptions ? nil : "Perform basic test transactions") { - let title = "Test 1" - Button(title) { - checkDisabled = true // don't run twice - Task { // runs on MainActor - symLog.log("running integration test on test") - try? await model.runIntegrationTest(newVersion: false, test: true) - } - } - .buttonStyle(.bordered) - .disabled(checkDisabled) - }.id("test1runTest") - SettingsItem(name: String("Run Integration Test V2"), id1: "demo2test", - description: hideDescriptions ? nil : String("Perform more test transactions")) { - let title = "Demo 2" - Button(title) { - checkDisabled = true // don't run twice - Task { // runs on MainActor - symLog.log("running integration test V2 on demo") - try? await model.runIntegrationTest(newVersion: true, test: false) - } - } - .buttonStyle(.bordered) - .disabled(checkDisabled) - }.id("demo2runTest") - SettingsItem(name: String("Run Integration Test V2"), id1: "test2test", - description: hideDescriptions ? nil : String("Perform more test transactions")) { - let title = "Test 2" - Button(title) { - checkDisabled = true // don't run twice - Task { // runs on MainActor - symLog.log("running integration test V2 on test") - try? await model.runIntegrationTest(newVersion: true, test: true) - } - } - .buttonStyle(.bordered) - .disabled(checkDisabled) - }.id("test2runTest") - SettingsItem(name: String("Run Infinite Transaction Loop"), id1: "runInfinite", - description: hideDescriptions ? nil : String("Check DB in background")) { - let title = "Loop" - Button(title) { - checkDisabled = true // don't run twice - Task { // runs on MainActor - symLog.log("Running Infinite Transaction Loop") - try? await model.testingInfiniteTransaction(delayMs: 10_000, shouldFetch: true) - } - } - .buttonStyle(.bordered) - .disabled(checkDisabled) - }.id("runInfiniteLoop") - SettingsItem(name: String("Save Logfile"), id1: "save", - description: hideDescriptions ? nil : String("Help debugging wallet-core")) { - Button("Save") { - symLog.log("Saving Log") - // FIXME: Save Logfile - } - .buttonStyle(.bordered) - .disabled(true) - }.id("saveLog") - SettingsItem(name: String("Reset Wallet"), id1: "reset", - description: hideDescriptions ? nil : String("Throw away all your money")) { - Button("Reset") { - showResetAlert = true - } - .buttonStyle(.bordered) -// .disabled(didReset) - }.id("resetWallet") + let devTitle = String(localized: "TitleDeveloper", defaultValue: "Developer") + let devDest = DebugSettingsView(stack: stack.push(devTitle), + navTitle: devTitle) + NavigationLink { // whole row like in a tableView + devDest + } label: { + SettingsItem(name: devTitle, id1: "developer", + description: hideDescriptions ? nil : String(localized: "Help debug this app...")) {} } } } @@ -388,20 +180,9 @@ struct SettingsView: View { } .navigationTitle(navTitle) .onAppear() { - showDevelopItems = developerMode hideDescriptions = minimalistic DebugViewC.shared.setViewID(VIEW_SETTINGS, stack: stack.push()) } - .onDisappear() { - checkDisabled = false // reset - withDrawDisabled = false - } - .alert("Reset Wallet", - isPresented: $showResetAlert, - actions: { dismissAlertButton - resetButton }, - message: { Text(verbatim: "Are you sure you want to reset your wallet?\nThis cannot be reverted, all money will be lost.") }) - } // body } // MARK: -