From 8123770614b7a69bcc4d69260eafe9a1db4ae98c Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 9 Nov 2025 14:32:46 +0100 Subject: [PATCH] Improve fullscreen orientation handling for iOS player MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor orientation logic when entering fullscreen to better handle button-initiated vs gesture-initiated transitions: - Consolidate orientation determination into a single expression that considers whether fullscreen was initiated by button or gesture - When initiated by button, always use rotateToLandscapeOnEnterFullScreen preference - When initiated by gesture, respect current device orientation if already in landscape, otherwise use preference - Apply .landscape lock only for button-initiated transitions, .all for gesture-initiated (when not orientation locked) This provides more intuitive behavior where button taps rotate to preferred orientation, while gestures respect current device orientation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Model/Player/PlayerModel.swift | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Model/Player/PlayerModel.swift b/Model/Player/PlayerModel.swift index eb8532fb..284b8c27 100644 --- a/Model/Player/PlayerModel.swift +++ b/Model/Player/PlayerModel.swift @@ -1182,19 +1182,16 @@ final class PlayerModel: ObservableObject { } let lockOrientation = rotateToLandscapeOnEnterFullScreen.interfaceOrientation if currentVideoIsLandscape { - if initiatedByButton { - Orientation.lockOrientation(isOrientationLocked - ? (lockOrientation == .landscapeRight ? .landscapeRight : .landscapeLeft) - : .landscape) - } - let orientation = OrientationTracker.shared.currentDeviceOrientation.isLandscape - ? OrientationTracker.shared.currentInterfaceOrientation - : rotateToLandscapeOnEnterFullScreen.interfaceOrientation + let orientation = initiatedByButton + ? rotateToLandscapeOnEnterFullScreen.interfaceOrientation + : (OrientationTracker.shared.currentDeviceOrientation.isLandscape + ? OrientationTracker.shared.currentInterfaceOrientation + : rotateToLandscapeOnEnterFullScreen.interfaceOrientation) Orientation.lockOrientation( isOrientationLocked ? (lockOrientation == .landscapeRight ? .landscapeRight : .landscapeLeft) - : .all, + : (initiatedByButton ? .landscape : .all), andRotateTo: orientation ) }