[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 03/03: Tri-State-Observing
From: |
gnunet |
Subject: |
[taler-taler-ios] 03/03: Tri-State-Observing |
Date: |
Fri, 12 Apr 2024 23:35:28 +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.
commit b3c5196435ca8dd13fc82f2d32dba076dd9e5c16
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Apr 12 23:34:57 2024 +0200
Tri-State-Observing
---
TalerWallet1/Backend/WalletCore.swift | 18 +++++++++-----
TalerWallet1/Views/Settings/SettingsItem.swift | 4 ++-
TalerWallet1/Views/Settings/SettingsView.swift | 34 +++++++++-----------------
3 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/TalerWallet1/Backend/WalletCore.swift
b/TalerWallet1/Backend/WalletCore.swift
index f2b4f86..332216a 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -35,7 +35,7 @@ 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 isObserving: Int
var isLogging: Bool
let logger = Logger(subsystem: "net.taler.gnu", category: "WalletCore")
@@ -83,7 +83,7 @@ class WalletCore: QuickjsMessageHandler {
}
init() throws {
- isObserving = false
+ isObserving = 0
isLogging = false
logger.info("init Quickjs")
requestsMade = 0
@@ -304,12 +304,12 @@ extension WalletCore {
case Notification.Name.TaskObservabilityEvent.rawValue:
symLog.log(anyPayload)
if let json = anyPayload.toJSON() {
- observe(message: json)
+ observeJSON(message: json)
}
case Notification.Name.RequestObservabilityEvent.rawValue:
symLog.log(anyPayload)
if let json = anyPayload.toJSON() {
- observe(message: json)
+ observeJSON(message: json)
}
// TODO: remove these once wallet-core doesn't send them
anymore
@@ -333,9 +333,15 @@ print("\n❗️ WalletCore.swift:251 Notification: ",
anyPayload, "\n") /
consoleManager.print(message)
}
}
- @MainActor func observe(message: String) {
+ @MainActor func observeTriplet(message: String) {
let consoleManager = LCManager.shared
- if isObserving {
+ if isObserving != 0 {
+ consoleManager.print(message)
+ }
+ }
+ @MainActor func observeJSON(message: String) {
+ let consoleManager = LCManager.shared
+ if isObserving < 0 {
consoleManager.print(message)
}
}
diff --git a/TalerWallet1/Views/Settings/SettingsItem.swift
b/TalerWallet1/Views/Settings/SettingsItem.swift
index 2d2f952..b0e5407 100644
--- a/TalerWallet1/Views/Settings/SettingsItem.swift
+++ b/TalerWallet1/Views/Settings/SettingsItem.swift
@@ -149,15 +149,17 @@ struct SettingsSpeaker: View {
HStack {
Text(name)
.talerFont(.title2)
+ Spacer()
Text(verbatim: " ")
.talerFont(.largeTitle)
- .frame(maxWidth: .infinity, alignment: .trailing)
Button {
if value > 0 {
value = -1
+ action(value)
Controller.shared.playSound(1)
} else {
value = value + 1
+ action(value)
Controller.shared.playSound(value)
}
} label: {
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift
b/TalerWallet1/Views/Settings/SettingsView.swift
index aafe57e..0408f58 100644
--- a/TalerWallet1/Views/Settings/SettingsView.swift
+++ b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -40,7 +40,7 @@ struct SettingsView: View {
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
@AppStorage("minimalistic") var minimalistic: Bool = false
@AppStorage("localConsoleL") var localConsoleL: Bool = false
// for Logs
- @AppStorage("localConsoleO") var localConsoleO: Bool = false
// for Observability
+ @AppStorage("localConsoleO") var localConsoleO: Int = 0
// for Observability
@State private var checkDisabled = false
@State private var withDrawDisabled = false
@@ -118,37 +118,25 @@ struct SettingsView: View {
if controller.hapticCapability.supportsHaptics {
SettingsToggle(name: String(localized: "Haptics"), value:
$useHaptics, id1: "haptics",
description: hideDescriptions ? nil :
String(localized: "Vibration Feedback"))
- .id("playHaptics")
}
- let playToggle = SettingsToggle(name: String(localized: "Play
Payment Sounds"), value: $playSoundsB,
- description: hideDescriptions ? nil :
String(localized: "When a transaction finished"))
- .id("playSounds")
-#if DEBUG
- if Double.random(in: -100.0...100.0) > 0 {
- SettingsSpeaker(name: String(localized: "Play Payment
Sounds"), value: $playSoundsI,
- description: hideDescriptions ? nil :
String(localized: "When a transaction finished"))
- .id("playSounds")
- } else { playToggle }
-#else
- playToggle
-#endif
-// SettingsToggle(name: String(localized: "Increase Contrast"),
value: $increaseContrast, id1: "contrast",
-// description: hideDescriptions ? nil :
String(localized: "If you don't want to set it globally in Settings.app"))
-// .id("increaseContrast")
+ SettingsToggle(name: String(localized: "Play Payment Sounds"),
value: $playSoundsB, id1: "playSounds",
+ description: hideDescriptions ? nil :
String(localized: "When a transaction finished"))
SettingsToggle(name: String(localized: "Show Warnings"),
value: $shouldShowWarning, id1: "warnings",
description: hideDescriptions ? nil :
String(localized: "For Delete, Fail & Abort buttons"))
- .id("showWarnings")
// SettingsFont(title: String(localized: "Font:"), value:
talerFontIndex, action: redraw)
// .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) {
+// SettingsToggle(name: observability, value:
$localConsoleO.onChange({ isObserving in
+// walletCore.isObserving = isObserving}), id1:
"localConsoleO",
+// description: hideDescriptions ? nil :
localConsStr) {
+ SettingsSpeaker(name: observability, value:
$localConsoleO.onChange({ isObserving in
+ walletCore.isObserving = isObserving}),
+ description: hideDescriptions ? nil :
localConsStr) { isObserving in
let consoleManager = LCManager.shared
- consoleManager.isVisible = localConsoleO || localConsoleL
+ consoleManager.isVisible = localConsoleO != 0 ||
localConsoleL
consoleManager.clear()
}
if diagnosticModeEnabled {
@@ -157,7 +145,7 @@ struct SettingsView: View {
walletCore.isLogging = isLogging}), id1:
"localConsoleL",
description: hideDescriptions ? nil :
localConsStr) {
let consoleManager = LCManager.shared
- consoleManager.isVisible = localConsoleO ||
localConsoleL
+ consoleManager.isVisible = localConsoleO != 0 ||
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.