[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 48/204: DragGesture
From: |
gnunet |
Subject: |
[taler-taler-ios] 48/204: DragGesture |
Date: |
Thu, 05 Dec 2024 23:50:16 +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 b94b4aa4750133213469e878dba4e14fe6238f64
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Oct 12 16:22:20 2024 +0200
DragGesture
---
TalerWallet1/Views/HelperViews/TabBarView.swift | 29 +++++++++++++++++++++++++
TalerWallet1/Views/Main/MainView.swift | 3 +++
2 files changed, 32 insertions(+)
diff --git a/TalerWallet1/Views/HelperViews/TabBarView.swift
b/TalerWallet1/Views/HelperViews/TabBarView.swift
index c188e79..24e539a 100644
--- a/TalerWallet1/Views/HelperViews/TabBarView.swift
+++ b/TalerWallet1/Views/HelperViews/TabBarView.swift
@@ -11,11 +11,15 @@ struct TabBarView: View {
@Binding var selection: Tab
@Binding var hidden: Int
let onActionTab: () -> Void
+ let onActionDrag: () -> Void
@Environment(\.keyboardShowing) var keyboardShowing
@AppStorage("minimalistic") var minimalistic: Bool = false
+ @State private var offset = CGSize.zero
+ @State private var didDrag = false
+
private func tabBarItem(for tab: Tab) -> some View {
VStack(spacing: 0) {
if tab == .actions {
@@ -27,6 +31,31 @@ struct TabBarView: View {
.frame(width: width, height: height)
.clipped() // Crop the image to the frame size
.padding(.bottom, 4)
+ .offset(offset)
+ .opacity(1 - Double(abs(offset.height / 35)))
+ .gesture(
+ DragGesture()
+ .onChanged { gesture in
+ var trans = gesture.translation
+ trans.width = .zero
+ if abs(offset.height) > 30 {
+ offset = .zero
+ didDrag = true
+ onActionDrag() // switch to camera
+ } else {
+ offset = trans
+ }
+ }
+ .onEnded { _ in
+ if didDrag {
+ didDrag = false
+ } else {
+ onActionTab()
+ }
+ offset = .zero
+ }
+ )
+
} else {
let size = minimalistic ? 36.0 : 24.0
tab.image
diff --git a/TalerWallet1/Views/Main/MainView.swift
b/TalerWallet1/Views/Main/MainView.swift
index 7a8a470..3d38817 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -328,6 +328,9 @@ extension MainView {
// TODO: check NavigationStack, pop only if necessary
// ViewState.shared.popToRootView(nil) either do this after
any of the buttons was operated, or don't do it at all
showActionSheet = true
+ } onActionDrag: {
+// showScanner = true
+// showActionSheet = true
}
let scope = ScopeInfo(type: ScopeInfo.ScopeInfoType.exchange,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 27/204: dismiss, (continued)
- [taler-taler-ios] 27/204: dismiss, gnunet, 2024/12/05
- [taler-taler-ios] 25/204: layout - smaller font, gnunet, 2024/12/05
- [taler-taler-ios] 36/204: QRButton in Actions, gnunet, 2024/12/05
- [taler-taler-ios] 29/204: getMaxPeerPushDebitAmountM for available, gnunet, 2024/12/05
- [taler-taler-ios] 39/204: A11y for amounts, gnunet, 2024/12/05
- [taler-taler-ios] 41/204: ScopePicker, gnunet, 2024/12/05
- [taler-taler-ios] 35/204: layout itself, gnunet, 2024/12/05
- [taler-taler-ios] 38/204: hint instead of warning, gnunet, 2024/12/05
- [taler-taler-ios] 42/204: no GradientBorder, gnunet, 2024/12/05
- [taler-taler-ios] 46/204: no subject, gnunet, 2024/12/05
- [taler-taler-ios] 48/204: DragGesture,
gnunet <=
- [taler-taler-ios] 54/204: tabBar+QR, gnunet, 2024/12/05
- [taler-taler-ios] 52/204: QRButton gets camera API, gnunet, 2024/12/05
- [taler-taler-ios] 57/204: innerSize, gnunet, 2024/12/05
- [taler-taler-ios] 58/204: ScopePicker, gnunet, 2024/12/05
- [taler-taler-ios] 62/204: a11y, gnunet, 2024/12/05
- [taler-taler-ios] 63/204: amount too small is no error, gnunet, 2024/12/05
- [taler-taler-ios] 64/204: shortcuts, prep for amountLastUsed, gnunet, 2024/12/05
- [taler-taler-ios] 67/204: Simplify, gnunet, 2024/12/05
- [taler-taler-ios] 68/204: cleanup, gnunet, 2024/12/05
- [taler-taler-ios] 72/204: cleanup currencyInfo, gnunet, 2024/12/05