gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 07/12: don't beep twice for expirations


From: gnunet
Subject: [taler-taler-ios] 07/12: don't beep twice for expirations
Date: Sun, 29 Sep 2024 10:14:23 +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 8b3ce5531cb69b4dc897bf5c226a8ab2a7830a43
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Sep 28 09:17:54 2024 +0200

    don't beep twice for expirations
---
 TalerWallet1/Backend/WalletCore.swift | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/TalerWallet1/Backend/WalletCore.swift 
b/TalerWallet1/Backend/WalletCore.swift
index ceaf583..bcf1011 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -39,6 +39,8 @@ class WalletCore: QuickjsMessageHandler {
     var isLogging: Bool
     let logger = Logger(subsystem: "net.taler.gnu", category: "WalletCore")
 
+    private var expired: [String] = []      // save txID of expired items to 
not beep twice
+
     private struct FullRequest: Encodable {
         let operation: String
         let id: UInt
@@ -225,7 +227,12 @@ extension WalletCore {
                             if let newMinor {
                                 if newMinor == .refreshExpired {
                                     logger.warning("RefreshExpired: 
\(decoded.transactionId, privacy: .private(mask: .hash))")
-                                    Controller.shared.playSound(0)
+                                    if let index = expired.firstIndex(of: 
components[2]) {
+                                        expired.remove(at: index)              
 // don't beep twice
+                                    } else {
+                                        expired.append(components[2])
+                                        Controller.shared.playSound(0)         
 // beep at first sight
+                                    }
                                     postNotification(.TransactionExpired, 
userInfo: [TRANSACTIONTRANSITION: decoded])
                                     return
                                 }
@@ -234,9 +241,13 @@ extension WalletCore {
                             postNotification(.TransactionStateTransition, 
userInfo: [TRANSACTIONTRANSITION: decoded])
                         case .expired:
                             logger.warning("Expired: \(decoded.transactionId, 
privacy: .private(mask: .hash))")
-                            Controller.shared.playSound(0)
+                            if let index = expired.firstIndex(of: 
components[2]) {
+                                expired.remove(at: index)                      
 // don't beep twice
+                            } else {
+                                expired.append(components[2])
+                                Controller.shared.playSound(0)                 
 // beep at first sight
+                            }
                             postNotification(.TransactionExpired, userInfo: 
[TRANSACTIONTRANSITION: decoded])
-                            return
                         case .pending:
                             if let newMinor {
                                 if newMinor == .ready {

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