mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Attempt to fix orientation lock on iOS 16
This commit is contained in:
parent
a3ba1cb6df
commit
99e20f54a2
@ -342,7 +342,10 @@ struct PlayerControls: View {
|
|||||||
if player.lockedOrientation.isNil {
|
if player.lockedOrientation.isNil {
|
||||||
let orientationMask = OrientationTracker.shared.currentInterfaceOrientationMask
|
let orientationMask = OrientationTracker.shared.currentInterfaceOrientationMask
|
||||||
player.lockedOrientation = orientationMask
|
player.lockedOrientation = orientationMask
|
||||||
Orientation.lockOrientation(orientationMask)
|
let orientation = OrientationTracker.shared.currentInterfaceOrientation
|
||||||
|
Orientation.lockOrientation(orientationMask, andRotateTo: .landscapeLeft)
|
||||||
|
// iOS 16 workaround
|
||||||
|
Orientation.lockOrientation(orientationMask, andRotateTo: orientation)
|
||||||
} else {
|
} else {
|
||||||
player.lockedOrientation = nil
|
player.lockedOrientation = nil
|
||||||
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: OrientationTracker.shared.currentInterfaceOrientation)
|
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: OrientationTracker.shared.currentInterfaceOrientation)
|
||||||
|
@ -30,9 +30,6 @@ struct Orientation {
|
|||||||
|
|
||||||
logger.info("rotating to \(orientationString)")
|
logger.info("rotating to \(orientationString)")
|
||||||
|
|
||||||
UIDevice.current.setValue(rotateOrientation.rawValue, forKey: "orientation")
|
|
||||||
UINavigationController.attemptRotationToDeviceOrientation()
|
|
||||||
|
|
||||||
if #available(iOS 16, *) {
|
if #available(iOS 16, *) {
|
||||||
guard let windowScene = SafeArea.scene else { return }
|
guard let windowScene = SafeArea.scene else { return }
|
||||||
let rotateOrientationMask = rotateOrientation == .portrait ? UIInterfaceOrientationMask.portrait :
|
let rotateOrientationMask = rotateOrientation == .portrait ? UIInterfaceOrientationMask.portrait :
|
||||||
@ -43,6 +40,10 @@ struct Orientation {
|
|||||||
windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: rotateOrientationMask)) { error in
|
windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: rotateOrientationMask)) { error in
|
||||||
print("denied rotation \(error)")
|
print("denied rotation \(error)")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
UIDevice.current.setValue(rotateOrientation.rawValue, forKey: "orientation")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINavigationController.attemptRotationToDeviceOrientation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user