Dev 35: Duo orientation lock, folded portrait only, unfolded landscape only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-11-19 15:41:59 -08:00
1 parent 406895a3f0
commit 9f68aa588b
3 files changed
+17 -6

No files matched your search

+3 -3
View File
@@ -34,13 +34,13 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
enum Orientation {
nonisolated(unsafe) static var mask: UIInterfaceOrientationMask = .allButUpsideDown
@MainActor static func lock(_ upright: Bool) {
let m: UIInterfaceOrientationMask = upright ? .portrait : .allButUpsideDown
/// Folded Duo: portrait only. Unfolded Duo: landscape only. Anything else turns freely.
@MainActor static func lock(_ m: UIInterfaceOrientationMask) {
guard m != mask else { return }
mask = m
for case let scene as UIWindowScene in UIApplication.shared.connectedScenes {
scene.keyWindow?.rootViewController?.setNeedsUpdateOfSupportedInterfaceOrientations()
if upright { scene.requestGeometryUpdate(.iOS(interfaceOrientations: .portrait)) { _ in } }
if m != .allButUpsideDown { scene.requestGeometryUpdate(.iOS(interfaceOrientations: m)) { _ in } }
}
}
}