Skip to content

#723 iPhone Duo support on iOS - #725

Merged
ivanfenenko merged 4 commits into
mainfrom
feature/723-iphone-duo-support
Oct 18, 2026
Merged

ivanfenenko merged 4 commits into
mainfrom
feature/723-iphone-duo-support

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Implements most of #723. The iOS app now uses both iPhone Duo displays: the iPad split on the opened inner display with its divider in the fold, and Duo-style vertical bars in the trailing status rail.

What changed

  • Split gate: the split no longer checks idiom == .pad, because Duo reports .phone in every pose. It now splits when the window is regular × regular and has at least 681pt of usable width (a 280pt minimum sidebar, the divider, and a 400pt minimum detail).
    • Duo Open/Book (867pt) splits.
    • Duo closed and Open, turned (669pt) stay stacked.
    • iPhone Pro Max landscape stays stacked.
    • A 13" iPad in half-and-half Split View (683pt) still splits.
    • The usable width comes from one root openCodeWindowMetrics(), shared by all five split screens.
  • Fold-aligned divider: OpenCodeSplitPane reads the fold with reservedRegions(kind: .division, options: .includeInactive) (iOS 27.1). By default the sidebar ends at the fold (455pt), the divider widens to the 40pt fold gap, and the chat starts at the fold's trailing edge.
  • Resizable like iPad, with a fold detent: the drag rules are unchanged (280–480pt, collapse under 220pt). Releasing within 24pt of the fold snaps the divider into it. A new persisted followsFold flag keeps a snapped divider tracking the fold, while a custom width stays custom. In Book pose the fold region is active, so the divider locks to the fold and the handle hides.
  • Duo vertical bar in OpenCodeTopBar: iOS never moves custom bars into the rail, so the top bar does it itself.
    • It draws Back/Close and its icon actions as 48pt items in the trailing rail, below the status column, in the order and spots measured from Apple's own bars.
    • Titles, the sidebar toggle and text actions stay horizontal.
    • It activates only when the vertical edge is .trailing, the bar reaches the trailing safe area, and it sits at the window top, so a split's sidebar keeps its horizontal bar.
    • The overflow menu opens beside its rail item.
    • iPhone and iPad layouts are unchanged.
  • Fold ↔ unfold continuity: Home tracks its stack as typed HomeRoutes, bound to the NavigationStack through a type-erased NavigationPath. A typed path binding trapped in SwiftUI (comparisonTypeMismatch) during the flip.
    • The open chat moves between the stack and the split detail with the same SessionChatViewModel, so the draft and live subscription carry over.
    • SessionChatHostLeases stops the model only when the last host leaves.

Verification

  • Full OpenCode MobileTests on the iOS 27.1 iPhone Duo simulator: 2159 Swift Testing tests in 215 suites passed, and 76 XCTest tests passed. New suites: HomeLayoutContinuityTests, OpenCodeVerticalBarLayoutTests, and new split-gate, fold and follow-fold cases in OpenCodeSplitPaneLayoutTests / SplitPanePreferencesTests.
  • Leading controls sit 20pt in while the Duo rail is active (the system bar's inset), clearing the 55pt display corner.
  • Real app built with Xcode 27.1 (binary stamped sdk 27.1), connected to a local opencode serve, and driven through every Device Hub pose. During that pass I fixed a rail inset bug (a reader that ignores the safe area reports no inset of its own) and the navigation-path crash on fold.
Closed: Home Closed: chat Closed, turned
Open: split in the fold Divider dragged off the fold Released near the fold: snapped
Book: locked to the fold Open, turned: stacked

Not done / known gaps

  • Not done: Xcode 27.1 on the CI release runner (iPhone Duo support #723 Remaining). The self-hosted mac-mini builds with Xcode 26.6 (iOS 26.5 SDK). The iOS 27.1 fold and vertical-bar calls sit behind #if canImport(SwiftUI, _version: 8.0.85), so that build compiles but leaves them out (no fold detection, no rail). The split gate and continuity still apply. Builds are Duo-optimized only once the runner moves to Xcode 27.1.
  • In Open, turned our header sits below the 82pt status band. Apple's bars sit inside the band beside the clock.
  • While the sidebar is visible, its toggle stays at the leading edge of the detail bar (as on iPad), not in the sidebar's own bar the way Apple's split does.
  • Across a flip, screens pushed inside a chat (Changes, Files, child sessions) close back to that chat, and the transcript scroll position isn't kept.
  • The first frame after the window appears may lay out before the fold is reported, then settle at 455pt.
  • Android: no counterpart. iPhone Duo is iOS hardware.

🤖 Generated with Claude Code


Note

Medium Risk
Touches core Home navigation, split persistence, and session chat lifecycle across layout transitions; Duo-specific APIs are SDK-gated so CI on older Xcode gets reduced behavior.

Overview
Adds iPhone Duo layout support on iOS: wide inner display gets iPad-style splits, a fold-aligned sidebar divider, and custom top-bar actions in the trailing vertical rail.

Split layout gate no longer requires iPad idiom (Duo reports .phone). Screens split when the window is regular × regular and usable width ≥ 681pt, via root openCodeWindowMetrics() and OpenCodeSplitLayoutGate on Home, Settings, Changes, Files, and Terminals.

Fold-aware split pane reads iOS 27.1 reservedRegions divisions, widens the divider in the hinge gap, snaps within 24pt, and persists followsFold. Book pose locks the divider and disables drag.

OpenCodeTopBar moves Back/Close and icon actions into the Duo vertical rail (OpenCodeTopBarVerticalBarLayer); overflow menus anchor beside the rail item. Gallery/preview simulation added.

Home fold ↔ unfold continuity: typed HomeRoute stack, shared SessionChatViewModel with SessionChatHostLeases, and HomeLayoutContinuity so the open chat survives layout flips without losing draft/subscription.

Reviewed by Cursor Bugbot for commit 138e749. Bugbot is set up for automated code reviews on this repo. Configure here.

ivanfenenko and others added 2 commits October 18, 2026 22:39
Split by regular x regular size class and usable width instead of iPad idiom,
so the opened iPhone Duo gets the split. The default divider sits in the fold,
stays resizable with a fold detent, and locks to the fold in Book pose.
OpenCodeTopBar draws Back and icon actions in the Duo trailing vertical bar
like the system bar does. The open session and its view model carry across
fold and unfold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI builds with Xcode 26.6 (iOS 26.5 SDK). Gate the iOS 27.1 reserved-region
and vertical-bar APIs behind canImport(SwiftUI, _version: 8.0.85), since
#available alone does not compile against the older SDK, and keep the split
gate property non-private so SettingsView keeps its memberwise initializer.

Inset a horizontal leading control 20pt while the Duo vertical bar is active,
as the system bar does, so it clears the inner display's rounded corner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 138e749. Configure here.

ivanfenenko and others added 2 commits October 18, 2026 23:57
Keep main's OverflowMenuPlacement API and add the iPhone Duo rail as a
besideRailItem placement.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Leaving a chat now releases the screen's host lease instead of stopping the
shared view model, so a fold/unfold hand-off cannot leave the other screen
frozen. The vertical bar reads toolbarVerticalEdge from the environment
synchronously instead of through an onAppear probe, so the rail is right on
the first layout. The Duo 20pt leading inset now follows the vertical-bar
context rather than the presence of rail items, so the empty-state toggle
clears the corner too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant