1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30

Remove "Honor system orientation lock"

Fix #309
This commit is contained in:
Arkadiusz Fal 2022-09-24 14:47:24 +02:00
parent 3273032ffb
commit 2d51f6adff
4 changed files with 4 additions and 13 deletions

View File

@ -173,7 +173,6 @@ extension Defaults.Keys {
static let visibleSections = Key<Set<VisibleSection>>("visibleSections", default: [.favorites, .subscriptions, .trending, .playlists]) static let visibleSections = Key<Set<VisibleSection>>("visibleSections", default: [.favorites, .subscriptions, .trending, .playlists])
#if os(iOS) #if os(iOS)
static let honorSystemOrientationLock = Key<Bool>("honorSystemOrientationLock", default: true)
static let enterFullscreenInLandscape = Key<Bool>("enterFullscreenInLandscape", default: UIDevice.current.userInterfaceIdiom == .phone) static let enterFullscreenInLandscape = Key<Bool>("enterFullscreenInLandscape", default: UIDevice.current.userInterfaceIdiom == .phone)
static let rotateToPortraitOnExitFullScreen = Key<Bool>("rotateToPortraitOnExitFullScreen", default: UIDevice.current.userInterfaceIdiom == .phone) static let rotateToPortraitOnExitFullScreen = Key<Bool>("rotateToPortraitOnExitFullScreen", default: UIDevice.current.userInterfaceIdiom == .phone)
#endif #endif

View File

@ -8,7 +8,9 @@ extension VideoPlayerView {
if currentOrientation.isLandscape, if currentOrientation.isLandscape,
Defaults[.enterFullscreenInLandscape], Defaults[.enterFullscreenInLandscape],
!player.playingFullScreen, !player.playingFullScreen,
!player.playingInPictureInPicture !player.playingInPictureInPicture,
!player.currentItem.isNil,
player.lockedOrientation.isNil || player.lockedOrientation!.contains(.landscape)
{ {
guard player.presentingPlayer else { return } guard player.presentingPlayer else { return }
@ -27,8 +29,7 @@ extension VideoPlayerView {
object: nil, object: nil,
queue: .main queue: .main
) { _ in ) { _ in
guard !Defaults[.honorSystemOrientationLock], guard player.presentingPlayer,
player.presentingPlayer,
!player.playingInPictureInPicture, !player.playingInPictureInPicture,
player.lockedOrientation.isNil player.lockedOrientation.isNil
else { else {

View File

@ -163,8 +163,6 @@ struct VideoPlayerView: View {
} }
stopOrientationUpdates() stopOrientationUpdates()
player.controls.hideOverlays() player.controls.hideOverlays()
player.lockedOrientation = nil
} }
.onAnimationCompleted(for: viewDragOffset) { .onAnimationCompleted(for: viewDragOffset) {
guard !dragGestureState else { return } guard !dragGestureState else { return }

View File

@ -16,7 +16,6 @@ struct PlayerSettings: View {
@Default(.pauseOnHidingPlayer) private var pauseOnHidingPlayer @Default(.pauseOnHidingPlayer) private var pauseOnHidingPlayer
@Default(.closeLastItemOnPlaybackEnd) private var closeLastItemOnPlaybackEnd @Default(.closeLastItemOnPlaybackEnd) private var closeLastItemOnPlaybackEnd
#if os(iOS) #if os(iOS)
@Default(.honorSystemOrientationLock) private var honorSystemOrientationLock
@Default(.enterFullscreenInLandscape) private var enterFullscreenInLandscape @Default(.enterFullscreenInLandscape) private var enterFullscreenInLandscape
@Default(.rotateToPortraitOnExitFullScreen) private var rotateToPortraitOnExitFullScreen @Default(.rotateToPortraitOnExitFullScreen) private var rotateToPortraitOnExitFullScreen
#endif #endif
@ -109,7 +108,6 @@ struct PlayerSettings: View {
enterFullscreenInLandscapeToggle enterFullscreenInLandscapeToggle
} }
rotateToPortraitOnExitFullScreenToggle rotateToPortraitOnExitFullScreenToggle
honorSystemOrientationLockToggle
} }
#endif #endif
@ -250,11 +248,6 @@ struct PlayerSettings: View {
} }
#if os(iOS) #if os(iOS)
private var honorSystemOrientationLockToggle: some View {
Toggle("Honor orientation lock", isOn: $honorSystemOrientationLock)
.disabled(!enterFullscreenInLandscape)
}
private var enterFullscreenInLandscapeToggle: some View { private var enterFullscreenInLandscapeToggle: some View {
Toggle("Enter fullscreen in landscape", isOn: $enterFullscreenInLandscape) Toggle("Enter fullscreen in landscape", isOn: $enterFullscreenInLandscape)
} }