[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 24/54: balance-change
From: |
gnunet |
Subject: |
[taler-taler-ios] 24/54: balance-change |
Date: |
Fri, 30 Jun 2023 22:33:56 +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 8edd36d8c090ebb67c7ec72988d8fe65228cd6c4
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Jun 27 14:20:34 2023 +0200
balance-change
---
TalerWallet1/Backend/WalletCore.swift | 3 ++-
TalerWallet1/Controllers/PublicConstants.swift | 1 +
TalerWallet1/Views/Balances/BalancesListView.swift | 17 +++++++++++++----
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/TalerWallet1/Backend/WalletCore.swift
b/TalerWallet1/Backend/WalletCore.swift
index 06e60fb..48ec604 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -202,6 +202,8 @@ print("\n❗️ \(pendingOp): \(id)\n") // this is a new
pendingOp I have
try handleStateTransition(jsonData)
case Notification.Name.PendingOperationProcessed.rawValue:
try handlePendingProcessed(payload)
+ case Notification.Name.BalanceChange.rawValue:
+ postNotification(.BalanceChange)
case Notification.Name.ExchangeAdded.rawValue:
postNotification(.ExchangeAdded)
case Notification.Name.ReserveNotYetFound.rawValue:
@@ -224,7 +226,6 @@ print("\n❗️ \(pendingOp): \(id)\n") // this is a new
pendingOp I have
// "pay-operation-success",
// "withdrawal-group-bank-confirmed", // replaced
by transaction-state-transition
// "withdrawal-group-reserve-ready",
-// "coin-withdrawn", // totally
useless since wallet-core handles coins in bulk
// "waiting-for-retry", // Bla Bla
Bla
case "refresh-started", "refresh-melted",
"refresh-revealed", "refresh-unwarranted":
diff --git a/TalerWallet1/Controllers/PublicConstants.swift
b/TalerWallet1/Controllers/PublicConstants.swift
index 3a117ff..99e1f46 100644
--- a/TalerWallet1/Controllers/PublicConstants.swift
+++ b/TalerWallet1/Controllers/PublicConstants.swift
@@ -28,6 +28,7 @@ public let TALERURI = "talerUri"
public let TRANSACTIONTRANSITION = "transactionTransition"
extension Notification.Name {
+ static let BalanceChange = Notification.Name("balance-change")
static let TransactionStateTransition =
Notification.Name(TransactionTransition.TransitionType.transition.rawValue)
static let ExchangeAdded = Notification.Name("exchange-added")
static let PendingOperationProcessed =
Notification.Name("pending-operation-processed")
diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift
b/TalerWallet1/Views/Balances/BalancesListView.swift
index 09a0119..cd6022e 100644
--- a/TalerWallet1/Views/Balances/BalancesListView.swift
+++ b/TalerWallet1/Views/Balances/BalancesListView.swift
@@ -110,6 +110,7 @@ extension BalancesListView {
@Binding var summary: String
var reloadAction: () async -> Void
+ @State private var shouldLoad = false
var body: some View {
#if DEBUG
let _ = Self._printChanges()
@@ -124,14 +125,22 @@ extension BalancesListView {
.refreshable {
symLog?.log("refreshing")
await reloadAction() // this closure is already
async, no need for a Task
+ // TODO: reload transactions
}
.listStyle(myListStyle.style).anyView
}
- // automatically fetch balances after receiving
transaction-state-transition ...
- .onNotification(.TransactionStateTransition) { notification in
+ .onAppear {
+ if shouldLoad {
+ shouldLoad = false
+ symLog?.log(".onAppear: shouldLoad ==> reloading balances")
+ Task { await reloadAction() }
+ }
+ }
+ // automatically reload balances after receiving BalanceChange
notification ...
+ .onNotification(.BalanceChange) { notification in
// doesn't need to be received on main thread because we just
reload in the background anyway
- symLog?.log(".onNotification(.TransactionStateTransition) ==>
reloading balances")
- Task { await reloadAction() }
+ symLog?.log(".onNotification(.BalanceChange) ==> shouldLoad =
true")
+ shouldLoad = true
}
} // body
} // Content
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 31/54: bump Testflight version, (continued)
- [taler-taler-ios] 31/54: bump Testflight version, gnunet, 2023/06/30
- [taler-taler-ios] 37/54: Decodable, gnunet, 2023/06/30
- [taler-taler-ios] 29/54: Model cleanup, gnunet, 2023/06/30
- [taler-taler-ios] 36/54: playSound, gnunet, 2023/06/30
- [taler-taler-ios] 44/54: BalanceReloaded, gnunet, 2023/06/30
- [taler-taler-ios] 35/54: developerMode, gnunet, 2023/06/30
- [taler-taler-ios] 45/54: TransactionDetails, gnunet, 2023/06/30
- [taler-taler-ios] 39/54: Scrollview, gnunet, 2023/06/30
- [taler-taler-ios] 25/54: failTransaction, gnunet, 2023/06/30
- [taler-taler-ios] 23/54: Remove old view, gnunet, 2023/06/30
- [taler-taler-ios] 24/54: balance-change,
gnunet <=
- [taler-taler-ios] 47/54: #available(iOS 17.0, *) only with Xcode 15, gnunet, 2023/06/30
- [taler-taler-ios] 46/54: ThreeAmountsSheet, gnunet, 2023/06/30
- [taler-taler-ios] 51/54: remove debugging, gnunet, 2023/06/30
- [taler-taler-ios] 22/54: cleaned up P2P, gnunet, 2023/06/30
- [taler-taler-ios] 54/54: iOS: bump version to 0.9.3 (10), gnunet, 2023/06/30
- [taler-taler-ios] 49/54: ScrollViewReader, gnunet, 2023/06/30
- [taler-taler-ios] 50/54: withdrawalAmountDetails, gnunet, 2023/06/30
- [taler-taler-ios] 48/54: Demo Shop, reloading, gnunet, 2023/06/30
- [taler-taler-ios] 52/54: playSound, gnunet, 2023/06/30
- [taler-taler-ios] 53/54: ScrollViewReader needs Spacers if too few items, gnunet, 2023/06/30