[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 106/204: Use NavLink
From: |
gnunet |
Subject: |
[taler-taler-ios] 106/204: Use NavLink |
Date: |
Thu, 05 Dec 2024 23:51:14 +0100 |
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 ca1e592e3c6269963e0f5d034d1d6ba0d5fce64c
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Nov 8 13:47:12 2024 +0100
Use NavLink
---
.../Views/Actions/Peer2peer/RequestPayment.swift | 11 +++----
TalerWallet1/Views/Main/MainView.swift | 38 +++++++++++++---------
.../Views/Sheets/Payment/PayTemplateV.swift | 16 +++------
.../WithdrawBankIntegrated/WithdrawURIView.swift | 13 ++++----
4 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
b/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
index 79ba90a..b0645e1 100644
--- a/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
+++ b/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
@@ -216,6 +216,10 @@ struct RequestPaymentContent: View {
amountToTransfer: $amountShortcut,
summary: $summary,
expireDays: $expireDays)
+ let actions = Group {
+ NavLink($buttonSelected) { inputDestination }
+ NavLink($shortcutSelected) { shortcutDestination }
+ }
let amountLabel = minimalistic ? String(localized: "Amount:")
: String(localized: "Amount to
request:")
AmountInputV(stack: stack.push(),
@@ -230,12 +234,7 @@ struct RequestPaymentContent: View {
buttonAction: buttonAction,
feeIsNegative: true,
computeFee: computeFee)
- .background(NavigationLink(destination: shortcutDestination,
isActive: $shortcutSelected)
- { EmptyView() }.frame(width: 0).opacity(0).hidden()
- ) // shortcutDestination
- .background(NavigationLink(destination: inputDestination,
isActive: $buttonSelected)
- { EmptyView() }.frame(width: 0).opacity(0).hidden()
- ) // inputDestination
+ .background(actions)
}
} // Group
.task(id: balanceIndex + (1000 * controller.currencyTicker)) {
diff --git a/TalerWallet1/Views/Main/MainView.swift
b/TalerWallet1/Views/Main/MainView.swift
index 761cd00..90cbfbf 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -278,6 +278,11 @@ extension MainView {
}
}
}
+ private var isBalances: Bool { self.selectedTab == .balances}
+ private func triggerAction(_ action: Int) {
+ navModel.actionSelected = isBalances ? action // 1..4
+ : action + 4 // 5..8
+ }
private static func className() -> String {"\(self)"}
private static var name: String { Self.className() }
@@ -330,6 +335,18 @@ extension MainView {
amountLastUsed: $amountLastUsed,
// currency needs to be updated!
isSheet: false)
+ let balanceActions = Group {
+ NavLink(1, $navModel.actionSelected) { sendDest }
+ NavLink(2, $navModel.actionSelected) { requestDest }
+ NavLink(3, $navModel.actionSelected) { depositDest }
+ NavLink(4, $navModel.actionSelected) { manualWithdrawDest }
+ }
+ let settingsActions = Group {
+ NavLink(5, $navModel.actionSelected) { sendDest }
+ NavLink(6, $navModel.actionSelected) { requestDest }
+ NavLink(7, $navModel.actionSelected) { depositDest }
+ NavLink(8, $navModel.actionSelected) { manualWithdrawDest }
+ }
ZStack(alignment: .bottom) {
TabView(selection: tabSelection()) {
NavigationView {
@@ -338,20 +355,7 @@ extension MainView {
// shouldReloadPending: $shouldReloadPending,
shouldReloadBalances: $shouldReloadBalances)
.navigationTitle(balancesTitle)
- .background( Group {
- NavigationLink(destination: sendDest, tag: 1,
selection: $navModel.actionSelected)
- { EmptyView() }.frame(width: 0).opacity(0).hidden()
- NavigationLink(destination: requestDest, tag: 2,
selection: $navModel.actionSelected)
- { EmptyView() }.frame(width: 0).opacity(0).hidden()
- NavigationLink(destination: depositDest, tag: 3,
selection: $navModel.actionSelected)
- { EmptyView() }.frame(width: 0).opacity(0).hidden()
- NavigationLink(destination: manualWithdrawDest,
tag: 4, selection: $navModel.actionSelected)
- { EmptyView() }.frame(width: 0).opacity(0).hidden()
- })
- .onNotification(.SendAction) {
navModel.actionSelected = 1 }
- .onNotification(.RequestAction) {
navModel.actionSelected = 2 }
- .onNotification(.DepositAction) {
navModel.actionSelected = 3 }
- .onNotification(.WithdrawAction){
navModel.actionSelected = 4 }
+ .background(balanceActions)
}.id(viewState.rootViewId) // any change to
rootViewId triggers popToRootView behaviour
.navigationViewStyle(.stack)
.tag(Tab.balances)
@@ -361,6 +365,7 @@ extension MainView {
NavigationView {
SettingsView(stack: stack.push(),
navTitle: settingsTitle)
+ .background(settingsActions)
}.id(viewState2.rootViewId) // any change to
rootViewId triggers popToRootView behaviour
.navigationViewStyle(.stack)
.tag(Tab.settings)
@@ -371,7 +376,10 @@ extension MainView {
.ignoresSafeArea(.keyboard, edges: .bottom)
} // ZStack
.frame(maxWidth: .infinity, maxHeight: .infinity)
-
+ .onNotification(.SendAction) { triggerAction(1) }
+ .onNotification(.RequestAction) { triggerAction(2) }
+ .onNotification(.DepositAction) { triggerAction(3) }
+ .onNotification(.WithdrawAction){ triggerAction(4) }
.onNotification(.KYCrequired) { notification in
// show an alert with the KYC link (button) which opens in Safari
if let transition =
notification.userInfo?[TRANSACTIONTRANSITION] as? TransactionTransition {
diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
index cd3e23f..e296e61 100644
--- a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
@@ -184,25 +184,19 @@ struct PayTemplateV: View {
ScrollView {
if summaryIsEditable { // after amount input,
amountInput
- .background(NavigationLink(destination:
shortcutDestination, isActive: $shortcutSelected)
- { EmptyView() }.frame(width:
0).opacity(0).hidden())
- .background( NavigationLink(destination:
inputDestination, isActive: $buttonSelected1)
- { EmptyView() }.frame(width:
0).opacity(0).hidden())
+ .background( NavLink($shortcutSelected) {
shortcutDestination } )
+ .background( NavLink($buttonSelected1) {
inputDestination} )
} else {
amountInput
- .background(NavigationLink(destination:
finalDestinationS, isActive: $shortcutSelected)
- { EmptyView() }.frame(width:
0).opacity(0).hidden())
- .background(NavigationLink(destination:
finalDestinationI, isActive: $buttonSelected1)
- { EmptyView() }.frame(width:
0).opacity(0).hidden())
+ .background( NavLink($shortcutSelected) {
finalDestinationS } )
+ .background( NavLink($buttonSelected1) {
finalDestinationI } )
}
} // amountInput
} else if summaryIsEditable { // template contract summary is
not fixed => let the user input a summary
ScrollView {
inputDestination
- .background(NavigationLink(destination:
finalDestinationI, isActive: $buttonSelected2)
- { EmptyView() }.frame(width:
0).opacity(0).hidden()
- )
+ .background( NavLink($buttonSelected2) {
finalDestinationI } )
} // inputDestination
} else { // both template contract amount and summary are fixed
=> directly show the payment
// Attention: contains a List, thus mustn't be included in a
ScrollView
diff --git
a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
index 266fd2a..6927ca1 100755
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -150,12 +150,16 @@ struct WithdrawURIView: View {
exchange:
$exchange)
if amountIsEditable {
ScrollView {
- let shortcutDestination =
WithdrawAcceptView(stack: stack.push(),
+ let shortcutDest = WithdrawAcceptView(stack:
stack.push(),
url: url,
scope:
exchange.scopeInfo,
amountToTransfer:
$amountShortcut,
wireFee:
$wireFee,
exchange:
$exchange)
+ let actions = Group {
+ NavLink($shortcutSelected) { shortcutDest }
+ NavLink($buttonSelected) { acceptDestination }
+ }
// TODO: input amount, then
let amountLabel = minimalistic ? String(localized:
"Amount:")
: String(localized:
"Amount to withdraw:")
@@ -171,12 +175,7 @@ struct WithdrawURIView: View {
buttonAction: buttonAction,
feeIsNegative: true,
computeFee: computeFeeWithdraw)
- .background(NavigationLink(destination:
shortcutDestination, isActive: $shortcutSelected)
- { EmptyView() }.frame(width:
0).opacity(0).hidden()
- ) // shortcutDestination
- .background(NavigationLink(destination:
acceptDestination, isActive: $buttonSelected)
- { EmptyView() }.frame(width:
0).opacity(0).hidden()
- ) // acceptDestination
+ .background(actions)
} // ScrollView
} else {
acceptDestination
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 98/204: - LazyView, (continued)
- [taler-taler-ios] 98/204: - LazyView, gnunet, 2024/12/05
- [taler-taler-ios] 95/204: - proposalId, gnunet, 2024/12/05
- [taler-taler-ios] 99/204: wording, gnunet, 2024/12/05
- [taler-taler-ios] 97/204: TransactionCommon, row, gnunet, 2024/12/05
- [taler-taler-ios] 101/204: CheckDepositResponse, gnunet, 2024/12/05
- [taler-taler-ios] 104/204: split, gnunet, 2024/12/05
- [taler-taler-ios] 107/204: debug, fix wrong comparison, gnunet, 2024/12/05
- [taler-taler-ios] 102/204: task viewDidLoad, gnunet, 2024/12/05
- [taler-taler-ios] 105/204: NavLink, gnunet, 2024/12/05
- [taler-taler-ios] 109/204: loadBalances, gnunet, 2024/12/05
- [taler-taler-ios] 106/204: Use NavLink,
gnunet <=
- [taler-taler-ios] 113/204: PendingOperations (unused), gnunet, 2024/12/05
- [taler-taler-ios] 114/204: Pay, gnunet, 2024/12/05
- [taler-taler-ios] 110/204: deposit, gnunet, 2024/12/05
- [taler-taler-ios] 122/204: Yellow for confirm, gnunet, 2024/12/05
- [taler-taler-ios] 119/204: cleanup, gnunet, 2024/12/05
- [taler-taler-ios] 120/204: Withdraw, gnunet, 2024/12/05
- [taler-taler-ios] 116/204: Settings, gnunet, 2024/12/05
- [taler-taler-ios] 112/204: P2P, gnunet, 2024/12/05
- [taler-taler-ios] 121/204: TransactionById, gnunet, 2024/12/05
- [taler-taler-ios] 123/204: fake currency, gnunet, 2024/12/05