The tablet ran the phone layout with a half-finished iPad draft on top: two custom sidebars, a leftover overflow menu, split Files/Changes header buttons, and phone-width sheets stretched across a 13" screen. This brings it onto the phone's navigation model and keeps only the differences a large screen earns. - Sessions are a persistent resizable left sidebar; the overflow menu is gone and its destinations moved into that sidebar's footer (connected instance, settings, pending web update) and into the workspace drawer. - The workspace (Changes / Files / Terminal / Notes / MCP) is the phone's drawer everywhere: a resizable right sidebar where the screen can host one (up to 900px) and the full-cover drawer otherwise, with its mounted panes — an open diff, an edited file, an attached terminal — surviving rotation. - Header dropdowns are anchored popovers: the recents switcher mirrors the usage overlay on the left, and its trigger is sized to the title rather than to the free width. - App-level pages (settings, instances, update, an opened plan) render as centered dialogs instead of covering the screen. - Overlays center on the chat column through published insets, so the model and directory pickers no longer sit off-centre; the directory picker also stops overriding the shared width clamp. - Wide chat layout applies to mobile surfaces, where a tablet chat column is finally wide enough for the setting to mean anything. The layout gate is a live size class rather than a device check, so Android tablets and foldables are covered by the same code: - `enabled` when the shortest viewport side is at le sw600dp). The short side is what makes this a size question instead of a device question — a phone reports ~360-430 whichev unfolded book foldable ~600+, and folding shut drops back under it. iPads also answer on identity, since iPadOS hands out od - `roomyForPanels` when landscape and at least 1000px wide, which is what it takes to host the sidebar, the panel and a readabl foldables miss it in BOTH orientations — their long side is barely wider than a tablet's short one — so they keep the portr Every consumer re-decides instead of remembering wha open sidebar closes if the device folds shut under it. iPad behaviour is unchanged: its landscape widths all clear the panel ones do not, exactly as the previous orientation check did. Hardware keyboards are read natively. iOS reports them through GCKeyboard, published to the web layer at document start and kep disconnect and foregrounding; the layer stops inferring once that answers. A single early publish was not enough — the connect no already-attached keyboard fires before the page exists, and GameController can populate late — so the state is re-published across resume. With a keyboard attached the draft screen keeps its starter chips and the composer never collapses; tablets skip the colla Runtimes with no native answer fall back to inferring it from the keyboard bridge, and only ever conclude "hardware" from silen Also: sidebar rows no longer sit on a differently ti footer is no longer clipped by an over-tall content box, the resize handles moved above the panes' own overlays so they can actu now-unreachable overflow menu, fullscreen terminal/MCP/notes surfaces and their locale key are deleted. Device behaviour is unverified — the tablet layout, keyboard bridge and the foldable size class have not been exercised on hardware, and the 600/1000 thresholds are derived fr rather than measured on a foldable.
77 lines
5.4 KiB
Markdown
77 lines
5.4 KiB
Markdown
# OpenChamber Mobile
|
|
|
|
Capacitor shell for the dedicated OpenChamber mobile web surface.
|
|
|
|
The mobile package reuses the web build, then rewrites `mobile.html` to `index.html` in `packages/mobile/dist` so native iOS/Android always launch `MobileApp` instead of the hosted surface selector.
|
|
|
|
## Runtime Model
|
|
|
|
- The native app bundles the mobile UI only; it does not embed the OpenChamber web server or OpenCode server.
|
|
- On first launch in Capacitor, the app shows a connection screen for an existing OpenChamber server.
|
|
- Connections are saved locally in the app and can be managed from `Instances` in the sessions drawer footer (a persistent left sidebar on tablets).
|
|
- The connection screen and the `Instances` entry are Capacitor-only. Hosted `mobile.html` in a normal browser keeps the regular web behavior.
|
|
- Phones and tablets share one navigation model: a sessions drawer/sidebar on the left, the workspace drawer (Changes / Files / Terminal / Notes / MCP) on the right, and no overflow menu. Tablets differ only in that the sessions list is a resizable persistent sidebar and the header dropdowns are anchored popovers.
|
|
- The tablet layout is a live size class (`useTabletLayout`), not a device check: any surface whose short side is at least 600px gets it, and the workspace only becomes a side panel where the width can host the sidebar, the panel and a readable chat at once. Book foldables therefore pick it up when unfolded, keep the portrait layout in both orientations (their long side is barely wider than a tablet's short one), and drop back to the phone layout when folded shut. The Android activity declares the matching `configChanges`, so folding resizes the WebView instead of recreating it.
|
|
- Password-protected OpenChamber servers can be unlocked from the mobile app. The app stores the issued client token with the saved connection.
|
|
- The Terminal workspace surface runs its PTY on the active OpenChamber server over the shared authenticated runtime transport; it never opens a local shell on the phone or tablet. Closing the surface detaches the renderer while the server session remains available for reattachment. On touch devices, dragging scrolls the buffer while long-pressing and dragging selects terminal text.
|
|
|
|
## Commands
|
|
|
|
Run these from `packages/mobile`, or use the root `mobile:*` aliases.
|
|
|
|
- `bun run build`: builds `packages/web` and prepares mobile web assets.
|
|
- `bun run build:assets`: prepares mobile assets from an existing `packages/web/dist` build; the root workspace build uses this to avoid rebuilding web.
|
|
- `bun run sync`: prepares assets and runs `cap sync`.
|
|
- `bun run add:ios`: creates the native iOS project.
|
|
- `bun run add:android`: creates the native Android project.
|
|
- `bun run build:android:debug`: builds a debug Android APK without launching an emulator.
|
|
- `bun run build:ios:simulator`: builds an iOS Simulator app without launching Xcode or Simulator.
|
|
- `bun run sim:run`: boots a simulator if needed, installs the built iOS app, and launches it.
|
|
- `bun run sim:dev`: one-command dev loop — builds the simulator app, installs + launches it, starts the `serve-sim` stream, and prints the preview URL; Ctrl+C stops the stream. Pass `--no-build` to skip the build step.
|
|
- `bun run sim:serve`: starts `serve-sim` in detached JSON mode and prints the browser preview URL.
|
|
- `bun run sim:list`: lists running `serve-sim` streams.
|
|
- `bun run sim:kill`: stops running `serve-sim` streams.
|
|
- `bun run open:ios`: opens the iOS project.
|
|
- `bun run open:android`: opens the Android project.
|
|
|
|
## Headless Quickstart
|
|
|
|
```sh
|
|
bun run build
|
|
bun run sync
|
|
bun run build:ios:simulator
|
|
bun run build:android:debug
|
|
```
|
|
|
|
These commands build and sync the native projects without launching Xcode, Android Studio, Simulator, or an emulator.
|
|
|
|
## Local Tooling
|
|
|
|
The default scripts assume the local Homebrew/Xcode paths prepared for this workspace:
|
|
|
|
- Xcode: `/Applications/Xcode.app/Contents/Developer`
|
|
- JDK 21: `/opt/homebrew/opt/openjdk@21`
|
|
- Android SDK: `/opt/homebrew/share/android-commandlinetools`
|
|
|
|
Override `DEVELOPER_DIR`, `JAVA_HOME`, `ANDROID_HOME`, or `ANDROID_SDK_ROOT` when using a different local setup.
|
|
|
|
Required local tools:
|
|
|
|
- Xcode with iOS Simulator support.
|
|
- CocoaPods for iOS dependency installation.
|
|
- JDK 21 for Android Gradle builds.
|
|
- Android SDK command-line tools with platform/build-tools 35.
|
|
|
|
## Troubleshooting
|
|
|
|
- If `xcodebuild` reports that the active developer directory is Command Line Tools, keep using the provided scripts or set `DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer`.
|
|
- If Android builds fail with `Unable to locate a Java Runtime` or `source release: 21`, install/use JDK 21 and set `JAVA_HOME` accordingly.
|
|
- If Android SDK packages are missing, install `platform-tools`, `platforms;android-35`, and `build-tools;35.0.0`, then accept SDK licenses.
|
|
- If CocoaPods cannot find Capacitor pods after reinstalling dependencies, run `bun install` from the workspace root, then rerun `bun run sync`.
|
|
- If connecting to a remote OpenChamber server fails from the app while `/health` works in curl, check that the server build includes the packaged-client CORS allowlist for `capacitor://localhost` and local dev origins.
|
|
- If `serve-sim` preview says the stream is not producing frames, check the raw MJPEG stream before assuming the simulator stopped. In prior testing the raw stream worked while the browser preview UI stayed stale.
|
|
|
|
## Generated Assets
|
|
|
|
The native projects currently use Capacitor-generated launcher and splash assets. Replace them before release branding work.
|