commit 4eea188fbd2c8b0d90c7d4a22017361d9400afe7
parent 17e0e92b012c3fe08c6bb58b3f3044fe0df93d58
Author: Marc Stibane <marc@taler.net>
Date: Thu, 8 Feb 2024 17:51:37 +0100
use ScopeInfo
Diffstat:
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -59,7 +59,8 @@ extension BalancesSectionView: View {
let _ = Self._printChanges()
let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear
#endif
- let currency = balance.scopeInfo.currency
+ let scopeInfo = balance.scopeInfo
+ let currency = scopeInfo.currency
let currencyInfo = controller.info(for: currency)
Section {
@@ -100,7 +101,7 @@ extension BalancesSectionView: View {
.padding(.leading, ICONLEADING)
}
} header: {
- BarGraphHeader(stack: stack.push(), currency: currency,
+ BarGraphHeader(stack: stack.push(), scopeInfo: scopeInfo,
currencyName: currencyInfo?.scope.currency ?? currency,
shouldReloadBalances: $shouldReloadBalances)
}.id(sectionID)
diff --git a/TalerWallet1/Views/Banking/ExchangeSectionView.swift b/TalerWallet1/Views/Banking/ExchangeSectionView.swift
@@ -47,7 +47,7 @@ struct ExchangeSectionView: View {
.padding(.top)
}
} header: {
- BarGraphHeader(stack: stack.push(), currency: currency, currencyName: currencyName,
+ BarGraphHeader(stack: stack.push(), scopeInfo: nil, currencyName: currencyName,
shouldReloadBalances: $shouldReloadBalances)
}
}
diff --git a/TalerWallet1/Views/HelperViews/BarGraph.swift b/TalerWallet1/Views/HelperViews/BarGraph.swift
@@ -10,7 +10,7 @@ let MAXBARS = 10
struct BarGraphHeader: View {
private let symLog = SymLogV(0)
let stack: CallStack
- let currency: String
+ let scopeInfo: ScopeInfo?
let currencyName: String
@Binding var shouldReloadBalances: Int
@@ -25,15 +25,20 @@ struct BarGraphHeader: View {
Text(currencyName)
.accessibilityFont(.title2)
// .foregroundColor(colorSchemeContrast == .increased ? .primary : .secondary)
- BarGraph(transactions: $completedTransactions,
- maxBars: MAXBARS, barHeight: barHeight)
+ if let scopeInfo {
+ BarGraph(transactions: $completedTransactions,
+ maxBars: MAXBARS, barHeight: barHeight)
+ }
}
.task(id: shouldReloadBalances + 2_000_000) {
- symLog.log(".task for BarGraphHeader(\(currency)) - reload Transactions")
- // TODO: only load the 10 most recent transactions
- let response = await model.transactionsT(stack.push(".task - reload Transactions for \(currency)"),
- currency: currency)
- completedTransactions = WalletModel.completedTransactions(response)
+ if let scopeInfo {
+ symLog.log(".task for BarGraphHeader(\(scopeInfo.currency)) - reload Transactions")
+ // TODO: only load the 10 most recent transactions
+ let response = await model.transactionsT(stack.push(".task - reload Transactions for \(scopeInfo.currency)"),
+// scopeInfo: scopeInfo)
+ currency: scopeInfo.currency)
+ completedTransactions = WalletModel.completedTransactions(response)
+ }
}
}
}