Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
93a4892
fix(mobile): the page's tab and dock taps keep the keyboard up
Jinwoo-H Sep 26, 2026
b5023bf
chore(mobile): register the page's keyboard-persisting-taps override
Jinwoo-H Sep 26, 2026
5e561e6
fix(mobile): the session hears a row-pitch change in the keyboard met…
Jinwoo-H Sep 26, 2026
c7b9e9e
fix(mobile): native desktop display mode lifts only what the keyboard…
Jinwoo-H Sep 26, 2026
ec7ba2e
feat(mobile): the keyboard covers the page like a native screen, and …
Jinwoo-H Sep 26, 2026
b3b9f33
feat(mobile): the page reads the keyboard the shell says covers it
Jinwoo-H Sep 26, 2026
007accc
fix(mobile): an older page is never handed the keyboard height
Jinwoo-H Sep 26, 2026
0a09a7b
Revert "fix(mobile): native desktop display mode lifts only what the …
Jinwoo-H Sep 26, 2026
85e65ca
Revert "fix(mobile): the session hears a row-pitch change in the keyb…
Jinwoo-H Sep 26, 2026
4bf6c20
fix(mobile): a tap keeps the keyboard only for a pressable inside its…
Jinwoo-H Sep 26, 2026
b179bf7
fix(mobile): the iOS page's keyboard carries no form accessory bar
Jinwoo-H Sep 26, 2026
2a3d46a
fix(mobile): the shell hands the page the keyboard's height above the…
Jinwoo-H Sep 26, 2026
15204c8
refactor(mobile): the shell's keyboard geometry is one function besid…
Jinwoo-H Sep 26, 2026
333a0bb
fix(mobile): the shell hands the page the keyboard height native scre…
Jinwoo-H Sep 26, 2026
16c9228
fix(mobile): keyboard and inset arithmetic branches on the host OS, n…
Jinwoo-H Sep 26, 2026
b8f792c
fix(mobile): the iOS WebView no longer scrolls the page to reveal a f…
Jinwoo-H Sep 26, 2026
521fd7f
fix(mobile): the live input's keyboard reopen and the dock's keyboard…
Jinwoo-H Sep 26, 2026
29603d7
Merge origin/main into ota-fu-shell-keyboard-overlay
Jinwoo-H Sep 26, 2026
13bba06
refactor(mobile): the shell never resizes the WebView for the keyboard
Jinwoo-H Sep 27, 2026
43e355b
test(mobile): the shell keyboard census reads its directory from impo…
Jinwoo-H Sep 27, 2026
8e63bce
Merge origin/main into ota-fu-shell-keyboard-overlay
Jinwoo-H Sep 27, 2026
6ab349e
feat(mobile): the shell requires a page at least as new as itself
Jinwoo-H Sep 27, 2026
0b9f34d
refactor(mobile): the shell negotiates nothing with a page above its …
Jinwoo-H Sep 27, 2026
34a8fdd
test(mobile): read Back notifies past the paint report every page now…
Jinwoo-H Sep 27, 2026
14286db
Merge origin/main into ota-fu-shell-keyboard-overlay
Jinwoo-H Sep 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions config/scripts/mobile-web-app-agent-history-render.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
createBundleServer,
installShellDouble,
readBridgeFaultGrant,
readBridgePagePainted,
readBridgeProtocolVersion,
readShellCsp
} from './mobile-web-app-render-harness.mjs'
Expand Down Expand Up @@ -110,6 +111,7 @@ let routeChunks = {}
let cspHeader = null
let bridgeVersion = null
let faultGrant = null
let paintName = null

beforeAll(async () => {
if (!bundles) {
Expand All @@ -118,6 +120,7 @@ beforeAll(async () => {
cspHeader = await readShellCsp()
bridgeVersion = await readBridgeProtocolVersion()
faultGrant = await readBridgeFaultGrant()
paintName = await readBridgePagePainted()
scratch = await mkdtemp(join(tmpdir(), 'orca-mobile-web-app-agent-history-'))
const built = await buildMobileWebAppBundle({ outDir: join(scratch, 'bundle') })
routeChunks = built.routeChunks
Expand Down Expand Up @@ -227,9 +230,11 @@ async function openRoute(route, awaitText, options = {}) {
return opened
}

/** Every grant-gated notify the page posted, whole and in order, as the shell received them. */
function readNotifies(page) {
return page.evaluate(() => globalThis.__orcaRenderCheckNotifies ?? [])
/** Every grant-gated notify the page posted, whole and in order, as the shell received them. The
* paint report is not one: every page posts it once its route screen has a frame. */
async function readNotifies(page) {
const notifies = await page.evaluate(() => globalThis.__orcaRenderCheckNotifies ?? [])
return notifies.filter((frame) => frame.name !== paintName)
}

describeRender('the agent-history route in a real browser', () => {
Expand Down
3 changes: 0 additions & 3 deletions config/scripts/mobile-web-app-drawer-render.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,6 @@ describeDrawer('the device Back key reaching a sheet on the page', () => {
host: SHELL_HOST,
storage: {},
faultGrant,
// What a shell that knows the lane offers, and the frame it would send. Without the first
// the page posts no claim at all, which is the older-shell arm the unit suites pin.
accepts: [backNames.claim],
backFrame: backNames.frame
})
await page.goto(`${origin}/`, { waitUntil: 'load' })
Expand Down
15 changes: 4 additions & 11 deletions config/scripts/mobile-web-app-render-harness.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ export async function readBrowserFrameQuality() {
}

/**
* The page's client-identity placeholder and the `init.accepts` name that unlocks it, read from
* the module that declares both. A rig carrying its own copy would go on passing after the real
* pair moved, which is the whole reason every other constant here is read rather than retyped.
* The page's client-identity placeholder, read from the module that declares it. A rig carrying its
* own copy would go on passing after the real one moved, which is the whole reason every other
* constant here is read rather than retyped.
*/
export async function readBridgePageClientIdentity() {
const source = await readFile(
Expand All @@ -180,10 +180,7 @@ export async function readBridgePageClientIdentity() {
}
return match[1]
}
return {
placeholder: read('BRIDGE_PAGE_CLIENT_ID'),
accept: read('BRIDGE_PAGE_CLIENT_IDENTITY_ACCEPT')
}
return { placeholder: read('BRIDGE_PAGE_CLIENT_ID') }
}

/** The grant the shell offers every page, read from the same source for the same reason. */
Expand Down Expand Up @@ -264,7 +261,6 @@ export function installShellDouble({
grants,
pageRoutes = null,
pageRouteGrants = null,
accepts = null,
backFrame = null,
replies,
streams = [],
Expand Down Expand Up @@ -323,9 +319,6 @@ export function installShellDouble({
// Omitted when the caller names none, which is the older-shell case the page falls back
// on: an absent field is not an empty one, and the page reads the difference.
...(pageRouteGrants === null ? {} : { pageRouteGrants }),
// Omitted when a check names none, which is the shell that performs no swap and the
// state every other rig in this directory runs in.
...(accepts === null ? {} : { accepts }),
// Omitted for a shell too old to name one, which is the case the page has a panel for.
...(route === null ? {} : { route }),
...(host === null ? {} : { host }),
Expand Down
13 changes: 3 additions & 10 deletions config/scripts/mobile-web-app-render.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ async function openPage({
shellHost = SHELL_HOST,
shellStorage = {},
shellGrants,
shellPageRoutes = null,
shellAccepts = null
shellPageRoutes = null
} = {}) {
const page = await browser.newPage({ viewport: { width: 390, height: 844 } })
if (shellRoute !== undefined) {
Expand All @@ -151,8 +150,7 @@ async function openPage({
storage: shellStorage,
faultGrant,
grants: shellGrants ?? [faultGrant],
pageRoutes: shellPageRoutes,
accepts: shellAccepts
pageRoutes: shellPageRoutes
})
}
const errors = []
Expand Down Expand Up @@ -587,11 +585,7 @@ describeRender('the Route A page in a real browser', () => {
})
)
try {
// The one case that advertises the report, because it is the only one asserting on it.
const opened = await openPage({
shellRoute: { pathname: HOST_ROUTE },
shellAccepts: [paintName]
})
const opened = await openPage({ shellRoute: { pathname: HOST_ROUTE } })
await opened.page.goto(`${origin}/`, { waitUntil: 'load' })
await opened.page.waitForFunction(
() => document.documentElement.dataset.orcaWebEntry === 'mounted',
Expand Down Expand Up @@ -639,7 +633,6 @@ describeRender('the Route A page in a real browser', () => {
const route = `${HOST_ROUTE}/pr/render-check-tree`
const opened = await openPage({
shellRoute: { pathname: route },
shellAccepts: [paintName],
shellPageRoutes: [HOST_ROUTE_PATTERN, '/h/[hostId]/pr/[worktreeId]']
})
await opened.page.goto(`${origin}/`, { waitUntil: 'load' })
Expand Down
2 changes: 0 additions & 2 deletions config/scripts/mobile-web-app-session-terminal-init.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ async function openSessionWithTerminalTab() {
faultGrant,
grants: [faultGrant, ...sessionGrants()],
pageRoutes: PAGE_ROUTE_PATTERNS,
// The page claims an identity only against a shell that says it swaps one in.
accepts: [pageClientIdentity.accept],
streams: ['session.tabs.subscribe', 'terminal.subscribe'],
replies: {
'worktree.show': { worktree: { id: WORKTREE, name: WORKTREE, path: `/tmp/${WORKTREE}` } },
Expand Down
14 changes: 10 additions & 4 deletions config/scripts/mobile-web-bundle-manifest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ export function hashedAsset(bytes, extension) {
}
}

function readIntegerConstant(source, name) {
function readIntegerConstant(source, name, file = 'src/shared/protocol-version.ts') {
const match = new RegExp(`export const ${name} = (\\d+)`).exec(source)
if (!match) {
throw new Error(
`[mobile-web-bundle-manifest] ${name} not found in src/shared/protocol-version.ts`
)
throw new Error(`[mobile-web-bundle-manifest] ${name} not found in ${file}`)
}
return Number.parseInt(match[1], 10)
}
Expand All @@ -94,6 +92,13 @@ export async function readProtocolWindow() {
}
}

/** The page's build number, parsed for the same reason the protocol window is. */
export async function readPageVersion() {
const file = join('src', 'shared', 'mobile-web-bundle', 'manifest-contract.ts')
const source = await readFile(join(projectDir, file), 'utf8')
return readIntegerConstant(source, 'MOBILE_WEB_PAGE_VERSION', file)
}

export async function readDesktopVersion() {
const packageJson = JSON.parse(await readFile(join(projectDir, 'package.json'), 'utf8'))
if (typeof packageJson.version !== 'string' || packageJson.version.length === 0) {
Expand Down Expand Up @@ -124,6 +129,7 @@ export async function writeMobileWebBundleTree({
desktopVersion,
minCompatibleRuntimeProtocolVersion: protocolWindow.minCompatibleRuntimeProtocolVersion,
runtimeProtocolVersion: protocolWindow.runtimeProtocolVersion,
pageVersion: await readPageVersion(),
entrypoint: MOBILE_WEB_BUNDLE_ENTRYPOINT,
totalBytes: assets.reduce((total, asset) => total + asset.byteLength, 0),
assets,
Expand Down
35 changes: 34 additions & 1 deletion config/scripts/mobile-web-bundle-manifest.test.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { mkdtemp, readFile, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { describe, expect, it } from 'vitest'
import {
computeMobileWebBundleBuildId,
contentTypeForExtension,
hashedAsset,
serializeMobileWebBundleAssets
serializeMobileWebBundleAssets,
sha256Hex,
writeMobileWebBundleTree
} from './mobile-web-bundle-manifest.mjs'
import { MobileWebBundleManifestSchema } from '../../src/shared/mobile-web-bundle/manifest-contract.js'

describe('computeMobileWebBundleBuildId', () => {
const assets = [
Expand Down Expand Up @@ -55,3 +61,30 @@ describe('hashedAsset', () => {
expect(() => hashedAsset(Buffer.from('body'), 'wasm')).toThrow(/no content type registered/)
})
})

describe('writeMobileWebBundleTree', () => {
it('stamps the page version the contract names, which the shell floors on', async () => {
const outDir = await mkdtemp(join(tmpdir(), 'mobile-web-bundle-manifest-'))
try {
const bytes = Buffer.from('<!doctype html>\n', 'utf8')
const entry = {
path: 'index.html',
bytes,
sha256: sha256Hex(bytes),
byteLength: bytes.byteLength,
contentType: contentTypeForExtension('html')
}
await writeMobileWebBundleTree({
outDir,
written: [entry],
desktopVersion: '1.0.0',
protocolWindow: { runtimeProtocolVersion: 3, minCompatibleRuntimeProtocolVersion: 3 }
})
const manifest = JSON.parse(await readFile(join(outDir, 'manifest.json'), 'utf8'))
expect(Number.isInteger(manifest.pageVersion)).toBe(true)
expect(MobileWebBundleManifestSchema.parse(manifest).pageVersion).toBe(manifest.pageVersion)
} finally {
await rm(outDir, { recursive: true, force: true })
}
})
})
3 changes: 2 additions & 1 deletion mobile/app/h/[hostId]/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { displayHostEndpoint } from '../../../src/transport/host-endpoint'
import { resolveHostEndpointEdit } from '../../../src/transport/host-endpoint-edit'
import { usePrimeHosts, useRefreshHostClient } from '../../../src/transport/client-context'
import type { HostProfile } from '../../../src/transport/types'
import { hostOs } from '../../../src/platform/host-os'

export default function EditHostScreen() {
const router = useRouter()
Expand Down Expand Up @@ -179,7 +180,7 @@ export default function EditHostScreen() {
) : (
<KeyboardAvoidingView
style={styles.flex}
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
behavior={hostOs() === 'ios' ? 'padding' : undefined}
>
<ScrollView
contentContainerStyle={[styles.form, { paddingBottom: insets.bottom + spacing.xl }]}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import ObjectiveC
import UIKit
import WebKit

/// Removes WKWebView's form accessory bar (up, down, done). Native screens have none, and the
/// keyboard event the shell publishes counts it, so the page lifted by the bar as well. WebKit
/// exposes no switch, so the content view is moved onto a subclass whose `inputAccessoryView` is
/// nil, the same technique react-native-webview's `hideKeyboardAccessoryView` uses.
func hideKeyboardAccessoryBar(of webView: WKWebView) {
guard
let content = webView.scrollView.subviews.first(where: {
String(describing: type(of: $0)).hasPrefix("WKContent")
})
else {
return
}
let base: AnyClass = type(of: content)
let name = "\(NSStringFromClass(base))_OrcaNoAccessory"
let subclass: AnyClass
if let existing = NSClassFromString(name) {
subclass = existing
} else {
guard let created = objc_allocateClassPair(base, name, 0) else {
return
}
let noAccessory: @convention(block) (AnyObject) -> UIView? = { _ in nil }
let selector = #selector(getter: UIResponder.inputAccessoryView)
let typeEncoding = method_getTypeEncoding(class_getInstanceMethod(UIResponder.self, selector)!)
class_addMethod(created, selector, imp_implementationWithBlock(noAccessory), typeEncoding)
objc_registerClassPair(created)
subclass = created
}
object_setClass(content, subclass)
}

/// Stops WKWebView reacting to the keyboard itself. It listens for the keyboard's frame and scrolls
/// the document to reveal the focused field, on top of the lift the page already applies from the
/// height the shell sends, so the page moved twice. The shell's own listeners are unaffected.
func ignoreKeyboardNotifications(in webView: WKWebView) {
for name in [
UIResponder.keyboardWillShowNotification,
UIResponder.keyboardDidShowNotification,
UIResponder.keyboardWillHideNotification,
UIResponder.keyboardDidHideNotification,
UIResponder.keyboardWillChangeFrameNotification,
UIResponder.keyboardDidChangeFrameNotification
] {
NotificationCenter.default.removeObserver(webView, name: name, object: nil)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ final class OrcaMobileWebShellView: ExpoView, WKNavigationDelegate, WKUIDelegate
webView.backgroundColor = .clear
webView.scrollView.backgroundColor = .clear
webView.scrollView.contentInsetAdjustmentBehavior = .never
hideKeyboardAccessoryBar(of: webView)
ignoreKeyboardNotifications(in: webView)
webView.translatesAutoresizingMaskIntoConstraints = false
addSubview(webView)
NSLayoutConstraint.activate([
Expand Down
13 changes: 3 additions & 10 deletions mobile/src/components/MobileDiffReviewDrawers.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useMemo } from 'react'
import { KeyboardAvoidingView, Platform, Pressable, Text, TextInput, View } from 'react-native'
import { KeyboardAvoidingView, Pressable, Text, TextInput, View } from 'react-native'
import { Check, Copy, FileText, Plus, Send, Trash2, X } from 'lucide-react-native'
import type { DiffComment } from '../../../src/shared/diff-comment-types'
import { useKeyboardAvoidingPadding } from '../platform/keyboard-occlusion'
import { colors } from '../theme/mobile-theme'
import type { ActionSheetAction } from './ActionSheetModal'
import { ActionSheetModal } from './ActionSheetModal'
Expand All @@ -11,6 +10,7 @@ import { ConfirmModal } from './ConfirmModal'
import { mobileReviewCountLabel } from '../session/mobile-diff-review-screen-model'
import type { useMobileDiffReviewController } from '../session/use-mobile-diff-review-controller'
import { mobileDiffReviewStyles as styles } from './mobile-diff-review-screen-styles'
import { hostOs } from '../platform/host-os'

type Props = {
controller: ReturnType<typeof useMobileDiffReviewController>
Expand Down Expand Up @@ -163,16 +163,9 @@ function sendSheetMessage(

function NoteComposerDrawer({ controller }: Props) {
const composer = controller.composer
// Zero on a phone, where `KeyboardAvoidingView` above already moved this; the page's own
// keyboard measurement where it cannot, because that view is driven by events RN Web never
// sends. Padding rather than a second avoiding view: the drawer owns the position.
const keyboardPadding = useKeyboardAvoidingPadding()
return (
<BottomDrawer visible={composer !== null} onClose={controller.closeComposer}>
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
style={keyboardPadding > 0 ? { paddingBottom: keyboardPadding } : undefined}
>
<KeyboardAvoidingView behavior={hostOs() === 'ios' ? 'padding' : undefined}>
<View style={styles.composerHeader}>
<View>
<Text style={styles.drawerTitle}>
Expand Down
13 changes: 13 additions & 0 deletions mobile/src/components/ProtocolBlockScreen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,19 @@ describe('ProtocolBlockScreen', () => {
expect(primaryActionUrl()).toBe(RELEASES_URL)
})

it('sends a desktop whose page is older than this shell to the desktop update', () => {
const output = render({
kind: 'blocked',
reason: 'bundle-incompatible',
side: 'desktop',
pageVersion: 0,
requiredPageVersion: 1
})
expect(output).toContain('Update Orca on your computer')
expect(output).toContain('This paired desktop app is too old for your current Orca Mobile app')
expect(primaryActionUrl()).toBe(RELEASES_URL)
})

it('routes an Android bundle wall to GitHub Releases, not a store that has no listing', () => {
nativeTestState.platform.OS = 'android'
const output = render({
Expand Down
Loading
Loading