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
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
)
}