gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] branch master updated: Add Observability to LocalConso


From: gnunet
Subject: [taler-taler-ios] branch master updated: Add Observability to LocalConsole
Date: Fri, 05 Apr 2024 23:12:31 +0200

This is an automated email from the git hooks/post-receive script.

marc-stibane pushed a commit to branch master
in repository taler-ios.

The following commit(s) were added to refs/heads/master by this push:
     new 63cd160  Add Observability to LocalConsole
63cd160 is described below

commit 63cd1609f24380f36558d50bb73881bec1fc222b
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Apr 5 23:12:16 2024 +0200

    Add Observability to LocalConsole
---
 TalerWallet1/Backend/WalletCore.swift          | 12 +++++++++++-
 TalerWallet1/Views/Settings/SettingsView.swift | 20 ++++++++++++++++----
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/TalerWallet1/Backend/WalletCore.swift 
b/TalerWallet1/Backend/WalletCore.swift
index ba00ead..8952261 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -31,6 +31,8 @@ class WalletCore: QuickjsMessageHandler {
 
     var versionInfo: VersionInfo?           // shown in SettingsView
     var developDelay: Bool?                 // if set in SettingsView will 
delay wallet-core after each action
+    var isObserving: Bool
+    var isLogging: Bool
     let logger = Logger(subsystem: "net.taler.gnu", category: "WalletCore")
 
     private struct FullRequest: Encodable {
@@ -77,6 +79,8 @@ class WalletCore: QuickjsMessageHandler {
     }
 
     init() throws {
+        isObserving = false
+        isLogging = false
         logger.info("init Quickjs")
         requestsMade = 0
         queue = DispatchQueue(label: "net.taler.myQueue", attributes: 
.concurrent)
@@ -307,7 +311,13 @@ print("\n❗️ WalletCore.swift:251 Notification: ", 
anyPayload, "\n")        /
 
     @MainActor func handleLog(message: String) {
         let consoleManager = LCManager.shared
-        if consoleManager.isVisible {
+        if isLogging {
+            consoleManager.print(message)
+        }
+    }
+    @MainActor func observe(message: String) {
+        let consoleManager = LCManager.shared
+        if isObserving {
             consoleManager.print(message)
         }
     }
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift 
b/TalerWallet1/Views/Settings/SettingsView.swift
index 8174f82..37ec955 100644
--- a/TalerWallet1/Views/Settings/SettingsView.swift
+++ b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -39,7 +39,8 @@ struct SettingsView: View {
     @AppStorage("developDelay") var developDelay: Bool = false
     @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
     @AppStorage("minimalistic") var minimalistic: Bool = false
-    @AppStorage("localConsole") var localConsole: Bool = false
+    @AppStorage("localConsoleL") var localConsoleL: Bool = false               
 // for Logs
+    @AppStorage("localConsoleO") var localConsoleO: Bool = false               
 // for Observability
 
     @State private var checkDisabled = false
     @State private var withDrawDisabled = false
@@ -145,11 +146,22 @@ struct SettingsView: View {
 //                    .id("font")
                 SettingsStyle(title: String(localized: "Liststyle:"), 
myListStyle: $myListStyle)
                     .id("liststyle")
+                let localConsStr = String(localized: "on LocalConsole")
+                let observability = String(localized: "Observability")
+                SettingsToggle(name: observability, value: 
$localConsoleO.onChange({ isObserving in
+                    walletCore.isObserving = isObserving}), id1: 
"localConsoleO",
+                               description: hideDescriptions ? nil : 
localConsStr) {
+                    let consoleManager = LCManager.shared
+                    consoleManager.isVisible = localConsoleO || localConsoleL
+                    consoleManager.clear()
+                }
                 if diagnosticModeEnabled {
-                    SettingsToggle(name: String(localized: "LocalConsole"), 
value: $localConsole, id1: "localConsole",
-                                   description: hideDescriptions ? nil : 
String(localized: "Show logs")) {
+                    let showLogs = String(localized: "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 = localConsole
+                        consoleManager.isVisible = localConsoleO || 
localConsoleL
                         consoleManager.clear()
                     }
                     SettingsToggle(name: String("Developer Mode"), value: 
$developerMode, id1: "devMode",

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