You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 15e87df
Browse filesBrowse the repository at this point in the historyBrowse files
Replace the native mobile UI with a WebView shell around the PWA (#2515)
## Human comments
<!-- Agents: Do not fill in this section. This is for human users to
fill in. -->
## What was wrong
`apps/mobile` carried about 112,000 lines of native UI duplicating what
`apps/app` already renders, so every product feature needed two
implementations. The plan (Docs `plans/mobile-webview-shell.md`)
replaces the
native screens with one WebView over the page, keeping native only what
a web
page cannot do on a phone.
## What changed
Five commits, in order:
1. **`@bb/mobile-bridge`** — one versioned contract both sides import:
the
handshake the shell installs, page-to-shell messages, shell-to-page
events,
and the injected script itself, so the `window.bb.native` global cannot
drift. `compareBridgeVersions(remoteVersion, localVersion)` is
symmetric;
capabilities are declared in the handshake rather than inferred from the
version, so a shell can withdraw one without a bump.
2. **The shell** — `ProfileWebViewScreen`, pure logic in `src/lib/shell`
tested
under node, native error states (re-pair / retry / content-process
reload),
and deep links that resolve to one shell route carrying a *web* path.
The
session is not re-implemented: the existing connector already mints and
renews the connect cookie.
3. **The page side** — `src/lib/native-shell` with `shellHaptic`,
`shellSetBadge`, `shellOpenExternal`, `shellShare`, `shellOpenNative`,
each
falling back to web behaviour. The app surface header is now `mobile`
inside
the shell. Two fixes come from the Phase 0 measurements: the bottom
safe-area inset collapses while the keyboard is open, and voice input
names
the real reason it is unavailable on a plain-HTTP origin.
4. **End-to-end coverage** — the mobile e2e harness serves a built
`apps/app`
when `BB_MOBILE_E2E_SERVE_APP=1`, because the shell has no page
otherwise.
5. **The delete** — 620 files, 95,754 deletions. `apps/mobile` falls to
about
24,000 lines. 24 dependencies, three Expo config plugins, the committed
terminal page and its builder go with it.
A native `/settings/device` screen holds what the phone owns and is the
shell's
escape hatch. Three entry points reach it — a row in the page's Settings
over
the bridge, the shell's load-failure screen, and a Home Screen quick
action —
and only the first needs a live page. That matters: after the delete
there is
no native UI to fall back to.
No wire change: `HOST_DAEMON_PROTOCOL_VERSION` is untouched. `mobile`
was
already in `REQUEST_APP_SURFACE_VALUES`.
## How you verified
Automated: 0 lint errors, typecheck clean, and 23 + 286 + 3,437 tests
across
`@bb/mobile-bridge`, `@bb/mobile`, and `@bb/app` after rebasing onto
`main`.
On an iPhone 17 Pro simulator (iOS 26.3), the four CI flows pass against
the
e2e harness on a build made after the dependency prune: `shell-launch`,
`shell-deep-link`, `shell-send` (send a message, assert the provider's
echo),
and `shell-unreachable-server`.
On a physical iPhone 15 Pro (iOS 26.6), a Release build installs and
runs, and
the Home Screen quick action reaches device settings — the one entry
point
simulator automation could not exercise.
Phase 0 measured the risky parts on device before any of this was built;
the
numbers and verdicts are in section 11 of the plan. The keyboard fix
moved the
composer-to-keyboard gap from 60 CSS px to 26, against about 15 for the
old
native composer.
Three bugs the tests caught before they shipped: `z.string().url()`
accepts
`javascript:` and `data:`, and `open-external` reaches the system link
opener;
first run behind the shell spun forever with no server paired; and the
shell
preference survived a state wipe because it cached its value.
EAP codename scan over `origin/main..HEAD`: clean (working tree, tracked
at
HEAD, added lines, commit messages all 0).
### Known gaps
- **`navigator.serviceWorker` does not exist in WKWebView** on any
origin bb
needs. It requires app-bound domains, which would both break Direct mode
and
disable JavaScript injection for any web view that does not opt in —
killing
the bridge. The service worker is therefore dropped from the plan, not
deferred. Measured cold start is 142 ms (LAN) to 2.1 s (a shaped 3G
link),
which is acceptable without it.
- **Camera capture is unverified.** The WKWebView file chooser offers it
and
the photo-library path is proven end to end, but the simulator has no
camera
and I did not exercise it on the device.
- `shell-unreachable-server` covers the add-server probe refusing a dead
URL,
not the shell's own load-failure screen. That path is hand-verified;
automating it needs a harness that can stop answering mid-flow.
- About 5,800 lines of `src/lib/query`, `src/lib/realtime`, and the
connection
layer survive. They are reachable only through the session-cookie path
the
WebView needs, so removing them is a refactor of the connector rather
than a
delete, and it would cost the native chrome its server palette.
> AGENT GENERATED
---------
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
0 commit comments