From 3479c7d5dfcfd80fae0b1c247e39d7bd46b81aa8 Mon Sep 17 00:00:00 2001 From: jack <212554440+jackjackbits@users.noreply.github.com> Date: Tue, 14 Oct 2025 21:11:44 +0200 Subject: [PATCH] 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 --- bitchat/Views/ContentView.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bitchat/Views/ContentView.swift b/bitchat/Views/ContentView.swift index f12c198e..cffad5c4 100644 --- a/bitchat/Views/ContentView.swift +++ b/bitchat/Views/ContentView.swift @@ -30,6 +30,7 @@ struct ContentView: View { @State private var textFieldSelection: NSRange? = nil @FocusState private var isTextFieldFocused: Bool @Environment(\.colorScheme) var colorScheme + @Environment(\.dismiss) private var dismiss @Environment(\.dynamicTypeSize) private var dynamicTypeSize @State private var showPeerList = false @State private var showSidebar = false @@ -872,6 +873,7 @@ struct ContentView: View { } Button(action: { withAnimation(.easeInOut(duration: TransportConfig.uiAnimationMediumSeconds)) { + dismiss() showSidebar = false showVerifySheet = false viewModel.endPrivateChat() @@ -1029,6 +1031,18 @@ struct ContentView: View { } .background(backgroundColor) .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 {