Remove "Rotate to portrait when exiting fullscreen" setting

Now it is automatically decided depending on device type
This commit is contained in:
Arkadiusz Fal 2023-05-23 17:29:10 +02:00
parent 0dee8310ce
commit e1f03bc025
5 changed files with 3 additions and 11 deletions

View File

@ -127,7 +127,6 @@ final class PlayerModel: ObservableObject {
#if os(iOS)
@Published var lockedOrientation: UIInterfaceOrientationMask?
@Default(.rotateToPortraitOnExitFullScreen) private var rotateToPortraitOnExitFullScreen
@Default(.rotateToLandscapeOnEnterFullScreen) private var rotateToLandscapeOnEnterFullScreen
#endif
@ -1041,7 +1040,7 @@ final class PlayerModel: ObservableObject {
avPlayerBackend.controller.dismiss(animated: true)
return
}
let rotationOrientation = rotateToPortraitOnExitFullScreen ? UIInterfaceOrientation.portrait : nil
let rotationOrientation = Constants.isIPhone ? UIInterfaceOrientation.portrait : nil
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: rotationOrientation)
}

View File

@ -190,7 +190,6 @@ extension Defaults.Keys {
#if os(iOS)
static let honorSystemOrientationLock = Key<Bool>("honorSystemOrientationLock", default: true)
static let enterFullscreenInLandscape = Key<Bool>("enterFullscreenInLandscape", default: UIDevice.current.userInterfaceIdiom == .phone)
static let rotateToPortraitOnExitFullScreen = Key<Bool>("rotateToPortraitOnExitFullScreen", default: UIDevice.current.userInterfaceIdiom == .phone)
static let rotateToLandscapeOnEnterFullScreen = Key<FullScreenRotationSetting>(
"rotateToLandscapeOnEnterFullScreen",
default: UIDevice.current.userInterfaceIdiom == .phone ? .landscapeRight : .disabled

View File

@ -42,7 +42,7 @@ import SwiftUI
#if os(iOS)
self.player.lockedOrientation = nil
if Defaults[.rotateToPortraitOnExitFullScreen] {
if Constants.isIPhone {
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: .portrait)
}

View File

@ -69,7 +69,7 @@ extension VideoPlayerView {
{
player.exitFullScreen(showControls: false)
#if os(iOS)
if Defaults[.rotateToPortraitOnExitFullScreen] {
if Constants.isIPhone {
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: .portrait)
}
#endif

View File

@ -17,7 +17,6 @@ struct PlayerSettings: View {
#if os(iOS)
@Default(.honorSystemOrientationLock) private var honorSystemOrientationLock
@Default(.enterFullscreenInLandscape) private var enterFullscreenInLandscape
@Default(.rotateToPortraitOnExitFullScreen) private var rotateToPortraitOnExitFullScreen
@Default(.rotateToLandscapeOnEnterFullScreen) private var rotateToLandscapeOnEnterFullScreen
#endif
@Default(.closePiPOnNavigation) private var closePiPOnNavigation
@ -122,7 +121,6 @@ struct PlayerSettings: View {
enterFullscreenInLandscapeToggle
}
honorSystemOrientationLockToggle
rotateToPortraitOnExitFullScreenToggle
rotateToLandscapeOnEnterFullScreenPicker
}
#endif
@ -214,10 +212,6 @@ struct PlayerSettings: View {
Toggle("Enter fullscreen in landscape", isOn: $enterFullscreenInLandscape)
}
private var rotateToPortraitOnExitFullScreenToggle: some View {
Toggle("Rotate to portrait when exiting fullscreen", isOn: $rotateToPortraitOnExitFullScreen)
}
private var rotateToLandscapeOnEnterFullScreenPicker: some View {
Picker("Rotate when entering fullscreen on landscape video", selection: $rotateToLandscapeOnEnterFullScreen) {
Text("Landscape left").tag(FullScreenRotationSetting.landscapeRight)