[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 29/35: show up to 3 transactions in Balances
From: |
gnunet |
Subject: |
[taler-taler-ios] 29/35: show up to 3 transactions in Balances |
Date: |
Thu, 27 Jul 2023 09:10:02 +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 a2f80815c7baf4dcada9b1b68d913978431f36b7
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Jul 25 16:35:50 2023 +0200
show up to 3 transactions in Balances
---
TalerWallet1/Views/Balances/BalancesListView.swift | 4 ++-
.../Views/Balances/BalancesSectionView.swift | 29 +++++++++++++++++++++-
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift
b/TalerWallet1/Views/Balances/BalancesListView.swift
index d1b31d2..de41025 100644
--- a/TalerWallet1/Views/Balances/BalancesListView.swift
+++ b/TalerWallet1/Views/Balances/BalancesListView.swift
@@ -10,7 +10,7 @@ import AVFoundation
/// This view shows the list of balances / currencies, each in its own section
struct BalancesListView: View {
- private let symLog = SymLogV(0)
+ private let symLog = SymLogV()
let navTitle: String
let hamburgerAction: () -> Void
@@ -139,8 +139,10 @@ extension BalancesListView {
let _ = symLog?.vlog() // just to get the # to compare it
with .onAppear & onDisappear
#endif
Group { // necessary for .backslide transition (bug in SwiftUI)
+ let count = balances.count
List(balances, id: \.self) { balance in
BalancesSectionView(balance: balance,
+ sectionCount: count,
centsToTransfer: $centsToTransfer,
summary: $summary)
}
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index 655bb9a..6cf640c 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -16,7 +16,8 @@ import SymLog
struct BalancesSectionView: View {
private let symLog = SymLogV()
- var balance:Balance
+ let balance: Balance
+ let sectionCount: Int
@Binding var centsToTransfer: UInt64
@Binding var summary: String
@@ -174,11 +175,36 @@ struct BalancesSectionView: View {
transactions = response
pendingTransactions = WalletModel.pendingTransactions(response)
uncompletedTransactions =
WalletModel.uncompletedTransactions(response)
+ completedTransactions =
WalletModel.completedTransactions(response)
shownSectionID = sectionID
// } else {
// symLog.log("task for BalancesSectionView \(sectionID) ❗️
skip reloading Transactions")
// }
}
+ let transactionCount = completedTransactions.count
+ if sectionCount == 1 && transactionCount > 0 {
+ let sortedTransactions = completedTransactions.sorted {
+ do {
+ let first = try $0.common.timestamp.milliseconds()
+ let second = try $1.common.timestamp.milliseconds()
+ return first > second
+ } catch {
+ symLog.log(error)
+ return false // should never happen
+ }
+ }
+ Section {
+ let slice = sortedTransactions.prefix(3)
+ let threeTransactions = Array(slice)
+ TransactionsRowsView(symLog: symLog,
+ currency: currency,
+ transactions: threeTransactions,
+ reloadOneAction: reloadOneAction)
+ } header: {
+ Text("Last transactions")
+ .font(.callout)
+ }
+ }
} // body
}
// MARK: -
@@ -194,6 +220,7 @@ fileprivate struct BindingViewContainer : View {
requiresUserInput: false,
hasPendingTransactions: true)
BalancesSectionView(balance: balance,
+ sectionCount: 2,
centsToTransfer: $centsToTransfer,
summary: $summary)
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 22/35: extension TransactionsListView.Content => TransactionsRowsView, (continued)
- [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
- [taler-taler-ios] 34/35: ScrollViewReader, gnunet, 2023/07/27
- [taler-taler-ios] 20/35: ToS, move Exchange down, gnunet, 2023/07/27
- [taler-taler-ios] 29/35: show up to 3 transactions in Balances,
gnunet <=
- [taler-taler-ios] 33/35: Comments, gnunet, 2023/07/27
- [taler-taler-ios] 15/35: ToS, gnunet, 2023/07/27
- [taler-taler-ios] 24/35: ToS, gnunet, 2023/07/27
- [taler-taler-ios] 23/35: Hints for manual withdrawal, Accessibility, gnunet, 2023/07/27
- [taler-taler-ios] 28/35: QRcode rendering and hint, gnunet, 2023/07/27