Stay fullscreen when opening notification center

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 <toni.foerster@gmail.com>
This commit is contained in:
Toni Förster 2024-08-20 16:14:57 +02:00
parent af75afa912
commit 08c922f57c
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7

View File

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