iOS: unfolded upright never splits, always turns to landscape; orientation request re-checked until it takes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-11-20 09:58:48 -08:00
1 parent 566c5f7e8f
commit 5868430f8a
4 files changed
+26 -11

No files matched your search

+10 -2
View File
@@ -67,6 +67,8 @@ final class Ui {
}
/// True while an unfolded iPhone Duo shows Now Playing docked beside the library.
private(set) var split = false
/// Unfolded Duo in any orientation (a hinge is showing), even before it has turned to landscape.
private(set) var unfolded = false
/// Split only: the Now Playing tab (the deck) is selected instead of `tab`.
var deck = true
/// Split only: which of the deck's pages is showing.
@@ -123,7 +125,7 @@ final class Ui {
/// This phone has shown the Duo's folded status column at least once (saved).
private var duo = UserDefaults.standard.bool(forKey: "duoSeen")
/// Folded iPhone Duo: the outer display, kept upright.
var folded: Bool { duo && !split }
var folded: Bool { duo && !split && !unfolded }
/// Called with the window's side insets. Upright, only the folded Duo has a trailing one.
func sawInsets(trailing: CGFloat, upright: Bool) {
@@ -140,7 +142,7 @@ final class Ui {
func resumed() { lockOrientation() }
private func lockOrientation() {
if split { Orientation.lock(.landscape); return }
if split || unfolded { Orientation.lock(.landscape); return }
guard folded else { Orientation.lock(.allButUpsideDown); return }
Task { @MainActor in
try? await Task.sleep(for: .milliseconds(400))
@@ -148,6 +150,12 @@ final class Ui {
}
}
func setUnfolded(_ on: Bool) {
guard on != unfolded else { return }
unfolded = on
lockOrientation()
}
func setSplit(_ on: Bool) {
guard on != split else { return }
split = on