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:
jack 2025-10-14 21:11:44 +02:00 committed by GitHub
parent 8a0727fcf7
commit 3479c7d5df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {