gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 14/69: remove Apple Sounds


From: gnunet
Subject: [taler-taler-ios] 14/69: remove Apple Sounds
Date: Fri, 19 Jan 2024 09:01:47 +0100

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 eb9f01ffd059c91e2b3ce4e2443c38c52f53aa32
Author: Marc Stibane <marc@taler.net>
AuthorDate: Wed Jan 3 17:38:02 2024 +0100

    remove Apple Sounds
---
 TalerWallet1/Controllers/Controller.swift      |  3 ++-
 TalerWallet1/Helper/Controller+playSound.swift |  4 ++--
 TalerWallet1/Views/Main/MainView.swift         |  7 +++++--
 TalerWallet1/Views/Settings/SettingsView.swift | 14 ++++++++++++--
 4 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/TalerWallet1/Controllers/Controller.swift 
b/TalerWallet1/Controllers/Controller.swift
index c545f3c..cb24e39 100644
--- a/TalerWallet1/Controllers/Controller.swift
+++ b/TalerWallet1/Controllers/Controller.swift
@@ -37,7 +37,8 @@ class Controller: ObservableObject {
     @Published var backendState: BackendState = .none       // only used for 
launch animation
     @Published var currencyTicker: Int = 0                  // updates 
whenever a new currency is added
     @AppStorage("useHaptics") var useHaptics: Bool = true   // extension 
mustn't define this, so it must be here
-    @AppStorage("playSounds") var playSounds: Int = 1       // extension 
mustn't define this, so it must be here
+    @AppStorage("playSoundsI") var playSoundsI: Int = 1     // extension 
mustn't define this, so it must be here
+    @AppStorage("playSoundsB") var playSoundsB: Bool = true
     @AppStorage("talerFont") var talerFont: Int = 0         // extension 
mustn't define this, so it must be here
     let hapticCapability = CHHapticEngine.capabilitiesForHardware()
     let logger = Logger(subsystem: "net.taler.gnu", category: "Controller")
diff --git a/TalerWallet1/Helper/Controller+playSound.swift 
b/TalerWallet1/Helper/Controller+playSound.swift
index cad7b3b..8f83435 100644
--- a/TalerWallet1/Helper/Controller+playSound.swift
+++ b/TalerWallet1/Helper/Controller+playSound.swift
@@ -55,9 +55,9 @@ extension Controller {
             AudioServicesCreateSystemSoundID(fileURL as CFURL, &soundID)
             logger.log("\(sound, privacy: .public) \(soundID)")
         }
-        if number == 0 || number > 9 || playSounds < 0 {
+        if number == 0 || number > 9 || playSoundsI < 0 {
             AudioServicesPlaySystemSound(soundID);
-        } else if playSounds > 0 {
+        } else if playSoundsI > 0 && playSoundsB {
             if let url = Bundle.main.url(forResource: (number == 1) ? 
"payment_sent"
                                                                     : 
"payment_received",
                                        withExtension: "m4a") {
diff --git a/TalerWallet1/Views/Main/MainView.swift 
b/TalerWallet1/Views/Main/MainView.swift
index 108ea64..15d2510 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -23,7 +23,8 @@ struct MainView: View {
     @EnvironmentObject private var viewState: ViewState         // 
popToRootView()
     @EnvironmentObject private var controller: Controller
     @AppStorage("talerFont") var talerFont: Int = 0         // extension 
mustn't define this, so it must be here
-    @AppStorage("playSounds") var playSounds: Int = 1       // extension 
mustn't define this, so it must be here
+    @AppStorage("playSoundsI") var playSoundsI: Int = 1     // extension 
mustn't define this, so it must be here
+    @AppStorage("playSoundsB") var playSoundsB: Bool = true
 
     @State private var sheetPresented = false
     @State private var urlToOpen: URL? = nil
@@ -42,9 +43,11 @@ struct MainView: View {
                 // any change to rootViewId triggers popToRootView behaviour
                     .id(viewState.rootViewId)
                     .onAppear() {
-                        if playSounds != 0  && !soundPlayed {
+#if DEBUG
+                        if playSoundsI != 0  && playSoundsB && !soundPlayed {
                             controller.playSound(1008)     // Startup chime
                         }
+#endif
                         soundPlayed = true
                     }
             } else if controller.backendState == .error {
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift 
b/TalerWallet1/Views/Settings/SettingsView.swift
index 97ab20a..777bc3a 100644
--- a/TalerWallet1/Views/Settings/SettingsView.swift
+++ b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -29,7 +29,8 @@ struct SettingsView: View {
     @AppStorage("developerMode") var developerMode: Bool = false
 #endif
     @AppStorage("useHaptics") var useHaptics: Bool = true
-    @AppStorage("playSounds") var playSounds: Int = 1
+    @AppStorage("playSoundsI") var playSoundsI: Int = 1
+    @AppStorage("playSoundsB") var playSoundsB: Bool = true
     @AppStorage("talerFont") var talerFont: Int = 0
     @AppStorage("developDelay") var developDelay: Bool = false
     @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
@@ -113,11 +114,20 @@ struct SettingsView: View {
                             description: hideDescriptions ? nil : 
String(localized: "Vibration Feedback"))
                     .id("playHaptics")
                 }
-                SettingsSpeaker(name: String(localized: "Play Payment 
Sounds"), value: $playSounds,
+                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")
                 SettingsFont(title: String(localized: "Font:"), value: 
talerFont, action: redraw)
                     .id("font")
+                } else { playToggle }
+#else
+                playToggle
+#endif
                 SettingsStyle(title: String(localized: "Liststyle:"), 
myListStyle: $myListStyle)
                     .id("liststyle")
                 SettingsToggle(name: String(localized: "Minimalistic"), value: 
$iconOnly, id1: "minimal",

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