[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 29/32: BarGraph also for Exchanges
From: |
gnunet |
Subject: |
[taler-taler-ios] 29/32: BarGraph also for Exchanges |
Date: |
Mon, 16 Oct 2023 00:03:27 +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 9b2f26ff3ee711726bc81de32ccf0d3f7eaa342a
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sun Oct 15 23:33:33 2023 +0200
BarGraph also for Exchanges
---
.../Views/Balances/BalancesSectionView.swift | 6 +----
.../Views/Exchange/ExchangeSectionView.swift | 3 +--
TalerWallet1/Views/HelperViews/BarGraph.swift | 31 +++++++++++++++++++++-
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index 1954386..fce76ad 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -110,11 +110,7 @@ extension BalancesSectionView: View {
}
} header: {
- HStack (alignment: .center, spacing: 10) {
- Text(currency)
- .accessibilityFont(.title2)
- BarGraph(transactions: $completedTransactions, barHeight: 10)
- }
+ BarGraphHeader(stack: stack.push(), currency: currency)
}.id(sectionID)
.task {
// if shownSectionID != sectionID {
diff --git a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
index 1a6c622..73e8dbf 100644
--- a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
@@ -95,8 +95,7 @@ struct ExchangeSectionView: View {
}
.accessibilityElement(children: .combine)
} header: {
- Text(currency)
- .accessibilityFont(.title2)
+ BarGraphHeader(stack: stack.push(), currency: currency)
}
}
}
diff --git a/TalerWallet1/Views/HelperViews/BarGraph.swift
b/TalerWallet1/Views/HelperViews/BarGraph.swift
index 936b852..dd66634 100644
--- a/TalerWallet1/Views/HelperViews/BarGraph.swift
+++ b/TalerWallet1/Views/HelperViews/BarGraph.swift
@@ -3,9 +3,38 @@
* See LICENSE.md
*/
import SwiftUI
+import SymLog
+let MAXBARS = 10
+
+struct BarGraphHeader: View {
+ private let symLog = SymLogV(0)
+ let stack: CallStack
+ let currency: String
+
+ @EnvironmentObject private var model: WalletModel
+ @State private var completedTransactions: [Transaction] = []
+
+ var body: some View {
+ HStack (alignment: .center, spacing: 10) {
+ Text(currency)
+ .accessibilityFont(.title2)
+ BarGraph(transactions: $completedTransactions,
+ maxBars: MAXBARS, barHeight: 10) // TODO: barHeight
relative to fontSize
+ }
+ .task {
+ 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)
+ }
+ }
+}
+// MARK: -
struct BarGraph: View {
@Binding var transactions: [Transaction]
+ let maxBars: Int
let barHeight : Double
func maxValue(_ someTransactions: [Transaction]) -> Double {
@@ -20,7 +49,7 @@ struct BarGraph: View {
}
var body: some View {
- let slice = transactions.prefix(10)
+ let slice = transactions.prefix(maxBars)
let count = slice.count
let tenTransactions: [Transaction] = Array(slice)
let maxValue = maxValue(tenTransactions)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 11/32: bankAccessApiBaseUrl -> corebankApiBaseUrl, (continued)
- [taler-taler-ios] 11/32: bankAccessApiBaseUrl -> corebankApiBaseUrl, gnunet, 2023/10/15
- [taler-taler-ios] 12/32: AsyncSemaphore to serialize Getbalances, gnunet, 2023/10/15
- [taler-taler-ios] 31/32: comment, gnunet, 2023/10/15
- [taler-taler-ios] 25/32: Bargraph after Currency, gnunet, 2023/10/15
- [taler-taler-ios] 32/32: Bump version to 0.9.3 (20), gnunet, 2023/10/15
- [taler-taler-ios] 21/32: cleanup, gnunet, 2023/10/15
- [taler-taler-ios] 26/32: cleanup, gnunet, 2023/10/15
- [taler-taler-ios] 22/32: badge, gnunet, 2023/10/15
- [taler-taler-ios] 28/32: Button Layout, gnunet, 2023/10/15
- [taler-taler-ios] 20/32: Preparation for Exchange deposit only with positive balance, gnunet, 2023/10/15
- [taler-taler-ios] 29/32: BarGraph also for Exchanges,
gnunet <=
- [taler-taler-ios] 24/32: Balance button, gnunet, 2023/10/15