commit 9c67c1200cc3badecbaed4e8f74f3d4a0209fb06
parent b84cd21b301a5b6980458b3b2b3afa38898a7158
Author: Marc Stibane <marc@taler.net>
Date: Sun, 30 Mar 2025 21:50:41 +0200
refreshable
Diffstat:
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift b/TalerWallet1/Views/Balances/BalancesListView.swift
@@ -27,6 +27,12 @@ struct BalancesListView: View {
private static func className() -> String {"\(self)"}
+ func refresh() async {
+ controller.hapticNotification(.success)
+ symLog.log("refreshing balances")
+ await controller.loadBalances(stack.push("refreshing balances"), model)
+ }
+
var body: some View {
#if PRINT_CHANGES
let _ = Self._printChanges()
@@ -36,6 +42,9 @@ struct BalancesListView: View {
let count = controller.balances.count
if controller.balances.isEmpty {
WalletEmptyView(stack: stack.push("isEmpty"))
+ .refreshable {
+ await refresh()
+ }
} else {
List(controller.balances, id: \.self) { balance in
BalancesSectionView(stack: stack.push("\(balance.scopeInfo.currency)"),
@@ -51,6 +60,9 @@ struct BalancesListView: View {
selectedBalance = nil
}
.listStyle(myListStyle.style).anyView
+ .refreshable {
+ await refresh()
+ }
.fullScreenCover(isPresented: $controller.oimModeActive) {
let balance = controller.balances.first
let currency = sierraLeone ? OIMleones : OIMeuros
@@ -63,10 +75,5 @@ struct BalancesListView: View {
}
}
}
- .refreshable { // already async
- controller.hapticNotification(.success)
- symLog.log("refreshing balances")
- await controller.loadBalances(stack.push("refreshing balances"), model)
- }
}
}