[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 27/35: Postpone update until onAppear
From: |
gnunet |
Subject: |
[taler-taler-ios] 27/35: Postpone update until onAppear |
Date: |
Thu, 27 Jul 2023 09:10:00 +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 73dc3c18fc5d571d68d45d939803afaeab53d8a0
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Jul 25 16:31:16 2023 +0200
Postpone update until onAppear
---
TalerWallet1/Views/Balances/BalancesListView.swift | 23 +++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift
b/TalerWallet1/Views/Balances/BalancesListView.swift
index 00c65c9..d1b31d2 100644
--- a/TalerWallet1/Views/Balances/BalancesListView.swift
+++ b/TalerWallet1/Views/Balances/BalancesListView.swift
@@ -130,6 +130,9 @@ extension BalancesListView {
@Binding var summary: String
var reloadAction: () async -> Int
+ @State private var isActive = true
+ @State private var shouldReload = false
+
var body: some View {
#if DEBUG
let _ = Self._printChanges()
@@ -151,12 +154,26 @@ extension BalancesListView {
}
.listStyle(myListStyle.style).anyView
}
+ .onAppear() {
+ isActive = true
+ if shouldReload {
+ shouldReload = false
+ symLog?.log(".onAppear ==> shouldReload was true,
reloading now")
+ Task { await reloadAction() }
+ }
+ }
+ .onDisappear() {
+ isActive = false
+ }
.onNotification(.BalanceChange) { notification in
// reload balances on receiving BalanceChange notification ...
// doesn't need to be received on main thread because we just
reload in a background task anyway
- symLog?.log(".onNotification(.BalanceChange) ==> reload")
- Task {
- await reloadAction()
+ if isActive {
+ symLog?.log(".onNotification(.BalanceChange) ==> reload")
+ Task { await reloadAction() }
+ } else {
+ symLog?.log(".onNotification(.BalanceChange) ==> reload
postponed, shouldReload = true")
+ shouldReload = true
}
}
} // body
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 09/35: localizations, wording, (continued)
- [taler-taler-ios] 09/35: localizations, wording, gnunet, 2023/07/27
- [taler-taler-ios] 08/35: iOS 15: show ToS, gnunet, 2023/07/27
- [taler-taler-ios] 11/35: monospacedDigit, gnunet, 2023/07/27
- [taler-taler-ios] 07/35: iOS: bump version to 0.9.3 (15), gnunet, 2023/07/27
- [taler-taler-ios] 04/35: Settings: Reset wallet, gnunet, 2023/07/27
- [taler-taler-ios] 18/35: Expiration Constants, gnunet, 2023/07/27
- [taler-taler-ios] 19/35: Move Status to top, gnunet, 2023/07/27
- [taler-taler-ios] 25/35: Simplified, gnunet, 2023/07/27
- [taler-taler-ios] 12/35: PayTo URL listRowSeparator, gnunet, 2023/07/27
- [taler-taler-ios] 14/35: Sound for Expired, gnunet, 2023/07/27
- [taler-taler-ios] 27/35: Postpone update until onAppear,
gnunet <=
- [taler-taler-ios] 31/35: Expired, pending, gnunet, 2023/07/27
- [taler-taler-ios] 35/35: iOS: bump version to 0.9.3 (16), gnunet, 2023/07/27
- [taler-taler-ios] 22/35: extension TransactionsListView.Content => TransactionsRowsView, gnunet, 2023/07/27
- [taler-taler-ios] 21/35: fanblades.slash and clock.badge.xmark not in iOS 15, gnunet, 2023/07/27
- [taler-taler-ios] 13/35: SendDone, gnunet, 2023/07/27
- [taler-taler-ios] 17/35: Warnings and hints no longer use "coins", gnunet, 2023/07/27
- [taler-taler-ios] 26/35: debug, cleanup, gnunet, 2023/07/27
- [taler-taler-ios] 30/35: small fixes, gnunet, 2023/07/27
- [taler-taler-ios] 32/35: TransactionDetailView, gnunet, 2023/07/27
- [taler-taler-ios] 16/35: rendering on small screens, gnunet, 2023/07/27