[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 21/32: cleanup
From: |
gnunet |
Subject: |
[taler-taler-ios] 21/32: cleanup |
Date: |
Mon, 16 Oct 2023 00:03:19 +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 86b0ee41a5af71b3e9c3a1f5019982ea7e2ac0e0
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Oct 13 23:05:08 2023 +0200
cleanup
---
TalerWallet1/Views/Balances/BalanceRowView.swift | 32 +++++-------
.../Views/Balances/BalancesSectionView.swift | 60 +++++++++++++---------
.../Views/Exchange/ExchangeSectionView.swift | 26 ++++------
3 files changed, 57 insertions(+), 61 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift
b/TalerWallet1/Views/Balances/BalanceRowView.swift
index bb919c2..c3168d9 100644
--- a/TalerWallet1/Views/Balances/BalanceRowView.swift
+++ b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -14,9 +14,10 @@ struct BalanceButton: View {
var body: some View {
Button(action: rowAction) {
- VStack(alignment: .trailing, spacing: 0) {
- Text("Balance", comment: "Balance in main view")
- .bold() // in iOS-15 defined for Text, but not for
Font (only iOS-16)
+ HStack() {
+ Text("Balance:", comment: "Balance in main view")
+ .accessibilityFont(.title)
+ Spacer()
Text(verbatim: "\(amount.valueStr)") // TODO:
CurrencyFormatter?
.accessibilityFont(.title)
.monospacedDigit()
@@ -64,26 +65,17 @@ struct BalanceRowView: View {
}
var body: some View {
- Group {
- let requestTitle = requestTitle1 + "\n" + requestTitle2
+ VStack (alignment: .trailing) {
+ BalanceButton(amount: amount, rowAction: rowAction)
let sendTitle = sendTitle1 + "\n" + sendTitle2
+ let requestTitle = requestTitle1 + "\n" + requestTitle2
+ let twoRowButtons = TwoRowButtons(sendTitle: sendTitle, recvTitle:
requestTitle,
+ lineLimit: 5, sendDisabled:
amount.isZero,
+ sendAction: sendAction,
recvAction: recvAction)
if needVStack(amount) {
- VStack (alignment: .trailing) {
- BalanceButton(amount: amount, rowAction: rowAction)
- HStack {
- }
- TwoRowButtons(sendTitle: sendTitle, recvTitle:
requestTitle,
- lineLimit: 5, sendDisabled: amount.isZero,
- sendAction: sendAction, recvAction:
recvAction)
- }
+ VStack { twoRowButtons }
} else {
- HStack {
- BalanceButton(amount: amount, rowAction: rowAction)
- TwoRowButtons(sendTitle: sendTitle, recvTitle:
requestTitle,
- lineLimit: 5, sendDisabled: amount.isZero,
- sendAction: sendAction, recvAction:
recvAction)
- }
-// .fixedSize(horizontal: true, vertical: true) // should
make all buttons equal height - but doesn't
+ HStack { twoRowButtons }
}
}
.accessibilityElement(children: .combine)
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index dfeffcd..75cc0a1 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -74,22 +74,22 @@ extension BalancesSectionView: View {
.accessibilityFont(.body)
.multilineTextAlignment(.leading)
}
- NavigationLinksView(stack: stack.push(),
- balance: balance,
- centsToTransfer: $centsToTransfer,
- summary: $summary,
-// buttonSelected: $buttonSelected,
- completedTransactions: $completedTransactions,
- reloadAllAction: reloadCompleted,
- reloadOneAction: reloadOneAction)
+ BalancesNavigationLinksView(stack: stack.push(),
+ balance: balance,
+ centsToTransfer: $centsToTransfer,
+ summary: $summary,
+// buttonSelected: $buttonSelected,
+ completedTransactions: $completedTransactions,
+ reloadAllAction: reloadCompleted,
+ reloadOneAction: reloadOneAction)
let hasPending = pendingTransactions.count > 0
if hasPending {
- SectionPendingRowView(symLog: symLog,
- stack: stack.push(),
- currency: currency,
- pendingTransactions: $pendingTransactions,
- reloadPending: reloadPending,
- reloadOneAction: reloadOneAction)
+ BalancesPendingRowView(symLog: symLog,
+ stack: stack.push(),
+ currency: currency,
+ pendingTransactions: $pendingTransactions,
+ reloadPending: reloadPending,
+ reloadOneAction: reloadOneAction)
}
let hasUncompleted = uncompletedTransactions.count > 0
if hasUncompleted {
@@ -110,7 +110,7 @@ extension BalancesSectionView: View {
}
} header: {
- HStack (alignment: .bottom, spacing: 10) {
+ HStack (alignment: .center, spacing: 10) {
BarGraph(transactions: $completedTransactions, barHeight: 10)
Text(currency)
.accessibilityFont(.title2)
@@ -118,8 +118,8 @@ extension BalancesSectionView: View {
}.id(sectionID)
.task {
// if shownSectionID != sectionID {
- symLog.log("task for \(sectionID) - reload Transactions")
- let response = await model.transactionsT(stack.push("task for
\(sectionID) - reload Transactions"), currency: currency)
+ symLog.log(".task for BalancesSectionView - reload
Transactions")
+ let response = await model.transactionsT(stack.push(".task -
reload Transactions"), currency: currency)
transactions = response
pendingTransactions = WalletModel.pendingTransactions(response)
uncompletedTransactions =
WalletModel.uncompletedTransactions(response)
@@ -155,9 +155,9 @@ extension BalancesSectionView: View {
}
}
} // body
-}
+} // extension BalancesSectionView
-fileprivate struct SectionPendingRowView: View {
+fileprivate struct BalancesPendingRowView: View {
let symLog: SymLogV?
let stack: CallStack
let currency: String
@@ -218,10 +218,10 @@ fileprivate struct SectionPendingRowView: View {
}
}
- }
-}
+ } // body
+} // BalancesPendingRowView
-fileprivate struct NavigationLinksView: View {
+fileprivate struct BalancesNavigationLinksView: View {
let stack: CallStack
let balance: Balance
// let sectionCount: Int
@@ -233,6 +233,18 @@ fileprivate struct NavigationLinksView: View {
@State private var buttonSelected: Int? = nil
+ func selectAndUpdate(_ button: Int) {
+ buttonSelected = button // will trigger NavigationLink
+ // while navigation animation runs, contact Exchange to update Fees
+// Task { // runs on MainActor
+// do {
+// try await model.updateExchange(scopeInfo: balance.scopeInfo)
+// } catch { // TODO: error handling - couldn't updateExchange
+// symLog.log("error: \(error)")
+// }
+// }
+ }
+
var body: some View {
let currency = balance.available.currencyStr
HStack(spacing: 0) {
@@ -264,9 +276,9 @@ fileprivate struct NavigationLinksView: View {
) { EmptyView() }.frame(width: 0).opacity(0).hidden() //
TransactionsListView
BalanceRowView(amount: balance.available, sendAction: {
- buttonSelected = 1 // will trigger SendAmount
NavigationLink
+ selectAndUpdate(1) // will trigger SendAmount
NavigationLink
}, recvAction: {
- buttonSelected = 2 // will trigger RequestPayment
NavigationLink
+ selectAndUpdate(2) // will trigger RequestPayment
NavigationLink
}, rowAction: {
buttonSelected = 3 // will trigger TransactionList
NavigationLink
})
diff --git a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
index 3e3d73d..cbb8528 100644
--- a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
@@ -54,28 +54,20 @@ struct ExchangeRowView: View {
) { EmptyView() }.frame(width: 0).opacity(0)
}.listRowSeparator(.hidden)
- let sendTitle = depositTitle + "\n" + currency // TODO:
amount.currencyStr
- let recvTitle = withdrawTitle + "\n" + currency // TODO:
amount.currencyStr
+ let sendTitle = depositTitle + "\n" + currency
// TODO: amount.currencyStr
+ let recvTitle = withdrawTitle + "\n" + currency
// TODO: amount.currencyStr
+ let twoRowButtons = TwoRowButtons(sendTitle: sendTitle, recvTitle:
recvTitle,
+ lineLimit: 5, sendDisabled: true,
// TODO: amount.isZero
+ sendAction: { selectAndUpdate(1) },
+ recvAction: { selectAndUpdate(2) })
if needVStack(currency) {
- VStack {
- TwoRowButtons(sendTitle: sendTitle,
- recvTitle: recvTitle,
- lineLimit: 5, sendDisabled: true, // TODO:
amount.isZero
- sendAction: { selectAndUpdate(1) },
- recvAction: { selectAndUpdate(2) })
- }
+ VStack { twoRowButtons }
} else {
- HStack { // buttons just set "buttonSelected" so the
NavigationLink will trigger
- TwoRowButtons(sendTitle: sendTitle,
- recvTitle: recvTitle,
- lineLimit: 5, sendDisabled: true, // TODO:
amount.isZero
- sendAction: { selectAndUpdate(1) },
- recvAction: { selectAndUpdate(2) })
-
- }
+ HStack { twoRowButtons }
}
}
}
+// MARK: -
/// This view shows the currency name in an exchange section
/// currency
/// [Deposit Coins] [Withdraw Coins]
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 30/32: font, (continued)
- [taler-taler-ios] 30/32: font, gnunet, 2023/10/15
- [taler-taler-ios] 27/32: SingleAxisGeometryReader, gnunet, 2023/10/15
- [taler-taler-ios] 06/32: More CallStack for Debugging, gnunet, 2023/10/15
- [taler-taler-ios] 07/32: AsyncSemaphore, gnunet, 2023/10/15
- [taler-taler-ios] 23/32: fix for broken scalable font (not finished), gnunet, 2023/10/15
- [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 <=
- [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, 2023/10/15
- [taler-taler-ios] 24/32: Balance button, gnunet, 2023/10/15