Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(ios): let the remote screen follow how the phone is held

leepokaib6eca08add81
diff --git a/docs/features/remote-screen.md b/docs/features/remote-screen.md
index cecd32f3..0f3613f7 100644
--- a/docs/features/remote-screen.md
+++ b/docs/features/remote-screen.md
@@ -15,6 +15,18 @@ Connections prepared through the cloud use a **4 Mbps / 30 fps** encoding limit
A cloud outage or missing TURN configuration produces an explicit error. A successful chat relay connection alone does not prove that media or input works.
+## Phone orientation
+
+Opening the iPhone viewer enables portrait and both landscape orientations without
+requesting a forced turn. UIKit chooses the orientation based on how the phone is
+held and the system rotation lock. The Rotate button remains available for an
+explicit override. Closing the last viewer restores the app's portrait layout.
+The video fits the available bounds, and touch coordinates use the resized viewport.
+
+The iPad already supports all orientations. macOS, Linux GTK and the TUI do not
+use the iPhone viewer or its orientation policy; the capture helpers stream the
+computer display without choosing the phone's orientation.
+
## Boundaries
- `host/src/screen.rs` coordinates access to the local helper and owns viewer sessions. Another device cannot renegotiate or close a session it does not own.
@@ -49,6 +61,9 @@ Run cloud tests/type checking, host formatting/Clippy/tests, Swift package tests
Live acceptance requires the configured Worker and fresh host/helper/phone builds:
- Check screen-recording and input permissions, capture, click/type/scroll, clipboard, display changes and closing the viewer.
+- Open the iPhone viewer while upright and while already held sideways, then rotate
+ in both directions. Check video fitting and direct taps after each turn. Repeat
+ with rotation lock on and with the Rotate button; closing returns to portrait.
- Repeat with the phone on cellular and the computer on a different network, without Tailscale. Verify a selected ICE candidate pair with `candidateType=relay` in WebRTC diagnostics and observe Realtime egress; signaling via Cloudflare alone is insufficient.
- Verify UDP-blocked connectivity using TURN over TCP/TLS 443.
- Verify Wi-Fi/cellular changes, reconnect after sleep and renewal before the one-hour expiry.
diff --git a/kit/Sources/CodyncUI/Screen/ScreenView.swift b/kit/Sources/CodyncUI/Screen/ScreenView.swift
index 44454037..a64f88d6 100644
--- a/kit/Sources/CodyncUI/Screen/ScreenView.swift
+++ b/kit/Sources/CodyncUI/Screen/ScreenView.swift
@@ -116,8 +116,7 @@ public struct ScreenView: View {
.transition(.opacity)
}
Spacer()
- // Turning the phone does nothing while iOS rotation lock is on, and a phone held
- // upright stays in the landscape the viewer opened in until it is turned.
+ // Allow an explicit rotation even when the user has enabled iOS rotation lock.
OverlayButton("Rotate", "rotate.right") { OrientationLock.toggle() }
if session != nil {
if interactive {
@@ -323,10 +322,10 @@ public enum OrientationLock {
/// The delayed rotate from the last open or close; a newer request or a rotate tap cancels it.
private static var pending: Task<Void, Never>?
- /// The first open viewer allows every orientation and turns to landscape, once per presentation.
+ /// Allow rotation while viewing, leaving the initial direction and rotation lock to iOS.
static func viewerAppeared() {
viewers += 1
- if viewers == 1 { set(.allButUpsideDown, prefer: .landscapeRight) }
+ if viewers == 1 { set(.allButUpsideDown) }
}
/// The last viewer to close brings the app back to portrait.
@@ -335,15 +334,16 @@ public enum OrientationLock {
if viewers == 0 { set(.portrait, prefer: .portrait) }
}
- private static func set(_ newMask: UIInterfaceOrientationMask, prefer: UIInterfaceOrientationMask) {
+ private static func set(_ newMask: UIInterfaceOrientationMask, prefer: UIInterfaceOrientationMask? = nil) {
guard UIDevice.current.userInterfaceIdiom == .phone else { return }
mask = newMask
pending?.cancel()
- // Once the full-screen cover is up: every controller in the chain re-reads the mask, then rotate.
+ // Once the overlay is up, let UIKit reevaluate the device's current orientation.
pending = Task { @MainActor in
guard (try? await Task.sleep(for: .milliseconds(100))) != nil else { return }
let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }
scenes.forEach(reloadMask)
+ guard let prefer else { return }
guard (try? await Task.sleep(for: .milliseconds(150))) != nil else { return }
// Best effort: turning the phone always works once the mask allows it.
for scene in scenes { scene.requestGeometryUpdate(.iOS(interfaceOrientations: prefer)) }