Improve fullscreen orientation handling for iOS player

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 <noreply@anthropic.com>
This commit is contained in:
Arkadiusz Fal
2025-11-09 14:32:46 +01:00
parent cb2d9729ea
commit 8123770614

View File

@@ -1182,19 +1182,16 @@ final class PlayerModel: ObservableObject {
} }
let lockOrientation = rotateToLandscapeOnEnterFullScreen.interfaceOrientation let lockOrientation = rotateToLandscapeOnEnterFullScreen.interfaceOrientation
if currentVideoIsLandscape { if currentVideoIsLandscape {
if initiatedByButton { let orientation = initiatedByButton
Orientation.lockOrientation(isOrientationLocked ? rotateToLandscapeOnEnterFullScreen.interfaceOrientation
? (lockOrientation == .landscapeRight ? .landscapeRight : .landscapeLeft) : (OrientationTracker.shared.currentDeviceOrientation.isLandscape
: .landscape) ? OrientationTracker.shared.currentInterfaceOrientation
} : rotateToLandscapeOnEnterFullScreen.interfaceOrientation)
let orientation = OrientationTracker.shared.currentDeviceOrientation.isLandscape
? OrientationTracker.shared.currentInterfaceOrientation
: rotateToLandscapeOnEnterFullScreen.interfaceOrientation
Orientation.lockOrientation( Orientation.lockOrientation(
isOrientationLocked isOrientationLocked
? (lockOrientation == .landscapeRight ? .landscapeRight : .landscapeLeft) ? (lockOrientation == .landscapeRight ? .landscapeRight : .landscapeLeft)
: .all, : (initiatedByButton ? .landscape : .all),
andRotateTo: orientation andRotateTo: orientation
) )
} }