[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 08/10: NavigationLinksView
From: |
gnunet |
Subject: |
[taler-taler-ios] 08/10: NavigationLinksView |
Date: |
Tue, 08 Aug 2023 12:29: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 18a2d40c8af1065d06c626aea5614feedb9e0bc8
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Aug 8 12:19:39 2023 +0200
NavigationLinksView
---
.../Views/Balances/BalancesSectionView.swift | 103 +++++++++++++--------
1 file changed, 63 insertions(+), 40 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index 6cf640c..bc93f93 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -24,7 +24,6 @@ struct BalancesSectionView: View {
@EnvironmentObject private var model: WalletModel
@State private var isShowingDetailView = false
- @State private var buttonSelected: Int? = nil
@State private var transactions: [Transaction] = []
@State private var completedTransactions: [Transaction] = []
@@ -86,38 +85,13 @@ struct BalancesSectionView: View {
Text("You can spend these KUDOS in the [Demo
Shop](https://shop.demo.taler.net), or send them to another wallet.")
.multilineTextAlignment(.leading)
}
- HStack(spacing: 0) {
- NavigationLink(destination: LazyView {
- SendAmount(amountAvailable: balance.available,
- centsToTransfer: $centsToTransfer,
- summary: $summary)
- }, tag: 1, selection: $buttonSelected
- ) { EmptyView() }.frame(width: 0).opacity(0).hidden()
// SendAmount
-
- NavigationLink(destination: LazyView {
- RequestPayment(scopeInfo: balance.scopeInfo,
- centsToTransfer: $centsToTransfer,
- summary: $summary)
- }, tag: 2, selection: $buttonSelected
- ) { EmptyView() }.frame(width: 0).opacity(0).hidden()
// RequestPayment
-
- NavigationLink(destination: LazyView {
- TransactionsListView(navTitle: String(localized:
"Transactions"), currency: currency,
- transactions: completedTransactions,
- showUpDown: true,
- reloadAllAction: reloadCompleted,
- reloadOneAction: reloadOneAction)
- }, tag: 3, selection: $buttonSelected
- ) { EmptyView() }.frame(width: 0).opacity(0).hidden()
// TransactionsListView
-
- BalanceRowView(amount: balance.available, sendAction: {
- buttonSelected = 1 // will trigger SendAmount
NavigationLink
- }, recvAction: {
- buttonSelected = 2 // will trigger RequestPayment
NavigationLink
- }, rowAction: {
- buttonSelected = 3 // will trigger
TransactionList NavigationLink
- })
- }
+ NavigationLinksView(balance: balance,
+ centsToTransfer: $centsToTransfer,
+ summary: $summary,
+// buttonSelected: $buttonSelected,
+ completedTransactions: $completedTransactions,
+ reloadAllAction: reloadCompleted,
+ reloadOneAction: reloadOneAction)
let hasPending = pendingTransactions.count > 0
if hasPending {
let (pendingIncoming, pendingOutgoing) =
computePending(currency: currency)
@@ -153,11 +127,12 @@ struct BalancesSectionView: View {
NavigationLink {
//let _ = print("button: Uncompleted Transactions: \(currency)")
LazyView {
- TransactionsListView(navTitle: String(localized:
"Uncompleted"), currency: currency,
- transactions:
uncompletedTransactions,
- showUpDown: false,
- reloadAllAction: reloadUncompleted,
- reloadOneAction: reloadOneAction)
+ TransactionsListView(navTitle: String(localized:
"Uncompleted"),
+ currency: currency,
+ transactions: uncompletedTransactions,
+ showUpDown: false,
+ reloadAllAction: reloadUncompleted,
+ reloadOneAction: reloadOneAction)
}
} label: {
UncompletedRowView(uncompletedTransactions:
$uncompletedTransactions)
@@ -201,12 +176,60 @@ struct BalancesSectionView: View {
transactions: threeTransactions,
reloadOneAction: reloadOneAction)
} header: {
- Text("Last transactions")
+ Text("Recent transactions")
.font(.callout)
}
}
} // body
}
+
+fileprivate struct NavigationLinksView : View {
+ let balance: Balance
+// let sectionCount: Int
+ @Binding var centsToTransfer: UInt64
+ @Binding var summary: String
+ @Binding var completedTransactions: [Transaction]
+ let reloadAllAction: () async -> ()
+ let reloadOneAction: ((_ transactionId: String) async throws ->
Transaction)
+
+ @State private var buttonSelected: Int? = nil
+
+ var body: some View {
+ let currency = balance.available.currencyStr
+ HStack(spacing: 0) {
+ NavigationLink(destination: LazyView {
+ SendAmount(amountAvailable: balance.available,
+ centsToTransfer: $centsToTransfer,
+ summary: $summary)
+ }, tag: 1, selection: $buttonSelected
+ ) { EmptyView() }.frame(width: 0).opacity(0).hidden() //
SendAmount
+
+ NavigationLink(destination: LazyView {
+ RequestPayment(scopeInfo: balance.scopeInfo,
+ centsToTransfer: $centsToTransfer,
+ summary: $summary)
+ }, tag: 2, selection: $buttonSelected
+ ) { EmptyView() }.frame(width: 0).opacity(0).hidden() //
RequestPayment
+
+ NavigationLink(destination: LazyView {
+ TransactionsListView(navTitle: String(localized:
"Transactions"), currency: currency,
+ transactions: completedTransactions,
+ showUpDown: true,
+ reloadAllAction: reloadAllAction,
+ reloadOneAction: reloadOneAction)
+ }, tag: 3, selection: $buttonSelected
+ ) { EmptyView() }.frame(width: 0).opacity(0).hidden() //
TransactionsListView
+
+ BalanceRowView(amount: balance.available, sendAction: {
+ buttonSelected = 1 // will trigger SendAmount
NavigationLink
+ }, recvAction: {
+ buttonSelected = 2 // will trigger RequestPayment
NavigationLink
+ }, rowAction: {
+ buttonSelected = 3 // will trigger TransactionList
NavigationLink
+ })
+ }
+ }
+}
// MARK: -
#if DEBUG
fileprivate struct BindingViewContainer : View {
@@ -214,7 +237,7 @@ fileprivate struct BindingViewContainer : View {
@State private var summary: String = "bla-bla"
var body: some View {
- let scopeInfo = ScopeInfo(type: ScopeInfo.ScopeInfoType.exchange,
exchangeBaseUrl: DEMOEXCHANGE, currency: LONGCURRENCY)
+ let scopeInfo = ScopeInfo(type: ScopeInfo.ScopeInfoType.exchange, url:
DEMOEXCHANGE, currency: LONGCURRENCY)
let balance = Balance(available: try! Amount(fromString: LONGCURRENCY
+ ":0.1"),
scopeInfo: scopeInfo,
requiresUserInput: false,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (dbf44d6 -> 7792241), gnunet, 2023/08/08
- [taler-taler-ios] 03/10: tip -> reward, gnunet, 2023/08/08
- [taler-taler-ios] 07/10: Wallet changes + bugfixes, gnunet, 2023/08/08
- [taler-taler-ios] 01/10: PaymentView, gnunet, 2023/08/08
- [taler-taler-ios] 10/10: iOS: bump version to 0.9.3 (17), gnunet, 2023/08/08
- [taler-taler-ios] 05/10: SuperScriptDigits, gnunet, 2023/08/08
- [taler-taler-ios] 04/10: Payment Sounds by carlo von lynX, gnunet, 2023/08/08
- [taler-taler-ios] 02/10: started with PayTemplates, gnunet, 2023/08/08
- [taler-taler-ios] 09/10: Usability improved for manual withdrawal + P2P, gnunet, 2023/08/08
- [taler-taler-ios] 08/10: NavigationLinksView,
gnunet <=
- [taler-taler-ios] 06/10: GetScopedCurrencyInfo, gnunet, 2023/08/08