commit 15318e9de14844a83155d0df8d353092ff53d8f6
parent d3b7f0bd794bcb9a45ab4bc8d7671af46da7c7df
Author: Marc Stibane <marc@taler.net>
Date: Sun, 15 Feb 2026 10:01:11 +0100
Report (DD82)
Diffstat:
2 files changed, 84 insertions(+), 0 deletions(-)
diff --git a/TalerWallet1/Views/Settings/ReportView.swift b/TalerWallet1/Views/Settings/ReportView.swift
@@ -0,0 +1,73 @@
+/*
+ * This file is part of GNU Taler, ©2022-25 Taler Systems S.A.
+ * See LICENSE.md
+ */
+/**
+ * @author Marc Stibane
+ */
+import SwiftUI
+import taler_swift
+import SymLog
+
+//let BACKUP = "Taler-"
+//let PREFIX = "file://"
+
+/// This view shows the list of backups
+struct ReportView: View {
+ private let symLog = SymLogV(0)
+ let stack: CallStack
+ let navTitle: String
+
+ @EnvironmentObject private var model: WalletModel
+ @EnvironmentObject private var controller: Controller
+ @AppStorage("minimalistic") var minimalistic: Bool = false
+ @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
+
+ @State private var creating: Bool = false
+ @State private var report: String = ""
+ @State private var expanded: Bool = false
+
+ private func createReport() {
+ creating = true
+ Task {
+ if let diagnostics = try? await model.getDiagnostics() {
+ report = diagnostics
+ }
+ }
+ }
+
+ 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 buttonTitle = String(localized: "Create Report", comment: "button")
+
+ let reportHint = Text("Tap 'Create Report' to build a report of your wallet's state, to help improve Taler...\nThis report will not enable the receiver to access your money.")
+
+ List {
+ Section {
+ if report.isEmpty {
+ reportHint
+ Button(buttonTitle) { createReport() }
+ .buttonStyle(TalerButtonStyle(type: .bordered, disabled: creating))
+ .padding()
+ } else {
+ Text(report)
+ .multilineTextAlignment(.leading)
+ .lineLimit(expanded ? nil : 3)
+ .onTapGesture {
+ expanded.toggle()
+ }
+ CopyShare(textToCopy: report, image: nil)
+ }
+ }
+ .listRowSeparator(.hidden)
+ }
+ .listStyle(myListStyle.style).anyView
+ .navigationTitle(navTitle)
+ .onAppear() {
+ DebugViewC.shared.setViewID(VIEW_BANK_ACCOUNTS, stack: stack.push())
+ }
+ } // body
+}
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -159,6 +159,17 @@ struct SettingsView: View {
description: hideDescriptions ? nil : String(localized: "Backup your money...")) {}
}
+ /// Report
+ let reportTitle = String(localized: "TitleReport", defaultValue: "Report diagnostics")
+ let reportDest = ReportView(stack: stack.push(reportTitle),
+ navTitle: reportTitle)
+ NavigationLink { // whole row like in a tableView
+ reportDest
+ } label: {
+ SettingsItem(name: reportTitle, id1: "report",
+ description: hideDescriptions ? nil : String(localized: "Help improve this app...")) {}
+ }
+
#if OIM
SettingsToggle(name: String(localized: "OIM: Euro"), value: $oimEuro, id1: "oimEuro",
description: minimalistic ? nil : String(localized: "OIM currency for KUDOS"))