taler-ios

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

commit b97297c0b28b544170ca13e2c49dc0e4dd55a08e
parent 8c20e7d2a3dfaba3fd705ab2fc1a2fc21c5b9af6
Author: Marc Stibane <marc@taler.net>
Date:   Fri, 26 Jun 2026 08:11:58 +0200

Debugging

Diffstat:
MTalerWallet1/Controllers/DebugViewC.swift | 60+++++++++++++++++++++++++++++-------------------------------
MTalerWallet1/Views/Actions/Banking/ManualWithdraw.swift | 3++-
MTalerWallet1/Views/HelperViews/SubjectInputV.swift | 2+-
MTalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift | 3++-
MTalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift | 2+-
MTalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift | 2+-
MTalerWallet1/Views/Sheets/Payment/PayTemplateV.swift | 2+-
MTalerWallet1/Views/Sheets/Payment/PaymentView.swift | 2+-
MTalerWallet1/Views/Sheets/Refund/RefundURIView.swift | 2+-
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift | 2+-
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift | 3++-
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift | 2+-
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift | 2+-
13 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/TalerWallet1/Controllers/DebugViewC.swift b/TalerWallet1/Controllers/DebugViewC.swift @@ -158,42 +158,40 @@ class DebugViewC: ObservableObject { // } @MainActor func setViewID(_ newID: Int, stack: CallStack) -> Void { - if developerMode { - if viewID == 0 { - logger.log("switching ON, \(newID, privacy: .public)") - viewID = newID // publish ON -// announce("Current view is: \(newID).") - } else if viewID != newID { - logger.log("switching from \(self.viewID, privacy: .public) to \(newID, privacy: .public)") -// announce("View switched from \(self.viewID) to \(newID).") - viewID = newID // publish new viewID - } else { - logger.log("\(newID, privacy: .public) stays") - // don't set viewID to the same value, it would just trigger an unneccessary redraw - } +#if DEBUG + let msg = stack.peek()?.file ?? "?" +#else + let msg = stack.peek()?.message ?? "?" +#endif + if viewID == 0 { + logger.log("switching to \(newID, privacy: .public) \(msg, privacy: .public)") + if developerMode { viewID = newID } + } else if viewID != newID { + logger.log("switching from \(self.viewID, privacy: .public) to \(newID, privacy: .public) \(msg, privacy: .public)") + viewID = developerMode ? newID : 0 } else { - logger.log("view \(newID, privacy: .public)") - if viewID > 0 { - viewID = 0 // publish OFF - } + logger.log("\(newID, privacy: .public) stays \(msg, privacy: .public)") + // don't set viewID to the same value, it would just trigger an unneccessary redraw + if !developerMode { viewID = 0 } } } - @MainActor func setSheetID(_ newID: Int) -> Void { - if developerMode { - if sheetID != newID { - logger.log("sheet switching from \(self.sheetID, privacy: .public) to \(newID, privacy: .public)") - sheetID = newID // publish new sheetID - } else { - logger.log("sheet \(newID, privacy: .public) stays") - // don't set sheetID to the same value, it would just trigger an unneccessary redraw - } + @MainActor func setSheetID(_ newID: Int, stack: CallStack) -> Void { +#if DEBUG + let msg = stack.peek()?.file ?? "?" +#else + let msg = stack.peek()?.message ?? "?" +#endif + if sheetID == 0 { + logger.log("switching to \(newID, privacy: .public) \(msg, privacy: .public)") + if developerMode { sheetID = newID } + } else if sheetID != newID { + logger.log("sheet switching from \(self.sheetID, privacy: .public) to \(newID, privacy: .public) \(msg, privacy: .public)") + sheetID = developerMode ? newID : 0 // publish new sheetID } else { - logger.log("sheet \(newID, privacy: .public)") - if sheetID > 0 { - // might happen after switching DevMode off, if sheetID still has the old value of the last sheet - sheetID = 0 // publish OFF - } + logger.log("sheet \(newID, privacy: .public) stays \(msg, privacy: .public)") + // don't set sheetID to the same value, it would just trigger an unneccessary redraw + if !developerMode { sheetID = 0 } } } } diff --git a/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift b/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift @@ -104,7 +104,8 @@ struct ManualWithdraw: View { .background(FullBackground()) .onAppear { if isSheet { - DebugViewC.shared.setSheetID(SHEET_WITHDRAW_ACCEPT) // 132 WithdrawAcceptView + DebugViewC.shared.setSheetID(SHEET_WITHDRAW_ACCEPT, // 132 WithdrawAcceptView + stack: stack.push()) } else { DebugViewC.shared.setViewID(VIEW_WITHDRAWAL, // 30 WithdrawAmount stack: stack.push()) diff --git a/TalerWallet1/Views/HelperViews/SubjectInputV.swift b/TalerWallet1/Views/HelperViews/SubjectInputV.swift @@ -104,7 +104,7 @@ struct SubjectInputV<TargetView: View>: View { .background(FullBackground()) .onAppear() { // symLog.log("onAppear") - DebugViewC.shared.setSheetID(SHEET_PAY_TEMPL_SUBJECT) + DebugViewC.shared.setSheetID(SHEET_PAY_TEMPL_SUBJECT, stack: stack.push()) } } } diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift @@ -56,7 +56,8 @@ struct P2pAcceptDone: View { .onAppear() { symLog.log("onAppear") DebugViewC.shared.setSheetID(incoming ? SHEET_RCV_P2P_ACCEPT - : SHEET_PAY_P2P_CONFIRM) + : SHEET_PAY_P2P_CONFIRM, + stack: stack.push()) } } } diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift @@ -79,7 +79,7 @@ struct P2pPayURIView: View { } .onAppear() { symLog.log("onAppear") - DebugViewC.shared.setSheetID(SHEET_PAY_P2P) + DebugViewC.shared.setSheetID(SHEET_PAY_P2P, stack: stack.push()) } } } diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift @@ -130,7 +130,7 @@ struct P2pReceiveURIView: View { .task { await viewDidLoad() } .onAppear() { symLog.log("onAppear") - DebugViewC.shared.setSheetID(SHEET_RCV_P2P) + DebugViewC.shared.setSheetID(SHEET_RCV_P2P, stack: stack.push()) } } } diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift @@ -204,7 +204,7 @@ struct PayTemplateV: View { .background(FullBackground()) .onAppear() { symLog.log("onAppear") - DebugViewC.shared.setSheetID(SHEET_PAY_TEMPLATE) + DebugViewC.shared.setSheetID(SHEET_PAY_TEMPLATE, stack: stack.push()) } } else { LoadingView(stack: stack.push(), scopeInfo: nil, message: url.host) diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift @@ -120,7 +120,7 @@ struct PaymentView: View, Sendable { } }.onAppear() { symLog.log("onAppear") - DebugViewC.shared.setSheetID(SHEET_PAYMENT) + DebugViewC.shared.setSheetID(SHEET_PAYMENT, stack: stack.push()) } } } diff --git a/TalerWallet1/Views/Sheets/Refund/RefundURIView.swift b/TalerWallet1/Views/Sheets/Refund/RefundURIView.swift @@ -59,7 +59,7 @@ struct RefundURIView: View { } }.onAppear() { symLog.log("onAppear") - DebugViewC.shared.setSheetID(SHEET_REFUND) + DebugViewC.shared.setSheetID(SHEET_REFUND, stack: stack.push()) } } } diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift @@ -83,7 +83,7 @@ struct WithdrawAcceptDone: View { } }.onAppear() { symLog.log("onAppear") - DebugViewC.shared.setSheetID(SHEET_WITHDRAW_AUTHORIZE) + DebugViewC.shared.setSheetID(SHEET_WITHDRAW_AUTHORIZE, stack: stack.push()) } } } diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift @@ -133,7 +133,8 @@ struct WithdrawAcceptView: View { } .onAppear() { symLog.log("onAppear") - DebugViewC.shared.setSheetID(SHEET_WITHDRAW_ACCEPT) // 132 WithdrawAcceptView + DebugViewC.shared.setSheetID(SHEET_WITHDRAW_ACCEPT, // 132 WithdrawAcceptView + stack: stack.push()) } } else { // no exchange - should not happen #if DEBUG diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift @@ -70,7 +70,7 @@ struct WithdrawTOSView: View { } .onAppear() { if viewID > SHEET_WITHDRAWAL { - DebugViewC.shared.setSheetID(SHEET_WITHDRAW_TOS) + DebugViewC.shared.setSheetID(SHEET_WITHDRAW_TOS, stack: stack.push()) } else { DebugViewC.shared.setViewID(VIEW_WITHDRAW_TOS, stack: stack.push()) } diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift @@ -203,7 +203,7 @@ struct WithdrawURIView: View { } .onAppear() { symLog.log("onAppear") - DebugViewC.shared.setSheetID(SHEET_WITHDRAWAL) + DebugViewC.shared.setSheetID(SHEET_WITHDRAWAL, stack: stack.push()) } // agePicker.setAges(ages: details?.ageRestrictionOptions) }