taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 29e3b6ed68b40860c42f3904565241a742105796
parent 0fe13be4c2db4d2919b18f391e596ce5cbe56501
Author: Marc Stibane <marc@taler.net>
Date:   Tue,  4 Jul 2023 16:26:15 +0200

reload Balances

Diffstat:
MTalerWallet1/Views/Balances/BalancesListView.swift | 18++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift b/TalerWallet1/Views/Balances/BalancesListView.swift @@ -131,7 +131,6 @@ extension BalancesListView { @Binding var summary: String var reloadAction: () async -> Int - @State private var shouldLoad = false var body: some View { #if DEBUG let _ = Self._printChanges() @@ -153,18 +152,13 @@ extension BalancesListView { } .listStyle(myListStyle.style).anyView } - .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(.BalanceChange) ==> shouldLoad = true") - shouldLoad = true + // 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() + } } } // body } // Content