From 2da25a9d9e84e5addcd767f982eb3888cd56a3e5 Mon Sep 17 00:00:00 2001 From: Taksh Date: Mon, 17 Aug 2026 10:48:29 +0530 Subject: [PATCH] fix: drop the swipe gesture during playback instead of ignoring it The guard in onEnded prevented the conversation from being left, but the scrub was still lost: an armed .highPriorityGesture starves its descendants at recognition time, long before either gesture ends, so the waveform's seek never saw the drag. The gesture is now attached with `including: .subviews` while a note is audible, which yields recognition to the waveform. The onEnded guard stays as the second line of defence for a drag already in flight when playback starts. --- bitchat/Views/ContentSheetViews.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bitchat/Views/ContentSheetViews.swift b/bitchat/Views/ContentSheetViews.swift index 9cd76170..5741975e 100644 --- a/bitchat/Views/ContentSheetViews.swift +++ b/bitchat/Views/ContentSheetViews.swift @@ -462,6 +462,9 @@ private extension ContentPeopleListView { private struct ContentPrivateChatSheetView: View { @EnvironmentObject private var privateConversationModel: PrivateConversationModel + /// Observed so the swipe gesture can be dropped for the duration of + /// playback rather than merely declining to act when it ends. + @ObservedObject private var playbackCoordinator = VoiceNotePlaybackCoordinator.shared @Binding var showSidebar: Bool @Binding var messageText: String @@ -572,7 +575,14 @@ private struct ContentPrivateChatSheetView: View { // whole sheet it preempted the composer's press-and-hold mic // gesture (a high-priority ancestor drag cancels child gestures // within milliseconds — same starvation as the image-reveal bug). - .highPriorityGesture(swipeToLeaveGesture) + // `.subviews` while a note is audible: recognition then belongs to + // the waveform's seek drag. Guarding in `onEnded` is not enough -- + // an armed high-priority ancestor drag starves its descendants + // before either gesture ends, so the scrub would still be lost. + .highPriorityGesture( + swipeToLeaveGesture, + including: playbackCoordinator.hasActivePlayback ? .subviews : .all + ) if !theme.usesGlassChrome { Divider()