From 08c922f57c81ca453a3e89d8e1d3a0e13ba141e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Tue, 20 Aug 2024 16:14:57 +0200 Subject: [PATCH] Stay fullscreen when opening notification center MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The upper 5% of the screen ignore swipe down gestures when in fullscreen, to avoid leaving fullscreen when opening the notification center. fixes #702 Signed-off-by: Toni Förster --- Shared/Player/PlayerDragGesture.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Shared/Player/PlayerDragGesture.swift b/Shared/Player/PlayerDragGesture.swift index 39e098e7..2c38fa53 100644 --- a/Shared/Player/PlayerDragGesture.swift +++ b/Shared/Player/PlayerDragGesture.swift @@ -32,8 +32,12 @@ extension VideoPlayerView { let horizontalDrag = value.translation.width #if os(iOS) - if viewDragOffset > 0, !isVerticalDrag { - isVerticalDrag = true + // Detect if the gesture starts within the top 5% of the screen and the player is in fullscreen mode + if value.startLocation.y <= UIScreen.main.bounds.height * 0.05, PlayerModel.shared.playingFullScreen { + // If it's a downward swipe, do nothing (return early) + if verticalDrag > 0, abs(verticalDrag) > abs(horizontalDrag) { + return + } } #endif