mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 18:45:22 +00:00
Fix people sheet dismiss gestures (#803)
* Allow closing people sheet from X and swipe * Swipe right to return from DM to people list --------- Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
@@ -30,6 +30,7 @@ struct ContentView: View {
|
|||||||
@State private var textFieldSelection: NSRange? = nil
|
@State private var textFieldSelection: NSRange? = nil
|
||||||
@FocusState private var isTextFieldFocused: Bool
|
@FocusState private var isTextFieldFocused: Bool
|
||||||
@Environment(\.colorScheme) var colorScheme
|
@Environment(\.colorScheme) var colorScheme
|
||||||
|
@Environment(\.dismiss) private var dismiss
|
||||||
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
|
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
|
||||||
@State private var showPeerList = false
|
@State private var showPeerList = false
|
||||||
@State private var showSidebar = false
|
@State private var showSidebar = false
|
||||||
@@ -872,6 +873,7 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
Button(action: {
|
Button(action: {
|
||||||
withAnimation(.easeInOut(duration: TransportConfig.uiAnimationMediumSeconds)) {
|
withAnimation(.easeInOut(duration: TransportConfig.uiAnimationMediumSeconds)) {
|
||||||
|
dismiss()
|
||||||
showSidebar = false
|
showSidebar = false
|
||||||
showVerifySheet = false
|
showVerifySheet = false
|
||||||
viewModel.endPrivateChat()
|
viewModel.endPrivateChat()
|
||||||
@@ -1029,6 +1031,18 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
.background(backgroundColor)
|
.background(backgroundColor)
|
||||||
.foregroundColor(textColor)
|
.foregroundColor(textColor)
|
||||||
|
.highPriorityGesture(
|
||||||
|
DragGesture(minimumDistance: 25, coordinateSpace: .local)
|
||||||
|
.onEnded { value in
|
||||||
|
let horizontal = value.translation.width
|
||||||
|
let vertical = abs(value.translation.height)
|
||||||
|
guard horizontal > 80, vertical < 60 else { return }
|
||||||
|
withAnimation(.easeInOut(duration: TransportConfig.uiAnimationMediumSeconds)) {
|
||||||
|
showSidebar = true
|
||||||
|
viewModel.endPrivateChat()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func privateHeaderInfo(context: PrivateHeaderContext, privatePeerID: String) -> some View {
|
private func privateHeaderInfo(context: PrivateHeaderContext, privatePeerID: String) -> some View {
|
||||||
|
|||||||
Reference in New Issue
Block a user