iOS: free orientation in background, re-lock after resume settles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
639b5368ff
commit
56c92e8b93
2 files changed
+14
-2
No files matched your search
@@ -139,7 +139,17 @@ final class Ui {
|
||||
/// Split (unfolded) goes landscape at once. Portrait waits a moment and checks again, so a
|
||||
/// frame without a hinge reading mid-rotation can't throw an unfolded phone back upright.
|
||||
/// Back in the foreground: the phone may have been folded or unfolded meanwhile.
|
||||
func resumed() { lockOrientation() }
|
||||
/// The split/unfolded flags are from before the app left, so locking on them at once can force
|
||||
/// landscape on a phone folded meanwhile. Free the rotation while away and decide again once
|
||||
/// the window has settled to the screen it came back on.
|
||||
func resumed() {
|
||||
Task { @MainActor in
|
||||
try? await Task.sleep(for: .milliseconds(300))
|
||||
self.lockOrientation()
|
||||
}
|
||||
}
|
||||
|
||||
func backgrounded() { Orientation.lock(.allButUpsideDown) }
|
||||
|
||||
private func lockOrientation() {
|
||||
if split || unfolded { Orientation.lock(.landscape); return }
|
||||
|
||||
Reference in new issue
Block a user