commit 76b66a4ce869b476421041a964454d1ae610734b parent 01726cada2e886147be614e59d837807da357d08 Author: Marc Stibane <marc@taler.net> Date: Mon, 24 Jul 2023 16:05:01 +0200 Sound for Expired Diffstat:
| M | TalerWallet1/Backend/WalletCore.swift | | | 15 | +++++++++------ |
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/TalerWallet1/Backend/WalletCore.swift b/TalerWallet1/Backend/WalletCore.swift @@ -186,16 +186,19 @@ extension WalletCore { do { let decoded = try JSONDecoder().decode(TransactionTransition.self, from: jsonData) if decoded.newTxState != decoded.oldTxState { - if decoded.newTxState.major == .done { - let components = decoded.transactionId.components(separatedBy: [":"]) - if components.count >= 3 { // txn:$txtype:$uid - if let type = TransactionType(rawValue: components[1]) { + let components = decoded.transactionId.components(separatedBy: [":"]) + if components.count >= 3 { // txn:$txtype:$uid + if let type = TransactionType(rawValue: components[1]) { + guard type != .refresh else { return } + if decoded.newTxState.major == .done { Controller.shared.playSound(type.isIncoming ? 2 : 1) + } else if decoded.newTxState.major == .expired { + Controller.shared.playSound(0) } + postNotification(.TransactionStateTransition, + userInfo: [TRANSACTIONTRANSITION: decoded]) } } - postNotification(.TransactionStateTransition, - userInfo: [TRANSACTIONTRANSITION: decoded]) } } catch { // rethrows symLog.log(jsonData) // TODO: .error