commit b106e62f00652b885055e0683947d56e87573618
parent 21adf705e8df03274d12cd4193b3248f977ac08b
Author: Marc Stibane <marc@taler.net>
Date: Fri, 4 Oct 2024 17:00:23 +0200
use transactionsT2
Diffstat:
2 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -60,31 +60,35 @@ struct BalancesSectionView {
@State private var shownSectionID = UUID() // guaranteed to be different the first time
func loadRecent(_ stack: CallStack) async -> () {
- if let transactions = try? await model.transactionsT(stack.push(),
- scopeInfo: balance.scopeInfo,
-// filterByState: .done, // TODO: .done
- includeRefreshes: false) {
- let recent = WalletModel.completedTransactions(transactions)
- // TODO: only load the MAXRECENT most recent transactions
- let slice = recent.prefix(MAXRECENT) // already sorted
- withAnimation { recentTransactions = Array(slice) }
+ if let transactions = try? await model.transactionsT2(stack.push("loadRecent - \(balance.scopeInfo.url?.trimURL)"),
+ scopeInfo: balance.scopeInfo,
+ filterByState: .final,
+ limit: MAXRECENT,
+ includeRefreshes: false) {
+// let recent = WalletModel.completedTransactions(transactions)
+// let slice = recent.prefix(MAXRECENT) // already sorted
+// withAnimation { recentTransactions = Array(slice) }
+ withAnimation { recentTransactions = transactions }
}
}
func loadCompleted(_ stack: CallStack) async -> () {
- if let transactions = try? await model.transactionsT(stack.push(),
- scopeInfo: balance.scopeInfo,
-// filterByState: .final, // TODO: .final
+ if let transactions = try? await model.transactionsT2(stack.push("loadCompleted - \(balance.scopeInfo.url?.trimURL)"),
+ scopeInfo: balance.scopeInfo,
+ filterByState: .final,
includeRefreshes: developerMode) {
- let completed = WalletModel.completedTransactions(transactions)
- withAnimation { completedTransactions = completed }
+// let completed = WalletModel.completedTransactions(transactions)
+// withAnimation { completedTransactions = completed }
+ withAnimation { completedTransactions = transactions }
}
}
func loadPending(_ stack: CallStack) async -> () {
- if let transactions = try? await model.transactionsT(stack.push(),
- scopeInfo: balance.scopeInfo,
- filterByState: .nonfinal,
- includeRefreshes: developerMode) {
- withAnimation { pendingTransactions = WalletModel.pendingTransactions(transactions) }
+ if let transactions = try? await model.transactionsT2(stack.push("loadPending - \(balance.scopeInfo.url?.trimURL)"),
+ scopeInfo: balance.scopeInfo,
+ filterByState: .nonfinal,
+ includeRefreshes: developerMode) {
+// let pending = WalletModel.pendingTransactions(transactions)
+// withAnimation { pendingTransactions = pending }
+ withAnimation { pendingTransactions = transactions }
}
}
}
diff --git a/TalerWallet1/Views/HelperViews/BarGraph.swift b/TalerWallet1/Views/HelperViews/BarGraph.swift
@@ -41,8 +41,10 @@ struct BarGraphHeader: View {
if let scopeInfo {
symLog.log(".task for BarGraphHeader(\(scopeInfo.currency)) - reload Transactions")
// TODO: only load the 10 most recent transactions
- if let response = try? await model.transactionsT(stack.push(".task - reload Transactions for \(scopeInfo.currency)"),
- scopeInfo: scopeInfo) {
+ if let response = try? await model.transactionsT2(stack.push("BarGraphHeader - \(scopeInfo.url?.trimURL)"),
+ scopeInfo: scopeInfo,
+ filterByState: .done,
+ limit: MAXBARS) {
completedTransactions = WalletModel.completedTransactions(response)
}
}