[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 11/17: Prepare notification error handling
From: |
gnunet |
Subject: |
[taler-taler-ios] 11/17: Prepare notification error handling |
Date: |
Thu, 11 Apr 2024 23:13:43 +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 7cecef9af7fac6be732c7983f34fd3ca0fcc4200
Author: Iván Ávalos <avalos@disroot.org>
AuthorDate: Fri Mar 22 11:20:32 2024 -0600
Prepare notification error handling
---
TalerWallet1/Backend/WalletCore.swift | 6 ++++++
TalerWallet1/Controllers/PublicConstants.swift | 3 +++
TalerWallet1/Model/Transaction.swift | 1 +
TalerWallet1/Views/Main/MainView.swift | 8 ++++++++
4 files changed, 18 insertions(+)
diff --git a/TalerWallet1/Backend/WalletCore.swift
b/TalerWallet1/Backend/WalletCore.swift
index 20c614f..37fe22d 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -197,6 +197,11 @@ extension WalletCore {
logger.info("No State change: \(decoded.transactionId,
privacy: .private(mask: .hash))")
return
}
+
+ if decoded.errorInfo == nil {
+ postNotification(.Error, userInfo: [NOTIFICATIONERROR:
decoded.errorInfo])
+ }
+
let components = decoded.transactionId.components(separatedBy: ":")
if components.count >= 3 { // txn:$txtype:$uid
if let type = TransactionType(rawValue: components[1]) {
@@ -307,6 +312,7 @@ print("\n❗️ WalletCore.swift:251 Notification: ",
anyPayload, "\n") /
}
} catch let error {
symLog.log("Error \(error) parsing notification: \(anyPayload)")
// TODO: .error
+ postNotification(.Error, userInfo: [NOTIFICATIONERROR: error])
// TODO: if DevMode then should log into file for user
}
}
diff --git a/TalerWallet1/Controllers/PublicConstants.swift
b/TalerWallet1/Controllers/PublicConstants.swift
index 2eb2ad8..5b563d0 100644
--- a/TalerWallet1/Controllers/PublicConstants.swift
+++ b/TalerWallet1/Controllers/PublicConstants.swift
@@ -59,6 +59,8 @@ public let TALERURI = "talerUri"
public let TRANSACTIONTRANSITION = "transactionTransition"
public let TRANSACTIONID = "transactionID"
+public let NOTIFICATIONERROR = "error"
+
/// Notifications sent by wallet-core
extension Notification.Name {
static let BalanceChange = Notification.Name("balance-change")
@@ -79,6 +81,7 @@ extension Notification.Name {
// static let PayOperationSuccess =
Notification.Name("pay-operation-success")
static let ProposalAccepted = Notification.Name("proposal-accepted")
static let ProposalDownloaded = Notification.Name("proposal-downloaded")
+ static let Error = Notification.Name("error")
}
/// Notifications for internal synchronization
diff --git a/TalerWallet1/Model/Transaction.swift
b/TalerWallet1/Model/Transaction.swift
index dc2d7a6..85ed2d3 100644
--- a/TalerWallet1/Model/Transaction.swift
+++ b/TalerWallet1/Model/Transaction.swift
@@ -142,6 +142,7 @@ struct TransactionTransition: Codable { //
Notification
var newTxState: TransactionState
var transactionId: String
var experimentalUserData: String? // KYC
+ var errorInfo: WalletBackendResponseError?
}
enum TxAction: String, Codable {
diff --git a/TalerWallet1/Views/Main/MainView.swift
b/TalerWallet1/Views/Main/MainView.swift
index 168b548..d9f6af1 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -260,6 +260,12 @@ extension MainView {
shouldReloadBalances += 1
selectedTab = .balances
}
+ .onNotification(.Error) { notification in
+ if let error = notification.userInfo?[NOTIFICATIONERROR] as?
Error {
+ model.showError(.error(error))
+ controller.playSound(0)
+ }
+ }
.onChange(of: balances) { newArray in
for balance in newArray {
let scope = balance.scopeInfo
@@ -270,6 +276,8 @@ extension MainView {
await controller.setInfo(info)
} catch { // TODO: error handling - couldn't
get CurrencyInfo
logger.error("Couldn't get info for:
\(scope.currency, privacy: .public)\n\(error)")
+ model.showError(.error(error))
+ controller.playSound(0)
}
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (c38068b -> 6b94fe0), gnunet, 2024/04/11
- [taler-taler-ios] 02/17: Bump version to 0.9.6 (1), gnunet, 2024/04/11
- [taler-taler-ios] 03/17: updateExchangeEntry (temporarily) back to exchangeBaseUrl (instead of scopeInfo), gnunet, 2024/04/11
- [taler-taler-ios] 06/17: clientCancellationId, gnunet, 2024/04/11
- [taler-taler-ios] 07/17: Laying the foundations of improved error handling, gnunet, 2024/04/11
- [taler-taler-ios] 04/17: emitObservabilityEvents, gnunet, 2024/04/11
- [taler-taler-ios] 05/17: symLog after quickjs.sendMessage returned, gnunet, 2024/04/11
- [taler-taler-ios] 01/17: rename setConfig, gnunet, 2024/04/11
- [taler-taler-ios] 11/17: Prepare notification error handling,
gnunet <=
- [taler-taler-ios] 13/17: Fixes for error handling rebase, gnunet, 2024/04/11
- [taler-taler-ios] 09/17: Implement error handling all around (+refactoring), gnunet, 2024/04/11
- [taler-taler-ios] 08/17: Improve errors and move them to WalletModel, gnunet, 2024/04/11
- [taler-taler-ios] 15/17: cleanup, gnunet, 2024/04/11
- [taler-taler-ios] 14/17: catch WalletBackendError.walletCoreError, gnunet, 2024/04/11
- [taler-taler-ios] 16/17: error handling, logging, gnunet, 2024/04/11
- [taler-taler-ios] 17/17: Bump version to 0.9.7 (1), gnunet, 2024/04/11
- [taler-taler-ios] 12/17: Centralize all error handling in the model, gnunet, 2024/04/11
- [taler-taler-ios] 10/17: Improvements to error dialog, gnunet, 2024/04/11