From 4e4add3c4238f4be1d9928452f1fbbfbeb02012c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20F=C3=B6rster?= Date: Fri, 6 Sep 2024 16:47:03 +0200 Subject: [PATCH] fix double rotation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Toni Förster --- Model/Player/PlayerModel.swift | 8 ++++---- Shared/Player/AppleAVPlayerView.swift | 6 +++--- Shared/Settings/BrowsingSettings.swift | 2 +- Shared/YatteeApp.swift | 2 +- Yattee.xcodeproj/project.pbxproj | 6 ++---- iOS/AppDelegate.swift | 2 +- iOS/Orientation.swift | 2 +- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Model/Player/PlayerModel.swift b/Model/Player/PlayerModel.swift index 5c939104..f00ab36a 100644 --- a/Model/Player/PlayerModel.swift +++ b/Model/Player/PlayerModel.swift @@ -568,7 +568,7 @@ final class PlayerModel: ObservableObject { if lockPortraitWhenBrowsing { Orientation.lockOrientation(.portrait, andRotateTo: .portrait) } else { - Orientation.lockOrientation(.allButUpsideDown) + Orientation.lockOrientation(.all) } #endif } @@ -822,7 +822,7 @@ final class PlayerModel: ObservableObject { } else { isOrientationLocked = false lockedOrientation = nil - Orientation.lockOrientation(.allButUpsideDown) + Orientation.lockOrientation(.all) } } #endif @@ -1167,7 +1167,7 @@ final class PlayerModel: ObservableObject { Orientation.lockOrientation( isOrientationLocked ? (lockOrientation == .landscapeRight ? .landscapeRight : .landscapeLeft) - : .landscape, + : .all, andRotateTo: orientation ) } @@ -1181,7 +1181,7 @@ final class PlayerModel: ObservableObject { lockedOrientation = UIInterfaceOrientationMask.portrait } let rotationOrientation = lockPortraitWhenBrowsing ? UIInterfaceOrientation.portrait : nil - Orientation.lockOrientation(lockPortraitWhenBrowsing ? .portrait : .allButUpsideDown, andRotateTo: rotationOrientation) + Orientation.lockOrientation(lockPortraitWhenBrowsing ? .portrait : .all, andRotateTo: rotationOrientation) } #endif } diff --git a/Shared/Player/AppleAVPlayerView.swift b/Shared/Player/AppleAVPlayerView.swift index a0b78a8e..98d784fa 100644 --- a/Shared/Player/AppleAVPlayerView.swift +++ b/Shared/Player/AppleAVPlayerView.swift @@ -22,8 +22,8 @@ import SwiftUI // not sure why but first rotation call is ignore so doing rotate to same orientation first Delay.by(delay) { let orientation = OrientationTracker.shared.currentDeviceOrientation.isLandscape ? OrientationTracker.shared.currentInterfaceOrientation : self.rotateToLandscapeOnEnterFullScreen.interfaceOrientation - Orientation.lockOrientation(.allButUpsideDown, andRotateTo: OrientationTracker.shared.currentInterfaceOrientation) - Orientation.lockOrientation(.allButUpsideDown, andRotateTo: orientation) + Orientation.lockOrientation(.all, andRotateTo: OrientationTracker.shared.currentInterfaceOrientation) + Orientation.lockOrientation(.all, andRotateTo: orientation) } } } @@ -37,7 +37,7 @@ import SwiftUI if !context.isCancelled { #if os(iOS) if Constants.isIPhone { - Orientation.lockOrientation(.allButUpsideDown, andRotateTo: .portrait) + Orientation.lockOrientation(.all, andRotateTo: .portrait) } if wasPlaying { diff --git a/Shared/Settings/BrowsingSettings.swift b/Shared/Settings/BrowsingSettings.swift index 632834aa..1f7a8d3e 100644 --- a/Shared/Settings/BrowsingSettings.swift +++ b/Shared/Settings/BrowsingSettings.swift @@ -170,7 +170,7 @@ struct BrowsingSettings: View { Orientation.lockOrientation(.portrait, andRotateTo: .portrait) } else { enterFullscreenInLandscape = false - Orientation.lockOrientation(.allButUpsideDown) + Orientation.lockOrientation(.all) } } } diff --git a/Shared/YatteeApp.swift b/Shared/YatteeApp.swift index 8ed8cf94..a072d909 100644 --- a/Shared/YatteeApp.swift +++ b/Shared/YatteeApp.swift @@ -211,7 +211,7 @@ struct YatteeApp: App { let rotationOrientation = OrientationTracker.shared.currentDeviceOrientation.rawValue == 4 ? UIInterfaceOrientation.landscapeRight : (OrientationTracker.shared.currentDeviceOrientation.rawValue == 3 ? UIInterfaceOrientation.landscapeLeft : UIInterfaceOrientation.portrait) - Orientation.lockOrientation(.allButUpsideDown, andRotateTo: rotationOrientation) + Orientation.lockOrientation(.all, andRotateTo: rotationOrientation) } } #endif diff --git a/Yattee.xcodeproj/project.pbxproj b/Yattee.xcodeproj/project.pbxproj index fc1539e0..9a1fa90e 100644 --- a/Yattee.xcodeproj/project.pbxproj +++ b/Yattee.xcodeproj/project.pbxproj @@ -4367,8 +4367,7 @@ INFOPLIST_KEY_UIRequiresFullScreen = YES; INFOPLIST_KEY_UIStatusBarHidden = NO; INFOPLIST_KEY_UIStatusBarStyle = ""; - INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -4418,8 +4417,7 @@ INFOPLIST_KEY_UIRequiresFullScreen = YES; INFOPLIST_KEY_UIStatusBarHidden = NO; INFOPLIST_KEY_UIStatusBarStyle = ""; - INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index e6ee8a08..94f2e46e 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -5,7 +5,7 @@ import Logging import UIKit final class AppDelegate: UIResponder, UIApplicationDelegate { - var orientationLock = UIInterfaceOrientationMask.allButUpsideDown + var orientationLock = UIInterfaceOrientationMask.all private var logger = Logger(label: "stream.yattee.app.delegate") private(set) static var instance: AppDelegate! diff --git a/iOS/Orientation.swift b/iOS/Orientation.swift index 8371c012..23798e7f 100644 --- a/iOS/Orientation.swift +++ b/iOS/Orientation.swift @@ -34,7 +34,7 @@ enum Orientation { let rotateOrientationMask = rotateOrientation == .portrait ? UIInterfaceOrientationMask.portrait : rotateOrientation == .landscapeLeft ? .landscapeLeft : rotateOrientation == .landscapeRight ? .landscapeRight : - .allButUpsideDown + .all windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: rotateOrientationMask)) { error in print("denied rotation \(error)")