commit bb5f7891351a8d394b54d2b3cc060f56a1e42fe7
parent 50b56535b55abb0ef172fd8921ef93de921c651a
Author: Marc Stibane <marc@taler.net>
Date: Sun, 6 Oct 2024 09:39:04 +0200
QrButton in Actions
Diffstat:
3 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/TalerWallet1/Controllers/PublicConstants.swift b/TalerWallet1/Controllers/PublicConstants.swift
@@ -126,4 +126,5 @@ extension Notification.Name {
static let RequestAction = Notification.Name("requestAction")
static let DepositAction = Notification.Name("depositAction")
static let WithdrawAction = Notification.Name("withdrawAction")
+ static let QrScanAction = Notification.Name("qrScanAction")
}
diff --git a/TalerWallet1/Views/Actions/ActionsSheet.swift b/TalerWallet1/Views/Actions/ActionsSheet.swift
@@ -33,6 +33,13 @@ struct ActionsSheet: View {
return false
}
+ @MainActor
+ func qrButtonTapped() {
+ dismissTop(stack.push())
+ NotificationCenter.default.post(name: .QrScanAction,
+ object: nil) // will trigger NavigationLink
+ }
+
var body: some View {
VStack {
let width = UIScreen.screenWidth / 3
@@ -67,6 +74,10 @@ struct ActionsSheet: View {
.padding(.bottom, 20)
}
+ QRButton(action: qrButtonTapped)
+ .lineLimit(5)
+ .buttonStyle(TalerButtonStyle(type: .bordered, narrow: true, aligned: .center))
+
SendRequestV(stack: stack.push(),
balances: $balances,
amountToTransfer: $amountToTransfer, // does still have the wrong currency
diff --git a/TalerWallet1/Views/Main/MainView.swift b/TalerWallet1/Views/Main/MainView.swift
@@ -391,6 +391,7 @@ extension MainView {
.onNotification(.RequestAction) { navModel.actionSelected = 2 }
.onNotification(.DepositAction) { navModel.actionSelected = 3 }
.onNotification(.WithdrawAction){ navModel.actionSelected = 4 }
+ .onNotification(.QrScanAction) { cameraAction() }
}.id(viewState.rootViewId) // any change to rootViewId triggers popToRootView behaviour
.navigationViewStyle(.stack)
.tag(Tab.balances)