Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(mobile): add classic hardware skins for Duo remote desktop
Dash768c777848e9
diff --git a/apps/mobile/assets/retro-mac/README.md b/apps/mobile/assets/retro-mac/README.mdnew file mode 100644index 0000000000..3a1e528eb3--- /dev/null+++ b/apps/mobile/assets/retro-mac/README.md@@ -0,0 +1,46 @@+# Classic Mac-inspired hardware artwork++Generated on 2026-10-24 with OpenAI image_gen, following the owner’s request for physical classic Macintosh styling. These are generated material illustrations, not photographs of a manufactured device or original Apple assets.++Reference: https://x.com/snsnotecom/status/2113540405891625291 (physical cream miniature laptop).++Prompt direction:+- display.webp: orthographic front view of a 1984 Macintosh-inspired aged ivory molded-plastic display fascia, fine grain, thick recessed black CRT opening, lower chin, floppy slot on the right, subtle Cindy 84 mark on the left. Upper-left studio lighting; no Apple logo, app UI or outside background.+- deck.webp: matching orthographic top view of an ivory keyboard deck, recessed empty keyboard well and lower central trackpad; same plastic grain and studio lighting, no keys or UI.+- keycap.webp: one unlettered ivory vintage mechanical keycap, sculpted bevels and soft shadow, orthographic top view, transparent background.++Delivery: generated PNGs resized/encoded as WebP (display/deck 1536×1024, keycap 192×192). Text, pointer targets and keyboard input are live React Native components. Screen content is the existing remote viewer; historical screenshots used for visual previews are not bundled here.+++## Space-efficient variants (2026-10-24)++Built-in OpenAI image_gen; reference inputs were display.webp and deck.webp. Original artwork is retained.++Final prompt set:+- display-compact.webp: exact orthographic 1536×1024 ivory molded ABS fascia, keep realistic plastic grain, chamfers and antique Macintosh character; enlarge the empty black opening to nearly the whole frame, narrow sides/top and a small lower chin with Cindy 84 and floppy slot. No perspective or app UI.+- display-edge.webp: matching physical ivory fascia, maximize black display with only a narrow sculpted rim and dark recessed gasket; remove chin, slot and lettering. Fine plastic grain and upper-left studio light; no UI or external scene.+- deck-rail.webp / deck-keys.webp / deck-pad.webp: one matching orthographic 1536×1024 ivory deck, near-full-width empty keyboard recess and broad lower trackpad, minimal borders and palm rest, blank top appearance strip; no keys, labels, logos or speakers. Exported into three horizontal bands (0–110, 110–680, 680–1024) so the real keyboard and touchpad can adapt independently to the available height without shrinking touch targets.++Viewport rectangles follow the actual generated openings, not the requested prompt coordinates. The slim and full-screen live surfaces use approximately 67% and 77% of the upper media pane respectively, compared with 43% for classic. This is available viewport area, not a claim that every remote aspect ratio fills it.+++## Historical computer collection (2026-10-24)++Generated with built-in OpenAI image_gen using real product-photo references:+- Macintosh II: https://theapplemuseum.org/html/main/x-mac-ii.html (1987; separate desktop/monitor adapted to a foldable UI).+- PowerBook 170: https://www.mac-museum.com/apple-geraete/powerbook-170.html (1991; graphite case, trackball and rainbow Apple badge).+- ThinkPad 701C: https://www.computerhistory.org/revolution/artifact/317/1803 and https://mcomputers.cz/2022/10/05/thinkpad-30-let/thinkpad-701c/ (1995; black case, red TrackPoint and butterfly keyboard reference).++These are generated historical homages, not original manufacturer artwork. Enlarged displays, simplified live keyboard layouts and invisible palmrest input adapt the physical designs to Duo; the butterfly mechanism is not simulated. The screen always remains the live remote desktop, regardless of hardware skin.++Final prompt set:+- macii-* / powerbook-* / thinkpad-*: photoreal orthographic hardware atlas, front display above top-view deck, equal panels, no perspective or exterior scene; enlarged empty black screen with narrow brand strip, near-full-width empty keyboard well for live keys. Preserve each reference’s real molded material, subtle bevels, characteristic logo and details. Macintosh II: platinum Snow White grooves, six-stripe rainbow Apple and green LED, small center touchpad as an adaptation. PowerBook: dark gray, rainbow Apple, latch/hinges and compact gray trackball/buttons. ThinkPad: black rubberized material, IBM/701C lettering, stepped keyboard seam, compact red-accent buttons, no rectangular pad.+- keycap-dark.webp: single unlettered graphite ABS vintage laptop keycap, concave top and bevels, upper-left studio light, transparent background.+- trackpoint.webp: single classic red rubber ThinkPad cap, dimple texture, orthographic top view, transparent background.+- deck-pad-small.webp: edit the original ivory palmrest, keep material and borders, replace the full-width pad with a centered pad roughly22% of the width.++Atlas slices are separated into display, rail, keyboard backing, blank palmrest texture and small control sprites. Pointing controls preserve their own aspect ratio while their input surface spans the entire palmrest; key/rail hit areas remain separate. Original three study skins are retained. No third-party reference photos are included in the app bundle.++Additional finishing prompts (built-in image_gen):+- *-palm-v2.webp: three equal edge-to-edge blank material samples (platinum ABS / graphite ABS / black soft-touch rubber), subtle fine grain with diffuse lighting, no gradients, controls, logos or borders. Each sample is extracted separately and covers the palmrest without stretching grain.+- powerbook-control-cutout.webp: preserve the photographed trackball and two curved buttons, remove all surrounding palmrest and the gap between controls to true transparency; retain shapes, rim and lighting.diff --git a/apps/mobile/assets/retro-mac/deck-keys.webp b/apps/mobile/assets/retro-mac/deck-keys.webpnew file mode 100644index 0000000000..c10c797522Binary files /dev/null and b/apps/mobile/assets/retro-mac/deck-keys.webp differdiff --git a/apps/mobile/assets/retro-mac/deck-pad-small.webp b/apps/mobile/assets/retro-mac/deck-pad-small.webpnew file mode 100644index 0000000000..698a7720bcBinary files /dev/null and b/apps/mobile/assets/retro-mac/deck-pad-small.webp differdiff --git a/apps/mobile/assets/retro-mac/deck-pad.webp b/apps/mobile/assets/retro-mac/deck-pad.webpnew file mode 100644index 0000000000..c64d143edbBinary files /dev/null and b/apps/mobile/assets/retro-mac/deck-pad.webp differdiff --git a/apps/mobile/assets/retro-mac/deck-rail.webp b/apps/mobile/assets/retro-mac/deck-rail.webpnew file mode 100644index 0000000000..ee48ce6a47Binary files /dev/null and b/apps/mobile/assets/retro-mac/deck-rail.webp differdiff --git a/apps/mobile/assets/retro-mac/deck.webp b/apps/mobile/assets/retro-mac/deck.webpnew file mode 100644index 0000000000..f491c655e5Binary files /dev/null and b/apps/mobile/assets/retro-mac/deck.webp differdiff --git a/apps/mobile/assets/retro-mac/display-compact.webp b/apps/mobile/assets/retro-mac/display-compact.webpnew file mode 100644index 0000000000..c78ec81b6dBinary files /dev/null and b/apps/mobile/assets/retro-mac/display-compact.webp differdiff --git a/apps/mobile/assets/retro-mac/display-edge.webp b/apps/mobile/assets/retro-mac/display-edge.webpnew file mode 100644index 0000000000..affb8c9842Binary files /dev/null and b/apps/mobile/assets/retro-mac/display-edge.webp differdiff --git a/apps/mobile/assets/retro-mac/display.webp b/apps/mobile/assets/retro-mac/display.webpnew file mode 100644index 0000000000..937537c636Binary files /dev/null and b/apps/mobile/assets/retro-mac/display.webp differdiff --git a/apps/mobile/assets/retro-mac/keycap-dark.webp b/apps/mobile/assets/retro-mac/keycap-dark.webpnew file mode 100644index 0000000000..9d836ebbdbBinary files /dev/null and b/apps/mobile/assets/retro-mac/keycap-dark.webp differdiff --git a/apps/mobile/assets/retro-mac/keycap.webp b/apps/mobile/assets/retro-mac/keycap.webpnew file mode 100644index 0000000000..310855358aBinary files /dev/null and b/apps/mobile/assets/retro-mac/keycap.webp differdiff --git a/apps/mobile/assets/retro-mac/macii-control.webp b/apps/mobile/assets/retro-mac/macii-control.webpnew file mode 100644index 0000000000..2ebf4dbe98Binary files /dev/null and b/apps/mobile/assets/retro-mac/macii-control.webp differdiff --git a/apps/mobile/assets/retro-mac/macii-display.webp b/apps/mobile/assets/retro-mac/macii-display.webpnew file mode 100644index 0000000000..7170d4d4e7Binary files /dev/null and b/apps/mobile/assets/retro-mac/macii-display.webp differdiff --git a/apps/mobile/assets/retro-mac/macii-keys.webp b/apps/mobile/assets/retro-mac/macii-keys.webpnew file mode 100644index 0000000000..4af61038aeBinary files /dev/null and b/apps/mobile/assets/retro-mac/macii-keys.webp differdiff --git a/apps/mobile/assets/retro-mac/macii-palm-v2.webp b/apps/mobile/assets/retro-mac/macii-palm-v2.webpnew file mode 100644index 0000000000..b8a86f97b8Binary files /dev/null and b/apps/mobile/assets/retro-mac/macii-palm-v2.webp differdiff --git a/apps/mobile/assets/retro-mac/macii-palm.webp b/apps/mobile/assets/retro-mac/macii-palm.webpnew file mode 100644index 0000000000..19e94aa9b7Binary files /dev/null and b/apps/mobile/assets/retro-mac/macii-palm.webp differdiff --git a/apps/mobile/assets/retro-mac/macii-rail.webp b/apps/mobile/assets/retro-mac/macii-rail.webpnew file mode 100644index 0000000000..d23759bcd0Binary files /dev/null and b/apps/mobile/assets/retro-mac/macii-rail.webp differdiff --git a/apps/mobile/assets/retro-mac/powerbook-control-cutout.webp b/apps/mobile/assets/retro-mac/powerbook-control-cutout.webpnew file mode 100644index 0000000000..bbc5ba485cBinary files /dev/null and b/apps/mobile/assets/retro-mac/powerbook-control-cutout.webp differdiff --git a/apps/mobile/assets/retro-mac/powerbook-control.webp b/apps/mobile/assets/retro-mac/powerbook-control.webpnew file mode 100644index 0000000000..ea5fb7d1dcBinary files /dev/null and b/apps/mobile/assets/retro-mac/powerbook-control.webp differdiff --git a/apps/mobile/assets/retro-mac/powerbook-display.webp b/apps/mobile/assets/retro-mac/powerbook-display.webpnew file mode 100644index 0000000000..1b66670782Binary files /dev/null and b/apps/mobile/assets/retro-mac/powerbook-display.webp differdiff --git a/apps/mobile/assets/retro-mac/powerbook-keys.webp b/apps/mobile/assets/retro-mac/powerbook-keys.webpnew file mode 100644index 0000000000..bb2e5ab575Binary files /dev/null and b/apps/mobile/assets/retro-mac/powerbook-keys.webp differdiff --git a/apps/mobile/assets/retro-mac/powerbook-palm-v2.webp b/apps/mobile/assets/retro-mac/powerbook-palm-v2.webpnew file mode 100644index 0000000000..78906fd5a5Binary files /dev/null and b/apps/mobile/assets/retro-mac/powerbook-palm-v2.webp differdiff --git a/apps/mobile/assets/retro-mac/powerbook-palm.webp b/apps/mobile/assets/retro-mac/powerbook-palm.webpnew file mode 100644index 0000000000..376692befbBinary files /dev/null and b/apps/mobile/assets/retro-mac/powerbook-palm.webp differdiff --git a/apps/mobile/assets/retro-mac/powerbook-rail.webp b/apps/mobile/assets/retro-mac/powerbook-rail.webpnew file mode 100644index 0000000000..9413cb66c3Binary files /dev/null and b/apps/mobile/assets/retro-mac/powerbook-rail.webp differdiff --git a/apps/mobile/assets/retro-mac/thinkpad-control.webp b/apps/mobile/assets/retro-mac/thinkpad-control.webpnew file mode 100644index 0000000000..23f0d3b75fBinary files /dev/null and b/apps/mobile/assets/retro-mac/thinkpad-control.webp differdiff --git a/apps/mobile/assets/retro-mac/thinkpad-display.webp b/apps/mobile/assets/retro-mac/thinkpad-display.webpnew file mode 100644index 0000000000..90a87c7470Binary files /dev/null and b/apps/mobile/assets/retro-mac/thinkpad-display.webp differdiff --git a/apps/mobile/assets/retro-mac/thinkpad-keys.webp b/apps/mobile/assets/retro-mac/thinkpad-keys.webpnew file mode 100644index 0000000000..82d4544644Binary files /dev/null and b/apps/mobile/assets/retro-mac/thinkpad-keys.webp differdiff --git a/apps/mobile/assets/retro-mac/thinkpad-palm-v2.webp b/apps/mobile/assets/retro-mac/thinkpad-palm-v2.webpnew file mode 100644index 0000000000..94a3f5e7e7Binary files /dev/null and b/apps/mobile/assets/retro-mac/thinkpad-palm-v2.webp differdiff --git a/apps/mobile/assets/retro-mac/thinkpad-palm.webp b/apps/mobile/assets/retro-mac/thinkpad-palm.webpnew file mode 100644index 0000000000..85d99f2e97Binary files /dev/null and b/apps/mobile/assets/retro-mac/thinkpad-palm.webp differdiff --git a/apps/mobile/assets/retro-mac/thinkpad-rail.webp b/apps/mobile/assets/retro-mac/thinkpad-rail.webpnew file mode 100644index 0000000000..17e11c3654Binary files /dev/null and b/apps/mobile/assets/retro-mac/thinkpad-rail.webp differdiff --git a/apps/mobile/assets/retro-mac/trackpoint.webp b/apps/mobile/assets/retro-mac/trackpoint.webpnew file mode 100644index 0000000000..d0832c3bf1Binary files /dev/null and b/apps/mobile/assets/retro-mac/trackpoint.webp differdiff --git a/apps/mobile/src/i18n/locales/en/remoteDesktop.json b/apps/mobile/src/i18n/locales/en/remoteDesktop.jsonindex 6dbe3886bd..c3700f10fb 100644--- a/apps/mobile/src/i18n/locales/en/remoteDesktop.json+++ b/apps/mobile/src/i18n/locales/en/remoteDesktop.json@@ -1,4 +1,17 @@{+ "skin_macii": "Macintosh II",+ "skin_powerbook": "PowerBook 170",+ "skin_thinkpad": "ThinkPad 701C",+ "skin_classic": "Classic 84",+ "skin_compact": "Slim classic",+ "skin_edge": "Full-screen retro",+ "skin_modern": "Modern",+ "nextSkin": "Next appearance",+ "retroSkin": "Retro",+ "modernSkin": "Modern",+ "switchModern": "Switch to modern",+ "switchRetro": "Switch to retro",+ "skinSwipeHint": "Swipe left or right here to change the appearance.","hostDisconnected": "The computer ended the remote desktop connection.","privacyScreen": "Computer privacy screen","privacyScreenHint": "Cover the computer’s screens. Click or press a key on the computer, then confirm to disconnect. Lock on exit applies if enabled.",diff --git a/apps/mobile/src/i18n/locales/ja/remoteDesktop.json b/apps/mobile/src/i18n/locales/ja/remoteDesktop.jsonindex 727241448d..4e5a39872e 100644--- a/apps/mobile/src/i18n/locales/ja/remoteDesktop.json+++ b/apps/mobile/src/i18n/locales/ja/remoteDesktop.json@@ -1,4 +1,17 @@{+ "skin_macii": "Macintosh II",+ "skin_powerbook": "PowerBook 170",+ "skin_thinkpad": "ThinkPad 701C",+ "skin_classic": "クラシック84",+ "skin_compact": "スリムクラシック",+ "skin_edge": "大画面レトロ",+ "skin_modern": "モダン",+ "nextSkin": "次の外観",+ "retroSkin": "レトロ",+ "modernSkin": "モダン",+ "switchModern": "モダンに切り替える",+ "switchRetro": "レトロに切り替える",+ "skinSwipeHint": "ここを左右にスワイプして外観を切り替えます。","hostDisconnected": "パソコン側でリモートデスクトップ接続が切断されました。","privacyScreen": "パソコンのプライバシースクリーン","privacyScreenHint": "パソコンの画面を隠します。パソコンでクリックまたはキーを押し、確認すると切断します。終了時のロック設定も適用されます。",diff --git a/apps/mobile/src/i18n/locales/ko/remoteDesktop.json b/apps/mobile/src/i18n/locales/ko/remoteDesktop.jsonindex fd36e668b0..a5223590f5 100644--- a/apps/mobile/src/i18n/locales/ko/remoteDesktop.json+++ b/apps/mobile/src/i18n/locales/ko/remoteDesktop.json@@ -1,4 +1,17 @@{+ "skin_macii": "Macintosh II",+ "skin_powerbook": "PowerBook 170",+ "skin_thinkpad": "ThinkPad 701C",+ "skin_classic": "클래식84",+ "skin_compact": "슬림 클래식",+ "skin_edge": "대화면 레트로",+ "skin_modern": "모던",+ "nextSkin": "다음 디자인",+ "retroSkin": "레트로",+ "modernSkin": "모던",+ "switchModern": "모던으로 전환",+ "switchRetro": "레트로로 전환",+ "skinSwipeHint": "여기를 좌우로 밀어 모양을 바꿔 보세요.","hostDisconnected": "컴퓨터에서 원격 데스크톱 연결을 종료했습니다.","privacyScreen": "컴퓨터 프라이버시 화면","privacyScreenHint": "컴퓨터 화면을 가립니다. 컴퓨터에서 클릭하거나 키를 누른 뒤 확인하면 연결이 끊어집니다. 종료 시 잠금 설정도 적용됩니다.",diff --git a/apps/mobile/src/i18n/locales/zh-CN/remoteDesktop.json b/apps/mobile/src/i18n/locales/zh-CN/remoteDesktop.jsonindex e232d96600..d8d6de98ba 100644--- a/apps/mobile/src/i18n/locales/zh-CN/remoteDesktop.json+++ b/apps/mobile/src/i18n/locales/zh-CN/remoteDesktop.json@@ -1,4 +1,17 @@{+ "skin_macii": "Macintosh II",+ "skin_powerbook": "PowerBook 170",+ "skin_thinkpad": "ThinkPad 701C",+ "skin_classic": "经典原版",+ "skin_compact": "窄边经典",+ "skin_edge": "极简大屏",+ "skin_modern": "现代",+ "nextSkin": "下一个外观",+ "retroSkin": "复古",+ "modernSkin": "现代",+ "switchModern": "切换到现代",+ "switchRetro": "切换到复古",+ "skinSwipeHint": "在这里左右滑动切换外观。","hostDisconnected": "电脑已主动断开远程桌面连接。","privacyScreen": "电脑防窥","privacyScreenHint": "遮住电脑屏幕。在电脑上点击鼠标或按键,确认后断开连接,并按设置锁屏。",diff --git a/apps/mobile/src/i18n/locales/zh-TW/remoteDesktop.json b/apps/mobile/src/i18n/locales/zh-TW/remoteDesktop.jsonindex 6555f58ef9..9efe973ef6 100644--- a/apps/mobile/src/i18n/locales/zh-TW/remoteDesktop.json+++ b/apps/mobile/src/i18n/locales/zh-TW/remoteDesktop.json@@ -1,4 +1,17 @@{+ "skin_macii": "Macintosh II",+ "skin_powerbook": "PowerBook 170",+ "skin_thinkpad": "ThinkPad 701C",+ "skin_classic": "經典原版",+ "skin_compact": "窄邊經典",+ "skin_edge": "極簡大螢幕",+ "skin_modern": "現代",+ "nextSkin": "下一個外觀",+ "retroSkin": "復古",+ "modernSkin": "現代",+ "switchModern": "切換到現代",+ "switchRetro": "切換到復古",+ "skinSwipeHint": "在這裡左右滑動切換外觀。","hostDisconnected": "電腦已主動中斷遠端桌面連線。","privacyScreen": "電腦防窺","privacyScreenHint": "遮住電腦螢幕。在電腦上點擊滑鼠或按鍵,確認後中斷連線,並依設定鎖定螢幕。",diff --git a/apps/mobile/src/remote-desktop/FoldDesktopSkin.tsx b/apps/mobile/src/remote-desktop/FoldDesktopSkin.tsxnew file mode 100644index 0000000000..81b892ae33--- /dev/null+++ b/apps/mobile/src/remote-desktop/FoldDesktopSkin.tsx@@ -0,0 +1,434 @@+import { useRef, type ReactNode } from "react";+import { Image, Pressable, ScrollView, StyleSheet, View } from "react-native";+import { useTranslation } from "react-i18next";+import { Text } from "@/components/AppText";+import {+ fontWeight,+ lineHeight,+ monoFont,+ spacing,+ typeScale,+ useTheme,+ lightColors,+ darkColors,+} from "@/theme";+import type { LayoutRect } from "@/platform/windowGeometry";+import { retroMacArtwork } from "./retroMacArtwork";+import { FoldTouchpad } from "./FoldTouchpad";++export const FOLD_DESKTOP_SKINS = [+ "classic",+ "compact",+ "edge",+ "macii",+ "powerbook",+ "thinkpad",+ "modern",+] as const;+export type FoldDesktopSkin = (typeof FOLD_DESKTOP_SKINS)[number];+export type RetroDesktopSkin = Exclude<FoldDesktopSkin, "modern">;+export function foldDesktopSkinColors(skin: FoldDesktopSkin) {+ return skin === "powerbook" || skin === "thinkpad" ? darkColors : lightColors;+}+function heritageArtwork(skin: FoldDesktopSkin) {+ return skin === "macii" || skin === "powerbook" || skin === "thinkpad"+ ? retroMacArtwork.heritage[skin]+ : null;+}+const VIEWPORTS = {+ macii: { x: 0.072, y: 0.082, width: 0.856, height: 0.73 },+ powerbook: { x: 0.08, y: 0.11, width: 0.84, height: 0.765 },+ thinkpad: { x: 0.07, y: 0.107, width: 0.86, height: 0.805 },+ classic: { x: 0.12, y: 0.155, width: 0.76, height: 0.57 },+ compact: { x: 0.052, y: 0.072, width: 0.896, height: 0.748 },+ edge: { x: 0.05, y: 0.075, width: 0.9, height: 0.85 },+};+function adjacentSkin(+ skin: FoldDesktopSkin,+ direction: number,+): FoldDesktopSkin {+ const i = FOLD_DESKTOP_SKINS.indexOf(skin);+ return FOLD_DESKTOP_SKINS[+ (i + direction + FOLD_DESKTOP_SKINS.length) % FOLD_DESKTOP_SKINS.length+ ];+}++/** The live surface fits inside the rendered CRT's black opening. */+export function retroDesktopViewport(+ region: LayoutRect,+ skin: RetroDesktopSkin = "classic",+): LayoutRect {+ const inset = VIEWPORTS[skin];+ return {+ x: region.x + region.width * inset.x,+ y: region.y + region.height * inset.y,+ width: region.width * inset.width,+ height: region.height * inset.height,+ };+}++/** Case material bleeds behind system chrome; only controls use safe geometry. */+export function FoldDesktopBackdrop({ skin }: { skin: RetroDesktopSkin }) {+ return (+ <View+ pointerEvents="none"+ accessibilityElementsHidden+ importantForAccessibility="no-hide-descendants"+ style={StyleSheet.absoluteFill}+ >+ <Image+ source={+ heritageArtwork(skin)?.palm ?? retroMacArtwork.heritage.macii.palm+ }+ resizeMode="repeat"+ style={styles.artwork}+ />+ </View>+ );+}++/** A non-interactive case around the live desktop; it never replaces the viewer. */+export function FoldDesktopBezel({+ region,+ skin = "classic",+}: {+ region: LayoutRect;+ skin?: RetroDesktopSkin;+}) {+ return (+ <View+ pointerEvents="none"+ accessibilityElementsHidden+ importantForAccessibility="no-hide-descendants"+ testID="remoteDesktop.retroBezel"+ style={[+ { position: "absolute" },+ {+ left: region.x,+ top: region.y,+ width: region.width,+ height: region.height,+ },+ ]}+ >+ <Image+ source={+ skin === "compact" || skin === "edge"+ ? retroMacArtwork[skin]+ : (heritageArtwork(skin)?.display ?? retroMacArtwork.display)+ }+ resizeMode="stretch"+ style={styles.artwork}+ />+ </View>+ );+}++/** A dedicated swipe rail keeps skin navigation out of the remote pointer gesture. */+export function FoldDesktopSkinSwitch({+ skin,+ onChange,+}: {+ skin: FoldDesktopSkin;+ onChange(value: FoldDesktopSkin): void;+}) {+ const { colors } = useTheme();+ const { t } = useTranslation();+ const retro = skin !== "modern";+ const start = useRef<{ x: number; y: number } | null>(null);+ return (+ <View+ testID="remoteDesktop.skinSwipe"+ onStartShouldSetResponderCapture={(e) => {+ start.current = { x: e.nativeEvent.pageX, y: e.nativeEvent.pageY };+ return false;+ }}+ onMoveShouldSetResponderCapture={(e) => {+ if (!start.current) return false;+ const dx = e.nativeEvent.pageX - start.current.x,+ dy = e.nativeEvent.pageY - start.current.y;+ return Math.abs(dx) >= 12 && Math.abs(dx) > Math.abs(dy) * 1.5;+ }}+ onStartShouldSetResponder={() => true}+ onResponderGrant={(e) => {+ start.current ??= { x: e.nativeEvent.pageX, y: e.nativeEvent.pageY };+ }}+ onResponderRelease={(e) => {+ const origin = start.current;+ start.current = null;+ if (!origin) return;+ const dx = e.nativeEvent.pageX - origin.x,+ dy = e.nativeEvent.pageY - origin.y;+ if (Math.abs(dx) >= 48 && Math.abs(dx) > Math.abs(dy) * 1.5)+ onChange(adjacentSkin(skin, dx < 0 ? 1 : -1));+ }}+ onResponderTerminate={() => {+ start.current = null;+ }}+ style={styles.switchRail}+ >+ <Pressable+ testID="remoteDesktop.skinSwitch"+ accessibilityRole="button"+ accessibilityLabel={t("remoteDesktop.nextSkin")}+ accessibilityValue={{ text: t(`remoteDesktop.skin_${skin}`) }}+ accessibilityHint={t("remoteDesktop.skinSwipeHint")}+ onPress={() => onChange(adjacentSkin(skin, 1))}+ style={styles.switchButton}+ >+ <Text+ style={[+ styles.legend,+ {+ color: retro+ ? foldDesktopSkinColors(skin).textSecondary+ : colors.textTertiary,+ },+ ]}+ >+ {t(`remoteDesktop.skin_${skin}`)}+ {` ‹ ${FOLD_DESKTOP_SKINS.indexOf(skin) + 1} / ${FOLD_DESKTOP_SKINS.length} ›`}+ </Text>+ </Pressable>+ </View>+ );+}++const ROWS = [+ [+ "Escape",+ ..."1234567890".split("").map((key) => `Digit${key}`),+ "Backspace",+ ],+ ["Tab", ..."QWERTYUIOP".split("").map((key) => `Key${key}`)],+ [..."ASDFGHJKL".split("").map((key) => `Key${key}`), "Enter"],+ [+ "ShiftLeft",+ ..."ZXCVBNM".split("").map((key) => `Key${key}`),+ "Comma",+ "Period",+ "ArrowUp",+ ],+ [+ "ControlLeft",+ "AltLeft",+ "MetaLeft",+ "Space",+ "ArrowLeft",+ "ArrowDown",+ "ArrowRight",+ ],+];++export function FoldDesktopKeys({+ renderKey,+ fill = false,+ trackpoint = false,+}: {+ renderKey(code: string): ReactNode;+ fill?: boolean;+ trackpoint?: boolean;+}) {+ return (+ <View+ testID="remoteDesktop.retroKeys"+ style={[styles.keys, fill && { flex: 1 }]}+ >+ {ROWS.map((row, index) => (+ <View key={index} style={[styles.keyRow, fill && { flex: 1 }]}>+ {row.map(renderKey)}+ </View>+ ))}+ {trackpoint && (+ <View+ pointerEvents="none"+ accessibilityElementsHidden+ importantForAccessibility="no-hide-descendants"+ style={{+ position: "absolute",+ left: "50%",+ top: "60%",+ width: 18,+ height: 18,+ marginLeft: -9,+ marginTop: -9,+ }}+ >+ <Image+ source={retroMacArtwork.trackpoint}+ style={styles.artwork}+ resizeMode="contain"+ />+ </View>+ )}+ </View>+ );+}++/** Hardware keeps its historical material in either theme; its palmrest is a larger invisible input surface. */+export function FoldDesktopDeck({+ renderKey,+ send,+ enabled,+ skin,+ onChange,+}: {+ renderKey(code: string): ReactNode;+ send(message: object): void;+ enabled: boolean;+ skin: RetroDesktopSkin;+ onChange(value: FoldDesktopSkin): void;+}) {+ const artwork = heritageArtwork(skin);+ if (skin !== "classic")+ return (+ <View testID="remoteDesktop.retroDeck" style={{ flex: 1 }}>+ <View style={{ height: 44 }}>+ <View pointerEvents="none" style={StyleSheet.absoluteFill}>+ <Image+ source={artwork?.rail ?? retroMacArtwork.rail}+ resizeMode="stretch"+ style={styles.artwork}+ />+ </View>+ <FoldDesktopSkinSwitch skin={skin} onChange={onChange} />+ </View>+ <View style={{ flex: 4, minHeight: 244, overflow: "hidden" }}>+ <View pointerEvents="none" style={StyleSheet.absoluteFill}>+ <Image+ source={artwork?.keys ?? retroMacArtwork.keys}+ resizeMode="stretch"+ style={styles.artwork}+ />+ </View>+ <ScrollView+ style={{+ flex: 1,+ marginHorizontal: artwork ? "5%" : "3.2%",+ marginVertical: 6,+ }}+ contentContainerStyle={{ flexGrow: 1 }}+ bounces={false}+ >+ <FoldDesktopKeys+ renderKey={renderKey}+ fill+ trackpoint={skin === "thinkpad"}+ />+ </ScrollView>+ </View>+ <View style={{ flex: 1, minHeight: 68 }}>+ <View pointerEvents="none" style={StyleSheet.absoluteFill}>+ <Image+ source={artwork?.palm ?? retroMacArtwork.pad}+ resizeMode={artwork ? "cover" : "stretch"}+ style={styles.artwork}+ />+ </View>+ {artwork && (+ <View+ pointerEvents="none"+ accessibilityElementsHidden+ importantForAccessibility="no-hide-descendants"+ style={[+ StyleSheet.absoluteFill,+ { alignItems: "center", justifyContent: "center" },+ ]}+ >+ <Image+ source={artwork.control}+ resizeMode="contain"+ style={{+ width: skin === "powerbook" ? 66 : 96,+ height: skin === "powerbook" ? 60 : 44,+ }}+ />+ </View>+ )}+ <View testID="remoteDesktop.palmrest" style={StyleSheet.absoluteFill}>+ <FoldTouchpad send={send} enabled={enabled} bare />+ </View>+ </View>+ </View>+ );+ return (+ <View testID="remoteDesktop.retroDeck" style={{ flex: 1 }}>+ <View pointerEvents="none" style={StyleSheet.absoluteFill}>+ <Image+ source={retroMacArtwork.deck}+ resizeMode="stretch"+ style={styles.artwork}+ />+ </View>+ <View style={{ position: "absolute", top: 0, left: 0, right: 0 }}>+ <FoldDesktopSkinSwitch skin={skin} onChange={onChange} />+ </View>+ <ScrollView+ style={{+ position: "absolute",+ left: "9%",+ width: "82%",+ top: "11%",+ height: "53%",+ }}+ bounces={false}+ >+ <FoldDesktopKeys renderKey={renderKey} />+ </ScrollView>+ <View+ style={{+ position: "absolute",+ left: 0,+ right: 0,+ top: "66%",+ bottom: 0,+ }}+ >+ <FoldTouchpad send={send} enabled={enabled} bare />+ </View>+ </View>+ );+}++export function FoldDesktopKeycap({+ skin = "classic",+}: {+ skin?: FoldDesktopSkin;+}) {+ return (+ <View pointerEvents="none" style={StyleSheet.absoluteFill}>+ <Image+ source={+ skin === "powerbook" || skin === "thinkpad"+ ? retroMacArtwork.darkKeycap+ : retroMacArtwork.keycap+ }+ resizeMode="stretch"+ style={styles.artwork}+ />+ </View>+ );+}++const styles = StyleSheet.create({+ // Native Image keeps its asset's intrinsic size unless both dimensions are+ // explicit; absoluteFill alone does not constrain a bundled bitmap.+ artwork: { ...StyleSheet.absoluteFillObject, width: "100%", height: "100%" },+ legend: {+ fontFamily: monoFont,+ fontSize: typeScale.caption,+ lineHeight: lineHeight.caption,+ fontWeight: fontWeight.regular,+ },+ switchRail: { minHeight: 44, alignItems: "center", justifyContent: "center" },+ switchButton: {+ minHeight: 44,+ paddingHorizontal: spacing.lg,+ justifyContent: "center",+ },+ keys: {+ padding: 2,+ gap: 2,+ },+ keyRow: { flexDirection: "row", gap: 2 },+});diff --git a/apps/mobile/src/remote-desktop/FoldTouchpad.tsx b/apps/mobile/src/remote-desktop/FoldTouchpad.tsxindex b2dde7f615..b5f0865bdc 100644--- a/apps/mobile/src/remote-desktop/FoldTouchpad.tsx+++ b/apps/mobile/src/remote-desktop/FoldTouchpad.tsx@@ -1,44 +1,107 @@-import { useEffect, useRef } from 'react';-import { StyleSheet, View } from 'react-native';-import { useTranslation } from 'react-i18next';-import { Text } from '@/components/AppText';-import { BlurBackdrop } from '@/session/BlurBackdrop';-import { radius, spacing, useTheme } from '@/theme';+import { useEffect, useRef } from "react";+import { StyleSheet, View } from "react-native";+import { useTranslation } from "react-i18next";+import { Text } from "@/components/AppText";+import { BlurBackdrop } from "@/session/BlurBackdrop";+import { radius, spacing, useTheme } from "@/theme";/** Relative movement shares the viewer's cursor transform; lower-pane coordinates are never remote coordinates. */-export function FoldTouchpad({ send, enabled }: { send(message: object): void; enabled: boolean }) {+export function FoldTouchpad({+ send,+ enabled,+ bare = false,+}: {+ send(message: object): void;+ enabled: boolean;+ bare?: boolean;+}) {const { colors } = useTheme();const { t } = useTranslation();- const touch = useRef<{ x: number; y: number; distance: number; time: number } | null>(null);- useEffect(() => () => { touch.current = null; send({ type: 'releaseInput' }); }, [enabled, send]);- return <View testID="remoteDesktop.foldTouchpad"- accessibilityLabel={t('remoteDesktop.pointer')}- accessibilityHint={t('remoteDesktop.pointerHint')}- accessibilityState={{ disabled: !enabled }}- onStartShouldSetResponder={() => enabled}- onResponderGrant={(e) => {- touch.current = { x: e.nativeEvent.pageX, y: e.nativeEvent.pageY, distance: 0, time: Date.now() };- send({ type: 'nativeTouchpad', phase: 'start' });- }}- onResponderMove={(e) => {- const last = touch.current;- if (!last || !enabled) return;- const dx = e.nativeEvent.pageX - last.x, dy = e.nativeEvent.pageY - last.y;- last.x = e.nativeEvent.pageX; last.y = e.nativeEvent.pageY; last.distance += Math.abs(dx) + Math.abs(dy);- send({ type: 'nativeTouchpad', dx, dy });- }}- onResponderRelease={() => {- const last = touch.current; touch.current = null;- if (enabled && last && last.distance < 8 && Date.now() - last.time < 400) {- send({ type: 'nativeTouchpad', tap: true });+ const touch = useRef<{+ x: number;+ y: number;+ distance: number;+ time: number;+ } | null>(null);+ useEffect(+ () => () => {+ touch.current = null;+ send({ type: "releaseInput" });+ },+ [enabled, send],+ );+ return (+ <View+ testID="remoteDesktop.foldTouchpad"+ accessibilityLabel={t("remoteDesktop.pointer")}+ accessibilityHint={t("remoteDesktop.pointerHint")}+ accessibilityState={{ disabled: !enabled }}+ onStartShouldSetResponder={() => enabled}+ onResponderGrant={(e) => {+ touch.current = {+ x: e.nativeEvent.pageX,+ y: e.nativeEvent.pageY,+ distance: 0,+ time: Date.now(),+ };+ send({ type: "nativeTouchpad", phase: "start" });+ }}+ onResponderMove={(e) => {+ const last = touch.current;+ if (!last || !enabled) return;+ const dx = e.nativeEvent.pageX - last.x,+ dy = e.nativeEvent.pageY - last.y;+ last.x = e.nativeEvent.pageX;+ last.y = e.nativeEvent.pageY;+ last.distance += Math.abs(dx) + Math.abs(dy);+ send({ type: "nativeTouchpad", dx, dy });+ }}+ onResponderRelease={() => {+ const last = touch.current;+ touch.current = null;+ if (+ enabled &&+ last &&+ last.distance < 8 &&+ Date.now() - last.time < 400+ ) {+ send({ type: "nativeTouchpad", tap: true });+ }+ send({ type: "nativeTouchpad", phase: "end" });+ }}+ onResponderTerminate={() => {+ touch.current = null;+ send({ type: "releaseInput" });+ }}+ style={+ bare+ ? { flex: 1, minHeight: 44 }+ : [styles.pad, { borderColor: colors.border }]}- send({ type: 'nativeTouchpad', phase: 'end' });- }}- onResponderTerminate={() => { touch.current = null; send({ type: 'releaseInput' }); }}- style={[styles.pad, { borderColor: colors.border }]}>- <BlurBackdrop intensity={60} overlayColor={colors.surfaceTranslucent} />- <Text style={{ color: colors.textTertiary }}>{t('remoteDesktop.pointer')}</Text>- </View>;+ >+ {!bare && (+ <>+ <BlurBackdrop+ intensity={60}+ overlayColor={colors.surfaceTranslucent}+ />+ <Text style={{ color: colors.textTertiary }}>+ {t("remoteDesktop.pointer")}+ </Text>+ </>+ )}+ </View>+ );}-const styles = StyleSheet.create({ pad: { flex: 1, minHeight: 44, margin: spacing.sm,- overflow: 'hidden', borderWidth: StyleSheet.hairlineWidth, borderRadius: radius.container, alignItems: 'center', justifyContent: 'center' } });+const styles = StyleSheet.create({+ pad: {+ flex: 1,+ minHeight: 44,+ margin: spacing.sm,+ overflow: "hidden",+ borderWidth: StyleSheet.hairlineWidth,+ borderRadius: radius.container,+ alignItems: "center",+ justifyContent: "center",+ },+});diff --git a/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx b/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsxindex 623334fdce..8fd0c79584 100644--- a/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx+++ b/apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx@@ -1,7 +1,17 @@-import { foldDesktopLayout, foldDesktopRegion } from './foldDesktopLayout';-import { useAdaptiveWindow } from '@/platform/AdaptiveWindowContext';-import { controlRegion } from '@/platform/windowGeometry';-import { FoldTouchpad } from './FoldTouchpad';+import { foldDesktopLayout, foldDesktopRegion } from "./foldDesktopLayout";+import { useAdaptiveWindow } from "@/platform/AdaptiveWindowContext";+import { controlRegion } from "@/platform/windowGeometry";+import { FoldTouchpad } from "./FoldTouchpad";+import {+ FoldDesktopBezel,+ FoldDesktopBackdrop,+ FoldDesktopDeck,+ FoldDesktopKeycap,+ FoldDesktopSkinSwitch,+ retroDesktopViewport,+ foldDesktopSkinColors,+ type FoldDesktopSkin,+} from "./FoldDesktopSkin";import {useCallback,useMemo,@@ -92,6 +102,7 @@ import {} from "./rtcDiagnostics";import {fontWeight,+ darkColors,iconSize,iconStroke,lineHeight,@@ -198,14 +209,19 @@ const LABELS: Record<string, string> = {};export default function RemoteDesktopScreen() {- const { deviceId: rawId, deviceName: rawName, handoff: rawHandoff } = useLocalSearchParams<{+ const {+ deviceId: rawId,+ deviceName: rawName,+ handoff: rawHandoff,+ } = useLocalSearchParams<{deviceId: string;deviceName?: string;handoff?: string;}>();const deviceId = typeof rawId === "string" ? rawId : "";const deviceName = typeof rawName === "string" ? rawName : deviceId;- const handoff = typeof rawHandoff === "string" && rawHandoff ? rawHandoff : undefined;+ const handoff =+ typeof rawHandoff === "string" && rawHandoff ? rawHandoff : undefined;const router = useRouter();const focused = useIsFocused();return (@@ -311,34 +327,53 @@ export function RemoteDesktopSession({const geometry = useAdaptiveWindow();const tableRegion = foldDesktopRegion(geometry);- const systemSideRail = Platform.OS === 'ios' && !tableRegion && (geometry.barEdge !== 'none' || (geometry.reservedRegionsSupported && geometry.regularWidth && windowSize.width > windowSize.height));+ const systemSideRail =+ Platform.OS === "ios" &&+ !tableRegion &&+ (geometry.barEdge !== "none" ||+ (geometry.reservedRegionsSupported &&+ geometry.regularWidth &&+ windowSize.width > windowSize.height));// Android adjustResize shrinks the window for the IME, not the display.// Keep its device orientation stable; iOS/Duo still use the adaptive window.- const orientationSize = Platform.OS === 'android' ? Dimensions.get('screen') : windowSize;- const landscape = systemSideRail || (!tableRegion && orientationSize.width > orientationSize.height);+ const orientationSize =+ Platform.OS === "android" ? Dimensions.get("screen") : windowSize;+ const landscape =+ systemSideRail ||+ (!tableRegion && orientationSize.width > orientationSize.height);const sideRailWidth = Math.max(60, geometry.insets.right + spacing.md);// The native status/navigation center sits 6pt inward from the safe strip center.// Use the reported status reservation for vertical clearance when available.- const statusReservation = geometry.regions.filter(r => r.kind === 'occlusion' && r.y === 0 && r.x + r.width >= geometry.width);- const sideRailTop = Math.max(insets.top, statusReservation.length ? Math.max(...statusReservation.map(r => r.y + r.height)) : 120);+ const statusReservation = geometry.regions.filter(+ (r) =>+ r.kind === "occlusion" && r.y === 0 && r.x + r.width >= geometry.width,+ );+ const sideRailTop = Math.max(+ insets.top,+ statusReservation.length+ ? Math.max(...statusReservation.map((r) => r.y + r.height))+ : 120,+ );const [interfaceAngle, setInterfaceAngle] = useState<number | null>(null);- const toolbarOnLeft =- systemSideRail ? false :- Platform.OS === "ios" &&- landscape &&- (interfaceAngle === 270 ||- (interfaceAngle === null && insets.right > insets.left));+ const toolbarOnLeft = systemSideRail+ ? false+ : Platform.OS === "ios" &&+ landscape &&+ (interfaceAngle === 270 ||+ (interfaceAngle === null && insets.right > insets.left));const webview = useRef<ComponentRef<typeof WebView>>(null);const nativeViewer = useRef<NativeRemoteDesktopHandle>(null);// Memo survives ordinary renders, but Fast Refresh invalidates it when the// bundled viewer changes. A ref kept the old script alongside new RN layout.- const html = useMemo(() =>- remoteDesktopViewerHtml(- colors.surface,- colors.textPrimary,- Boolean(NativeRemoteDesktopView),- ),- []);+ const html = useMemo(+ () =>+ remoteDesktopViewerHtml(+ colors.surface,+ colors.textPrimary,+ Boolean(NativeRemoteDesktopView),+ ),+ [],+ );const [viewerReadyRevision, setViewerReadyRevision] = useState(0);const active = useRef<RemoteDesktopLease | null>(null);// View only is a local guard against stray touches. The host keeps control@@ -346,7 +381,8 @@ export function RemoteDesktopSession({const [viewOnlySelected, setViewOnlySelected] = useState(false);const viewOnlyRef = useRef(false);/** Input reaches the computer only with host control and outside view only. */- const inputAllowed = (controlling: boolean) => controlling && !viewOnlyRef.current;+ const inputAllowed = (controlling: boolean) =>+ controlling && !viewOnlyRef.current;// Last control bit we asked the host for but have not confirmed. Overflow and// take-control can time out after the local bit already moved; heartbeats use// this to retry a release or restore local control instead of ignoring host-true.@@ -504,19 +540,45 @@ export function RemoteDesktopSession({// complete back button fits in its unobstructed leading corner.const sharedBackTop = insets.top - backControlHeight - spacing.md;const portraitBackLeft = edgePadding.paddingLeft + spacing.lg;- const sharedStatusRow = Platform.OS === 'ios' && !landscape && !tableRegion- && geometry.reservedRegionsSupported && geometry.regularWidth- && statusReservation.length > 0 && sharedBackTop >= spacing.md- && !geometry.regions.some(region =>- region.x < portraitBackLeft + navigationChrome.target && region.x + region.width > portraitBackLeft- && region.y < sharedBackTop + backControlHeight && region.y + region.height > sharedBackTop);+ const sharedStatusRow =+ Platform.OS === "ios" &&+ !landscape &&+ !tableRegion &&+ geometry.reservedRegionsSupported &&+ geometry.regularWidth &&+ statusReservation.length > 0 &&+ sharedBackTop >= spacing.md &&+ !geometry.regions.some(+ (region) =>+ region.x < portraitBackLeft + navigationChrome.target &&+ region.x + region.width > portraitBackLeft &&+ region.y < sharedBackTop + backControlHeight &&+ region.y + region.height > sharedBackTop,+ );// Android's system keyboard already resizes the window. Keep its existing// flow layout; only iOS needs an offset above the native keyboard.const landscapeKeyboardOverlay =landscape && (Platform.OS === "ios" || fullKeys);const keyboardBottom =Platform.OS === "ios" && keyboard && !fullKeys ? nativeKeyboardHeight : 0;- const foldLayout = foldDesktopLayout(geometry, keyboardBottom, keyboardPanelHeight, keyboard);+ const foldLayout = foldDesktopLayout(+ geometry,+ keyboardBottom,+ keyboardPanelHeight,+ keyboard,+ );+ const [foldSkin, setFoldSkin] = useState<FoldDesktopSkin>("macii");+ const foldSkinAvailable = Platform.OS === "ios" && Boolean(foldLayout);+ const retroDesktop =+ foldSkinAvailable &&+ foldSkin !== "modern" &&+ frameReady &&+ !keyboard &&+ !operations;+ const retroViewport =+ retroDesktop && foldLayout+ ? retroDesktopViewport(foldLayout.media, foldSkin)+ : null;const fullScreenFoldBackground = Boolean(foldLayout);const foldControls = foldLayout?.controls ?? controlRegion(geometry);const heldKeys = useRef(new Map<string, string[]>());@@ -527,7 +589,8 @@ export function RemoteDesktopSession({const command = message as Record<string, unknown>;// Every control handoff retires the parent batch together with the viewer// queue. A late native fallback, failure or ACK cannot own the next batch.- if (command.type === "control" || command.type === "stop") inputBusy.current = null;+ if (command.type === "control" || command.type === "stop")+ inputBusy.current = null;const owner = active.current;const attempt = command.attemptId ?? mediaAttempt.current;webview.current?.postMessage(JSON.stringify(message));@@ -1062,13 +1125,15 @@ export function RemoteDesktopSession({.finally(() => {if (active.current !== current) return;controlInFlight.current = false;- if (foregroundRestorePending.current) restoreInlinePresentationRef.current();+ if (foregroundRestorePending.current)+ restoreInlinePresentationRef.current();});// PiP must wait for both recovery grants and overflow releases before it// authorizes background viewing; an older operation cannot clear a new one.controlRestoration.current = operation;void operation.finally(() => {- if (controlRestoration.current === operation) controlRestoration.current = null;+ if (controlRestoration.current === operation)+ controlRestoration.current = null;});return operation;};@@ -1274,7 +1339,8 @@ export function RemoteDesktopSession({});// Entering remote desktop is the user's intent to control. The existing// host permission and ownership gates still decide whether it is allowed.- if (next.controlling) send({ type: "control", enabled: inputAllowed(true) });+ if (next.controlling)+ send({ type: "control", enabled: inputAllowed(true) });else if (result.canControl) {try {const control = await viewerSession.current!.control(true);@@ -1282,7 +1348,10 @@ export function RemoteDesktopSession({// Control changes keep the same session identity for in-flight replies.next.controlling = control.controlling;setLease({ ...next });- send({ type: "control", enabled: inputAllowed(control.controlling) });+ send({+ type: "control",+ enabled: inputAllowed(control.controlling),+ });} catch (cause) {if (current === generation.current) resolveControlFailure(cause);}@@ -1294,7 +1363,8 @@ export function RemoteDesktopSession({} finally {if (current === generation.current) {connecting.current = false;- if (foregroundRestorePending.current) restoreInlinePresentationRef.current();+ if (foregroundRestorePending.current)+ restoreInlinePresentationRef.current();}}},@@ -1445,6 +1515,15 @@ export function RemoteDesktopSession({send({ type: "viewport", fillHeight: landscape });}, [landscape, send, viewerReadyRevision]);+ useEffect(() => {+ if (!retroDesktop || !focused) return;+ return () => {+ heldKeys.current.clear();+ setModifiers([]);+ send({ type: "releaseInput" });+ };+ }, [retroDesktop, foldSkin, focused, send]);+useEffect(() => {alive.current = true;const subscription = AppState.addEventListener("change", (state) => {@@ -1691,10 +1770,10 @@ export function RemoteDesktopSession({useEffect(() => {send({type: "theme",- surface: colors.surface,+ surface: retroDesktop ? darkColors.surface : colors.surface,foreground: colors.textPrimary,});- }, [colors.surface, colors.textPrimary, send]);+ }, [colors.surface, colors.textPrimary, retroDesktop, send]);useEffect(() => {send({ type: "mode", mode });}, [mode, send]);@@ -1703,14 +1782,27 @@ export function RemoteDesktopSession({type: "mouseButtons",native: Platform.OS === "ios",fitToInsets: fullScreenFoldBackground,- topInset: fullScreenFoldBackground ? foldLayout!.media.y : tableRegion ? 0 : edgePadding.paddingTop,- bottomInset: fullScreenFoldBackground- ? Math.max(0, geometry.height - foldLayout!.media.y - foldLayout!.media.height) : tableRegion ? 0 :- keyboard && landscapeKeyboardOverlay- ? keyboardPanelHeight + keyboardBottom- : !keyboard && !landscape- ? toolbarSize.height- : 0,+ topInset: retroDesktop+ ? 0+ : fullScreenFoldBackground+ ? foldLayout!.media.y+ : tableRegion+ ? 0+ : edgePadding.paddingTop,+ bottomInset: retroDesktop+ ? 0+ : fullScreenFoldBackground+ ? Math.max(+ 0,+ geometry.height - foldLayout!.media.y - foldLayout!.media.height,+ )+ : tableRegion+ ? 0+ : keyboard && landscapeKeyboardOverlay+ ? keyboardPanelHeight + keyboardBottom+ : !keyboard && !landscape+ ? toolbarSize.height+ : 0,keyboardOpen: keyboard && landscapeKeyboardOverlay,portraitKeyboardTopInset:keyboard && !landscape && !tableRegion@@ -1721,11 +1813,7 @@ export function RemoteDesktopSession({rightInset: 0,leftInset: 0,enabled:- showMouseButtons &&- focused &&- !operations &&- !keyboard &&- canInput,+ showMouseButtons && focused && !operations && !keyboard && canInput,labels: {left: t("remoteDesktop.leftClick"),right: t("remoteDesktop.rightClick"),@@ -1733,8 +1821,13 @@ export function RemoteDesktopSession({},});}, [- tableRegion?.first.height, tableRegion?.first.width,- fullScreenFoldBackground, foldLayout?.media.y, foldLayout?.media.height, geometry.height,+ tableRegion?.first.height,+ tableRegion?.first.width,+ fullScreenFoldBackground,+ foldLayout?.media.y,+ foldLayout?.media.height,+ geometry.height,+ retroDesktop,viewerReadyRevision,showMouseButtons,edgePadding.paddingTop,@@ -1792,7 +1885,7 @@ export function RemoteDesktopSession({}if (message.type === "ready") {ready.current = true;- setViewerReadyRevision(revision => revision + 1);+ setViewerReadyRevision((revision) => revision + 1);void connectRef.current();return;}@@ -3053,19 +3146,23 @@ export function RemoteDesktopSession({if (code === "Backspace" && caps?.platform !== "darwin") return "Backspace";return LABELS[code] ?? code.replace(/^Key|^Digit/, "");};- const heldKey = (code: string) => (+ const heldKey = (code: string, retro = false) => (<Pressablekey={code}+ testID={retro ? `remoteDesktop.retroKey.${code}` : undefined}+ disabled={retro && !canInput}accessibilityRole="button"accessibilityLabel={keyLabel(code)}style={({ pressed }) => [styles.computerKey,+ retro && styles.retroKey,+ retro && code === "Space" && { flex: 4 },pressed && styles.keyPressed,]}onPressIn={() => {if (!inputAllowed(Boolean(active.current?.controlling))) return;const alreadyHeld = new Set([...heldKeys.current.values()].flat());- const keys = comboMode ? [...modifiers, code] : [code];+ const keys = !retro && comboMode ? [...modifiers, code] : [code];heldKeys.current.set(code, keys);send({type: "events",@@ -3092,13 +3189,18 @@ export function RemoteDesktopSession({if (!comboMode) setModifiers([]);}}>+ {retro && <FoldDesktopKeycap skin={foldSkin} />}<TextnumberOfLines={1}adjustsFontSizeToFitstyle={[- /^Key|^Digit|^Arrow/.test(code)+ /^Key|^Digit|^Arrow/.test(code) || (retro && code === "Space")? styles.keyText: styles.specialKeyText,+ retro && {+ color: foldDesktopSkinColors(foldSkin).textPrimary,+ fontWeight: fontWeight.medium,+ },]}>{keyLabel(code)}@@ -3127,19 +3229,56 @@ export function RemoteDesktopSession({style={styles.root}>{Platform.OS === "android" && focused && <StatusBar hidden />}+ {retroDesktop && focused && <FoldDesktopBackdrop skin={foldSkin} />}<View style={[styles.body, landscape && styles.landscape]}><Viewstyle={[styles.canvas,- { marginLeft: landscape ? 0 : edgePadding.paddingLeft, marginRight: landscape ? 0 : edgePadding.paddingRight },- fullScreenFoldBackground ? { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, marginLeft: 0, marginRight: 0 } : foldLayout && { position: 'absolute', flex: 0, left: foldLayout.media.x, top: foldLayout.media.y,- width: foldLayout.media.width, height: foldLayout.media.height, marginLeft: 0, marginRight: 0 },+ {+ marginLeft: landscape ? 0 : edgePadding.paddingLeft,+ marginRight: landscape ? 0 : edgePadding.paddingRight,+ },+ fullScreenFoldBackground+ ? {+ position: "absolute",+ top: 0,+ bottom: 0,+ left: 0,+ right: 0,+ marginLeft: 0,+ marginRight: 0,+ }+ : foldLayout && {+ position: "absolute",+ flex: 0,+ left: foldLayout.media.x,+ top: foldLayout.media.y,+ width: foldLayout.media.width,+ height: foldLayout.media.height,+ marginLeft: 0,+ marginRight: 0,+ },]}>+ {retroDesktop && focused && foldLayout ? (+ <FoldDesktopBezel region={foldLayout.media} skin={foldSkin} />+ ) : null}<Animated.ViewtestID="remoteDesktop.media"pointerEvents={frameReady ? "auto" : "none"}- style={[StyleSheet.absoluteFill, mediaReveal]}+ style={[+ StyleSheet.absoluteFill,+ mediaReveal,+ retroViewport && {+ left: retroViewport.x,+ right: geometry.width - retroViewport.x - retroViewport.width,+ top: retroViewport.y,+ bottom:+ geometry.height - retroViewport.y - retroViewport.height,+ borderRadius: radius.control,+ overflow: "hidden",+ },+ ]}>{NativeRemoteDesktopView && (<NativeRemoteDesktopView@@ -3149,7 +3288,11 @@ export function RemoteDesktopSession({pointerEvents="none"style={[StyleSheet.absoluteFill,- { backgroundColor: colors.surface },+ {+ backgroundColor: retroDesktop+ ? darkColors.surface+ : colors.surface,+ },]}/>)}@@ -3377,10 +3520,22 @@ export function RemoteDesktopSession({]}><RemoteDesktopPanel- railAnchor={systemSideRail ? {- right: (sideRailWidth - navigationChrome.target) / 2,- top: (sideRailTop + navigationChrome.target + spacing.lg + windowSize.height - insets.bottom - navigationChrome.target * (handoff ? 2 : caps?.omarchyMenu ? 5 : 4)) / 2,- } : undefined}+ railAnchor={+ systemSideRail+ ? {+ right: (sideRailWidth - navigationChrome.target) / 2,+ top:+ (sideRailTop ++ navigationChrome.target ++ spacing.lg ++ windowSize.height -+ insets.bottom -+ navigationChrome.target *+ (handoff ? 2 : caps?.omarchyMenu ? 5 : 4)) /+ 2,+ }+ : undefined+ }toolbarOnLeft={toolbarOnLeft}toolbarActionCount={handoff ? 2 : caps?.omarchyMenu ? 5 : 4}visible={operations && focused}@@ -3426,7 +3581,15 @@ export function RemoteDesktopSession({}presentation={{enabled: pipEnabled,- canRotate: typeof remotePresentation?.rotate === "function" && !(geometry.reservedRegionsSupported && Platform.OS === "ios" && !Platform.isPad && geometry.regularWidth && geometry.regularHeight),+ canRotate:+ typeof remotePresentation?.rotate === "function" &&+ !(+ geometry.reservedRegionsSupported &&+ Platform.OS === "ios" &&+ !Platform.isPad &&+ geometry.regularWidth &&+ geometry.regularHeight+ ),canPip: Boolean(remotePresentation &&caps?.backgroundViewing &&@@ -3483,13 +3646,54 @@ export function RemoteDesktopSession({)}</View>{tableRegion && frameReady && focused && !keyboard && !operations ? (- <View testID="remoteDesktop.foldControls" style={{ position: 'absolute', left: foldControls.x,- top: foldControls.y, width: foldControls.width, height: foldControls.height,- paddingBottom: toolbarSize.height + (showMouseButtons ? 80 : 0) }}>- <FoldTouchpad send={send} enabled={canInput} />- {showMouseButtons && canInput ? <RemoteDesktopMouseControls send={send}- bottom={toolbarSize.height} right={0} compact labels={{ left: t("remoteDesktop.leftClick"),- right: t("remoteDesktop.rightClick"), wheel: t("remoteDesktop.mouseWheel") }} /> : null}+ <View+ testID="remoteDesktop.foldControls"+ style={{+ position: "absolute",+ left: foldControls.x,+ top: foldControls.y,+ width: foldControls.width,+ height: foldControls.height,+ paddingBottom: toolbarSize.height + (showMouseButtons ? 80 : 0),+ }}+ >+ {retroDesktop ? (+ <FoldDesktopDeck+ renderKey={(code) => heldKey(code, true)}+ send={send}+ enabled={canInput}+ skin={foldSkin}+ onChange={setFoldSkin}+ />+ ) : (+ <>+ {foldSkinAvailable ? (+ <FoldDesktopSkinSwitch+ skin={foldSkin}+ onChange={(value) => {+ heldKeys.current.clear();+ setModifiers([]);+ send({ type: "releaseInput" });+ setFoldSkin(value);+ }}+ />+ ) : null}+ <FoldTouchpad send={send} enabled={canInput} />+ </>+ )}+ {showMouseButtons && canInput ? (+ <RemoteDesktopMouseControls+ send={send}+ bottom={toolbarSize.height}+ right={0}+ compact+ labels={{+ left: t("remoteDesktop.leftClick"),+ right: t("remoteDesktop.rightClick"),+ wheel: t("remoteDesktop.mouseWheel"),+ }}+ />+ ) : null}</View>) : null}{!keyboard && (@@ -3543,8 +3747,13 @@ export function RemoteDesktopSession({paddingBottom: Math.max(spacing.sm, insets.bottom),}),},- tableRegion && { left: foldControls.x, right: undefined, width: foldControls.width,- bottom: geometry.height - foldControls.y - foldControls.height, paddingBottom: spacing.sm },+ tableRegion && {+ left: foldControls.x,+ right: undefined,+ width: foldControls.width,+ bottom: geometry.height - foldControls.y - foldControls.height,+ paddingBottom: spacing.sm,+ },systemSideRail && {left: toolbarOnLeft ? 0 : undefined,right: toolbarOnLeft ? undefined : 0,@@ -3555,8 +3764,8 @@ export function RemoteDesktopSession({paddingLeft: 0,paddingRight: 0,paddingBottom: 0,- alignItems: 'center',- justifyContent: 'center',+ alignItems: "center",+ justifyContent: "center",},]}>@@ -3642,21 +3851,28 @@ export function RemoteDesktopSession({{top: landscape? insets.top + spacing.lg- : sharedStatusRow ? sharedBackTop : edgePadding.paddingTop + spacing.xs,+ : sharedStatusRow+ ? sharedBackTop+ : edgePadding.paddingTop + spacing.xs,// iOS landscape: Island/notch sits mid-edge, so the top-left// corner stays clear even when insets.left is large. Skip that// inset unless the top edge is also unsafe — a physical cutout// occupying the corner, not a centered island. Android left// insets are an unsafe strip (cutout/curve), not an island.left: landscape- ? (Platform.OS === "ios" && !geometry.reservedRegionsSupported && insets.top === 0 ? 0 : insets.left) ++ ? (Platform.OS === "ios" &&+ !geometry.reservedRegionsSupported &&+ insets.top === 0+ ? 0+ : insets.left) +spacing.lg +(Platform.OS === "ios" ? spacing.xs : 0): portraitBackLeft,},systemSideRail && {top: sideRailTop,- left: windowSize.width - (sideRailWidth + navigationChrome.target) / 2,+ left:+ windowSize.width - (sideRailWidth + navigationChrome.target) / 2,width: navigationChrome.target,},]}@@ -3685,9 +3901,16 @@ export function RemoteDesktopSession({? Math.max(spacing.sm, insets.bottom): spacing.xs,},- foldLayout && { position: 'absolute', left: foldControls.x, width: foldControls.width,+ foldLayout && {+ position: "absolute",+ left: foldControls.x,+ width: foldControls.width,bottom: geometry.height - foldControls.y - foldControls.height,- maxHeight: foldControls.height, paddingLeft: spacing.xs, paddingRight: spacing.sm, paddingBottom: 0 },+ maxHeight: foldControls.height,+ paddingLeft: spacing.xs,+ paddingRight: spacing.sm,+ paddingBottom: 0,+ },]}><View style={styles.keyboardHeader}>@@ -3811,7 +4034,10 @@ export function RemoteDesktopSession({});}}onPress={() => {- if (!comboMode || !inputAllowed(Boolean(active.current?.controlling)))+ if (+ !comboMode ||+ !inputAllowed(Boolean(active.current?.controlling))+ )return;setModifiers((previous) =>previous.includes(code)@@ -4026,7 +4252,11 @@ const makeStyles = (colors: ThemeColors) =>borderColor: colors.textPrimary,},disabled: { opacity: 0.4 },- buttonText: { color: colors.textPrimary, fontSize: typeScale.caption, lineHeight: lineHeight.caption },+ buttonText: {+ color: colors.textPrimary,+ fontSize: typeScale.caption,+ lineHeight: lineHeight.caption,+ },keyboardOverlay: { position: "absolute", left: 0, right: 0 },keyboard: {backgroundColor: colors.surfaceTranslucent,@@ -4109,7 +4339,11 @@ const makeStyles = (colors: ThemeColors) =>lineHeight: lineHeight.body,fontWeight: fontWeight.medium,},- specialKeyText: { color: colors.textPrimary, fontSize: typeScale.caption, lineHeight: lineHeight.caption },+ specialKeyText: {+ color: colors.textPrimary,+ fontSize: typeScale.caption,+ lineHeight: lineHeight.caption,+ },pageNavigation: {flexDirection: "row",justifyContent: "center",@@ -4148,4 +4382,9 @@ const makeStyles = (colors: ThemeColors) =>borderBottomWidth: StyleSheet.hairlineWidth,borderBottomColor: colors.border,},+ retroKey: {+ backgroundColor: "transparent",+ borderBottomWidth: 0,+ paddingBottom: spacing.xs,+ },});diff --git a/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx b/apps/mobile/src/remote-desktop/__tests__/screen.test.tsxindex 9f0a9d74cb..d1ee0f6dde 100644--- a/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx+++ b/apps/mobile/src/remote-desktop/__tests__/screen.test.tsx@@ -1,5 +1,5 @@-import { GeometryContext } from '@/platform/AdaptiveWindowContext';-import type { WindowGeometry } from '@/platform/windowGeometry';+import { GeometryContext } from "@/platform/AdaptiveWindowContext";+import type { WindowGeometry } from "@/platform/windowGeometry";// @vitest-environment jsdomimport {act,@@ -41,7 +41,9 @@ const storage = vi.hoisted(() => {vi.mock("@react-native-async-storage/async-storage", () => ({default: storage,}));-vi.mock('expo-blur', async () => ({ BlurView: (await import('react-native')).View }));+vi.mock("expo-blur", async () => ({+ BlurView: (await import("react-native")).View,+}));vi.mock("react-native-reanimated", async () => {const { View } = await import("react-native");@@ -168,6 +170,7 @@ vi.mock("react-native", async () => {},Alert: { alert: fixture.alert },View: view("div"),+ Image: view("div"),Modal: (p: any) =>p.visible ? createElement("div", {}, p.children) : null,Pressable: view("button"),@@ -194,10 +197,17 @@ vi.mock("react-native", async () => {return { remove() {} };},},- Dimensions: { get: (kind: string) => kind === "screen" ? fixture.displaySize ?? fixture.size : fixture.size },+ Dimensions: {+ get: (kind: string) =>+ kind === "screen"+ ? (fixture.displaySize ?? fixture.size)+ : fixture.size,+ },useWindowDimensions: () => fixture.size,Platform: {- get Version() { return fixture.iosVersion; },+ get Version() {+ return fixture.iosVersion;+ },isPad: false,get OS() {return fixture.platform;@@ -326,6 +336,7 @@ vi.mock("@/theme", async () => {const tokens = await import("@/theme/tokens");return {...tokens,+ monoFont: "Menlo",useTheme: () => ({colors:fixture.themeMode === "dark" ? tokens.darkColors : tokens.lightColors,@@ -337,6 +348,25 @@ vi.mock("@/theme", async () => {),};});+vi.mock("../retroMacArtwork", () => ({+ retroMacArtwork: {+ display: 1,+ deck: 2,+ keycap: 3,+ compact: 4,+ edge: 5,+ rail: 6,+ keys: 7,+ pad: 8,+ darkKeycap: 9,+ trackpoint: 10,+ heritage: {+ macii: { display: 11, rail: 12, keys: 13, palm: 14, control: 15 },+ powerbook: { display: 16, rail: 17, keys: 18, palm: 19, control: 20 },+ thinkpad: { display: 21, rail: 22, keys: 23, palm: 24, control: 25 },+ },+ },+}));vi.mock("@/device-link/DeviceLinkContext", () => ({useDeviceLink: () => ({status: fixture.status,@@ -739,10 +769,14 @@ describe("remote desktop controls", () => {await act(async () => render(false));if (reason === "control-busy") {expect(onEnded).not.toHaveBeenCalled();- expect(requests().filter((r) => r.op === "presentation")).toHaveLength(0);+ expect(requests().filter((r) => r.op === "presentation")).toHaveLength(+ 0,+ );await act(async () => finish?.());await nativePresentation("presentation", { active: true });- expect(requests().filter((r) => r.op === "presentation" && r.enabled)).toHaveLength(1);+ expect(+ requests().filter((r) => r.op === "presentation" && r.enabled),+ ).toHaveLength(1);expect(requests().filter((r) => r.op === "stop")).toHaveLength(0);return;}@@ -1006,7 +1040,11 @@ describe("remote desktop controls", () => {expect(requests().filter((r) => r.op === "control" && r.enabled),).toHaveLength(1);- expect(sent().filter((m) => m.type === "control").at(-1)).toEqual({+ expect(+ sent()+ .filter((m) => m.type === "control")+ .at(-1),+ ).toEqual({type: "control",enabled: controlling,});@@ -1400,9 +1438,11 @@ describe("remote desktop controls", () => {let finish!: (value: unknown) => void;const original = fixture.invoke.getMockImplementation()!;fixture.invoke.mockImplementation((...args) =>- (canControl- ? args[2][0].op === "control" && args[2][0].enabled- : args[2][0].op === "presentation" && !args[2][0].enabled)+ (+ canControl+ ? args[2][0].op === "control" && args[2][0].enabled+ : args[2][0].op === "presentation" && !args[2][0].enabled+ )? new Promise((resolve) => {finish = resolve;})@@ -1745,10 +1785,15 @@ describe("remote desktop controls", () => {// The sent release has an unknown outcome. Reconcile before granting// control, and never replay that release onto a different transport.const original = fixture.invoke.getMockImplementation()!;- fixture.invoke.mockImplementation((...args) => args[2][0].op === "heartbeat"- ? Promise.resolve({ controlling: false }) : original(...args));+ fixture.invoke.mockImplementation((...args) =>+ args[2][0].op === "heartbeat"+ ? Promise.resolve({ controlling: false })+ : original(...args),+ );await act(async () => vi.advanceTimersByTimeAsync(3000));- expect(relayedControl()).toEqual([{ op: "control", lease: "lease", enabled: true }]);+ expect(relayedControl()).toEqual([+ { op: "control", lease: "lease", enabled: true },+ ]);expect(channelRequest().id).toBe(first);});@@ -3304,7 +3349,10 @@ describe("remote desktop controls", () => {act(() => button("keyboard").click());act(() => button("computerKeyboard").click());const style = fixture.views["remoteDesktop.keyPageViewport"].style;- expect(style).toEqual({ flexShrink: 1, maxHeight: landscape ? 156 : 300 });+ expect(style).toEqual({+ flexShrink: 1,+ maxHeight: landscape ? 156 : 300,+ });act(() => button("functionKeys").click());expect(fixture.views["remoteDesktop.keyPageViewport"].style).toEqual(style,@@ -3390,7 +3438,9 @@ describe("remote desktop controls", () => {await act(async () => vi.advanceTimersByTimeAsync(3000));expect(requests().filter((r) => r.op === "heartbeat")).toHaveLength(2);expect(- requests().filter((r) => r.op === "heartbeat").at(-1),+ requests()+ .filter((r) => r.op === "heartbeat")+ .at(-1),).toMatchObject({ lockOnExit: enabled });await act(async () => button("disconnect").click());expect(requests().filter((r) => r.op === "stop")).toEqual([@@ -3414,7 +3464,9 @@ describe("remote desktop controls", () => {});await act(async () => vi.advanceTimersByTimeAsync(3000));expect(- requests().filter((r) => r.op === "heartbeat").at(-1),+ requests()+ .filter((r) => r.op === "heartbeat")+ .at(-1),).toMatchObject({ lockOnExit: true });await act(async () => button("back").click());expect(requests().filter((r) => r.op === "stop")).toEqual([@@ -3863,18 +3915,30 @@ describe("remote desktop controls", () => {fixture.size = { width: 390, height: 616 };act(() => root.render(<RemoteDesktopScreen />));await connect();- expect(sent().find(message => message.type === "init")).toMatchObject({ fillHeight: false });+ expect(sent().find((message) => message.type === "init")).toMatchObject({+ fillHeight: false,+ });const viewer = host.querySelector('[data-testid="remoteDesktop.viewer"]');for (const height of [300, 616, 280]) {fixture.size = { width: 390, height };act(() => root.render(<RemoteDesktopScreen />));- expect(sent().filter(message => message.type === "viewport").at(-1)).toMatchObject({ fillHeight: false });- expect(host.querySelector('[data-testid="remoteDesktop.viewer"]')).toBe(viewer);+ expect(+ sent()+ .filter((message) => message.type === "viewport")+ .at(-1),+ ).toMatchObject({ fillHeight: false });+ expect(host.querySelector('[data-testid="remoteDesktop.viewer"]')).toBe(+ viewer,+ );}fixture.displaySize = { width: 640, height: 390 };fixture.size = { width: 640, height: 200 };act(() => root.render(<RemoteDesktopScreen />));- expect(sent().filter(message => message.type === "viewport").at(-1)).toMatchObject({ fillHeight: true });+ expect(+ sent()+ .filter((message) => message.type === "viewport")+ .at(-1),+ ).toMatchObject({ fillHeight: true });});it("restores the portrait top inset while the native safe area still reports landscape", async () => {await connect();@@ -3893,13 +3957,17 @@ describe("remote desktop controls", () => {act(() => root.render(<RemoteDesktopScreen />));expect(topInset()).toBe(59);});- it('preserves a valid side safe area on a modern tall window', async () => {+ it("preserves a valid side safe area on a modern tall window", async () => {fixture.iosVersion = 27;fixture.size = { width: 600, height: 900 };fixture.safe = { top: 0, bottom: 20, left: 60, right: 0 };act(() => root.render(<RemoteDesktopScreen />));await connect();- expect(sent().filter(message => message.type === 'mouseButtons').at(-1)?.topInset).toBe(0);+ expect(+ sent()+ .filter((message) => message.type === "mouseButtons")+ .at(-1)?.topInset,+ ).toBe(0);});it("overlays landscape keyboards and includes their measured occlusion", async () => {fixture.size = { width: 844, height: 390 };@@ -4697,51 +4765,105 @@ describe("remote desktop controls", () => {expect(requests().filter((r) => r.op === "stop")).toHaveLength(0);expect(host.textContent).not.toContain("remoteDesktop.reconnecting");expect(- requests().filter((r) => r.op === "control").map((r) => r.enabled),+ requests()+ .filter((r) => r.op === "control")+ .map((r) => r.enabled),).toEqual([true, false, true]);});- it.each(["resolve", "reject", "native fallback"])("isolates renewed control from an old input %s", async (outcome) => {- if (outcome === "native fallback") fixture.nativeMedia = true;- await connect();- const original = fixture.invoke.getMockImplementation()!;- let settleOld!: () => void;- let settleNew!: () => void;- if (outcome === "native fallback") {- fixture.nativeInput.mockImplementationOnce(() => new Promise<boolean>((resolve) => {- settleOld = () => resolve(false);- })).mockResolvedValue(false);- }- fixture.invoke.mockImplementation((...args) => {- const req = args[2][0];- if (req.op === "input" && req.sequence === 1) return new Promise((resolve, reject) => {- settleOld = () => outcome === "reject" ? reject(new Error("DESKTOP_VIEW_ONLY")) : resolve({});+ it.each(["resolve", "reject", "native fallback"])(+ "isolates renewed control from an old input %s",+ async (outcome) => {+ if (outcome === "native fallback") fixture.nativeMedia = true;+ await connect();+ const original = fixture.invoke.getMockImplementation()!;+ let settleOld!: () => void;+ let settleNew!: () => void;+ if (outcome === "native fallback") {+ fixture.nativeInput+ .mockImplementationOnce(+ () =>+ new Promise<boolean>((resolve) => {+ settleOld = () => resolve(false);+ }),+ )+ .mockResolvedValue(false);+ }+ fixture.invoke.mockImplementation((...args) => {+ const req = args[2][0];+ if (req.op === "input" && req.sequence === 1)+ return new Promise((resolve, reject) => {+ settleOld = () =>+ outcome === "reject"+ ? reject(new Error("DESKTOP_VIEW_ONLY"))+ : resolve({});+ });+ if (req.op === "input" && req.sequence === 2)+ return new Promise((resolve) => {+ settleNew = () => resolve({});+ });+ return original(...args);});- if (req.op === "input" && req.sequence === 2) return new Promise((resolve) => {- settleNew = () => resolve({});+ const input = (sequence: number) =>+ fixture.message!({+ nativeEvent: {+ data: JSON.stringify({+ type: "input",+ epoch: "lease",+ sequence,+ events: [{ kind: "move", x: 0.5, y: 0.5 }],+ }),+ },+ });+ await act(async () => input(1));+ await act(async () =>+ fixture.message!({+ nativeEvent: {+ data: JSON.stringify({ type: "inputOverflow", epoch: "lease" }),+ },+ }),+ );+ act(() => button("operations").click());+ await act(async () => button("viewOnly").click());+ await act(async () => button("viewOnly").click());+ await act(async () => input(2));+ expect(+ requests()+ .filter((r) => r.op === "input")+ .map((r) => r.sequence),+ ).toContain(2);+ await act(async () => settleOld());+ expect(+ sent()+ .filter((m) => m.type === "control")+ .at(-1),+ ).toEqual({ type: "control", enabled: true });+ expect(sent()).not.toContainEqual({+ type: "ack",+ epoch: "lease",+ sequence: 1,});- return original(...args);- });- const input = (sequence: number) => fixture.message!({ nativeEvent: { data: JSON.stringify({- type: "input", epoch: "lease", sequence, events: [{ kind: "move", x: 0.5, y: 0.5 }],- }) } });- await act(async () => input(1));- await act(async () => fixture.message!({ nativeEvent: { data: JSON.stringify({ type: "inputOverflow", epoch: "lease" }) } }));- act(() => button("operations").click());- await act(async () => button("viewOnly").click());- await act(async () => button("viewOnly").click());- await act(async () => input(2));- expect(requests().filter(r => r.op === "input").map(r => r.sequence)).toContain(2);- await act(async () => settleOld());- expect(sent().filter(m => m.type === "control").at(-1)).toEqual({ type: "control", enabled: true });- expect(sent()).not.toContainEqual({ type: "ack", epoch: "lease", sequence: 1 });- await act(async () => input(3));- expect(requests().filter(r => r.op === "input").map(r => r.sequence)).not.toContain(3);- if (outcome === "native fallback") expect(requests().filter(r => r.op === "input").map(r => r.sequence)).not.toContain(1);- await act(async () => settleNew());- await act(async () => input(4));- expect(requests().filter(r => r.op === "input").map(r => r.sequence)).toContain(4);- expect(requests().filter(r => r.op === "stop")).toHaveLength(0);- });+ await act(async () => input(3));+ expect(+ requests()+ .filter((r) => r.op === "input")+ .map((r) => r.sequence),+ ).not.toContain(3);+ if (outcome === "native fallback")+ expect(+ requests()+ .filter((r) => r.op === "input")+ .map((r) => r.sequence),+ ).not.toContain(1);+ await act(async () => settleNew());+ await act(async () => input(4));+ expect(+ requests()+ .filter((r) => r.op === "input")+ .map((r) => r.sequence),+ ).toContain(4);+ expect(requests().filter((r) => r.op === "stop")).toHaveLength(0);+ },+ );it("retries a timed-out overflow release when the host still reports control", async () => {await connect();const original = fixture.invoke.getMockImplementation()!;@@ -4780,7 +4902,9 @@ describe("remote desktop controls", () => {const original = fixture.invoke.getMockImplementation()!;fixture.invoke.mockImplementation((...args) =>args[2][0].op === "control" && args[2][0].enabled- ? Promise.resolve({ controlling: false }) : original(...args));+ ? Promise.resolve({ controlling: false })+ : original(...args),+ );await act(async () => {fixture.message!({nativeEvent: {@@ -4981,8 +5105,14 @@ describe("remote desktop controls", () => {);await act(async () => button("viewOnly").click());// View only is local: input stops here and the host keeps control.- expect(requests().some((r) => r.op === "control" && !r.enabled)).toBe(false);- expect(sent().filter((m) => m.type === "control").at(-1)).toEqual({+ expect(requests().some((r) => r.op === "control" && !r.enabled)).toBe(+ false,+ );+ expect(+ sent()+ .filter((m) => m.type === "control")+ .at(-1),+ ).toEqual({type: "control",enabled: false,release: true,@@ -5006,7 +5136,10 @@ describe("remote desktop controls", () => {if (request.op === "capabilities")return { ...(result as object), autoControl: true };if (request.op === "start")- return { ...(result as object), controlling: request.control === true };+ return {+ ...(result as object),+ controlling: request.control === true,+ };return result;});};@@ -5024,7 +5157,10 @@ describe("remote desktop controls", () => {"keeps %s input after native playback preparation yields a render",async (inputMode) => {act(() => root.unmount());- storage.items.set("cindy.mobile.remote-desktop.input-mode.v1", inputMode);+ storage.items.set(+ "cindy.mobile.remote-desktop.input-mode.v1",+ inputMode,+ );fixture.nativeMedia = true;root = createRoot(host);await act(async () => root.render(<RemoteDesktopScreen />));@@ -5041,22 +5177,33 @@ describe("remote desktop controls", () => {fixture.message!({ nativeEvent: { data: '{"type":"ready"}' } });});expect(resumePlayback).toBeTypeOf("function");- expect(requests().find((request) => request.op === "start")).toMatchObject({+ expect(+ requests().find((request) => request.op === "start"),+ ).toMatchObject({control: true,});// React has already published the granted input mode before init.- expect(sent().filter((message) => message.type === "mode").at(-1)).toEqual({- type: "mode", mode: inputMode,+ expect(+ sent()+ .filter((message) => message.type === "mode")+ .at(-1),+ ).toEqual({+ type: "mode",+ mode: inputMode,});await act(async () => resumePlayback());const commands = sent();const init = commands.findIndex((message) => message.type === "init");expect(init).toBeGreaterThanOrEqual(0);expect(- commands.slice(init).filter((message) => message.type === "mode").at(-1),+ commands+ .slice(init)+ .filter((message) => message.type === "mode")+ .at(-1),).toEqual({ type: "mode", mode: inputMode });expect(commands.slice(init)).toContainEqual({- type: "control", enabled: true,+ type: "control",+ enabled: true,});},);@@ -5064,7 +5211,12 @@ describe("remote desktop controls", () => {act(async () =>fixture.message!({nativeEvent: {- data: JSON.stringify({ type: "input", epoch: "lease", sequence, events }),+ data: JSON.stringify({+ type: "input",+ epoch: "lease",+ sequence,+ events,+ }),},}),);@@ -5077,10 +5229,16 @@ describe("remote desktop controls", () => {? new Promise(() => {}): original(...args),);- await viewerInput(1, [{ kind: "button", button: 0, down: true, x: 0.5, y: 0.5 }]);+ await viewerInput(1, [+ { kind: "button", button: 0, down: true, x: 0.5, y: 0.5 },+ ]);act(() => button("operations").click());await act(async () => button("viewOnly").click());- expect(sent()).toContainEqual({ type: "control", enabled: false, release: true });+ expect(sent()).toContainEqual({+ type: "control",+ enabled: false,+ release: true,+ });// The runtime's trailing release reaches the host past the busy batch.await viewerInput(2, [{ kind: "release" }]);expect(requests()).toContainEqual({@@ -5091,7 +5249,9 @@ describe("remote desktop controls", () => {});// Other input stays local while viewing only.await viewerInput(3, [{ kind: "move", x: 0.2, y: 0.2 }]);- expect(requests().some((r) => r.op === "input" && r.sequence === 3)).toBe(false);+ expect(requests().some((r) => r.op === "input" && r.sequence === 3)).toBe(+ false,+ );});it("drops a native-pending batch that falls back after view only started", async () => {fixture.nativeMedia = true;@@ -5110,7 +5270,9 @@ describe("remote desktop controls", () => {act(() => button("operations").click());await act(async () => button("viewOnly").click());await act(async () => fallback(false));- expect(requests().some((r) => r.op === "input" && r.sequence === 1)).toBe(false);+ expect(requests().some((r) => r.op === "input" && r.sequence === 1)).toBe(+ false,+ );});it("switches view only locally without asking the host", async () => {autoControl();@@ -5121,7 +5283,11 @@ describe("remote desktop controls", () => {await act(async () => button("viewOnly").click());expect(button("viewOnly").getAttribute("aria-selected")).toBe("true");expect(button("keyboard").disabled).toBe(true);- expect(sent()).toContainEqual({ type: "control", enabled: false, release: true });+ expect(sent()).toContainEqual({+ type: "control",+ enabled: false,+ release: true,+ });// Taps no longer reach the computer while viewing only.await act(async () =>fixture.message!({@@ -5138,7 +5304,11 @@ describe("remote desktop controls", () => {await act(async () => button("viewOnly").click());expect(button("viewOnly").getAttribute("aria-selected")).toBe("false");expect(button("keyboard").disabled).toBe(false);- expect(sent().filter((m) => m.type === "control").at(-1)).toEqual({+ expect(+ sent()+ .filter((m) => m.type === "control")+ .at(-1),+ ).toEqual({type: "control",enabled: true,});@@ -5177,86 +5347,284 @@ describe("remote desktop controls", () => {lockOnExit: false,});});- it('resends the upper-pane bounds whenever a folded viewer becomes ready', async () => {+ it("resends the upper-pane bounds whenever a folded viewer becomes ready", async () => {fixture.size = { width: 900, height: 1400 };const geometry: WindowGeometry = {- ...fixture.size, insets: { top: 80, left: 0, right: 0, bottom: 20 },- regularWidth: true, regularHeight: true, barEdge: 'none', reservedRegionsSupported: true,- regions: [{ kind: 'division', x: 0, y: 680, width: 900, height: 30 }],+ ...fixture.size,+ insets: { top: 80, left: 0, right: 0, bottom: 20 },+ regularWidth: true,+ regularHeight: true,+ barEdge: "none",+ reservedRegionsSupported: true,+ regions: [{ kind: "division", x: 0, y: 680, width: 900, height: 30 }],};- act(() => root.render(<GeometryContext.Provider value={geometry}><RemoteDesktopScreen /></GeometryContext.Provider>));+ act(() =>+ root.render(+ <GeometryContext.Provider value={geometry}>+ <RemoteDesktopScreen />+ </GeometryContext.Provider>,+ ),+ );await connect();fixture.post.mockClear();// On reload the WebView loses all JS state even though React geometry and// the active lease have not changed. Do not rely on a lease update to resend.- await act(async () => fixture.message!({ nativeEvent: { data: '{"type":"ready"}' } }));- expect(sent()).toContainEqual(expect.objectContaining({- type: 'mouseButtons', fitToInsets: true, topInset: 80, bottomInset: 720,- }));+ await act(async () =>+ fixture.message!({ nativeEvent: { data: '{"type":"ready"}' } }),+ );+ expect(sent()).toContainEqual(+ expect.objectContaining({+ type: "mouseButtons",+ fitToInsets: true,+ topInset: 80,+ bottomInset: 720,+ }),+ );});- it('folding and unfolding preserve the viewer and control lease', async () => {+ it("folding and unfolding preserve the viewer and control lease", async () => {const geometry: WindowGeometry = {- width: 900, height: 700, insets: { top: 0, left: 0, right: 60, bottom: 20 },- regularWidth: true, regularHeight: true, barEdge: 'right', regions: [], reservedRegionsSupported: true,+ width: 900,+ height: 700,+ insets: { top: 0, left: 0, right: 60, bottom: 20 },+ regularWidth: true,+ regularHeight: true,+ barEdge: "right",+ regions: [],+ reservedRegionsSupported: true,};fixture.size = { width: 900, height: 700 };- const renderGeometry = (g: WindowGeometry) => act(() => root.render(- <GeometryContext.Provider value={g}><RemoteDesktopScreen /></GeometryContext.Provider>,- ));+ const renderGeometry = (g: WindowGeometry) =>+ act(() =>+ root.render(+ <GeometryContext.Provider value={g}>+ <RemoteDesktopScreen />+ </GeometryContext.Provider>,+ ),+ );renderGeometry(geometry);await connect();- const rail = Object.assign({}, ...fixture.views['remoteDesktop.toolbarPosition'].style.flat(Infinity).filter(Boolean));- expect(rail).toMatchObject({ right: 0, left: undefined, width: 72, paddingRight: 0, alignItems: 'center' });- const backStyle = Object.assign({}, ...fixture.views['remoteDesktop.backPosition'].style.flat(Infinity).filter(Boolean));+ const rail = Object.assign(+ {},+ ...fixture.views["remoteDesktop.toolbarPosition"].style+ .flat(Infinity)+ .filter(Boolean),+ );+ expect(rail).toMatchObject({+ right: 0,+ left: undefined,+ width: 72,+ paddingRight: 0,+ alignItems: "center",+ });+ const backStyle = Object.assign(+ {},+ ...fixture.views["remoteDesktop.backPosition"].style+ .flat(Infinity)+ .filter(Boolean),+ );expect(backStyle).toMatchObject({ top: 120, left: 842, width: 44 });- act(() => fixture.views['remoteDesktop.toolbarPosition'].onLayout({- nativeEvent: { layout: { width: 72, height: 300 } },- }));- expect(sent().filter(m => m.type === 'mouseButtons').at(-1)).toMatchObject({ rightInset: 0 });+ act(() =>+ fixture.views["remoteDesktop.toolbarPosition"].onLayout({+ nativeEvent: { layout: { width: 72, height: 300 } },+ }),+ );+ expect(+ sent()+ .filter((m) => m.type === "mouseButtons")+ .at(-1),+ ).toMatchObject({ rightInset: 0 });// Rotating to the opposite landscape must not send custom chrome to the left.- renderGeometry({ ...geometry, barEdge: 'left', insets: { ...geometry.insets, left: 60, right: 0 } });- const rotatedRail = Object.assign({}, ...fixture.views['remoteDesktop.toolbarPosition'].style.flat(Infinity).filter(Boolean));- const rotatedBack = Object.assign({}, ...fixture.views['remoteDesktop.backPosition'].style.flat(Infinity).filter(Boolean));- expect(rotatedRail).toMatchObject({ right: 0, left: undefined, width: 60, alignItems: 'center' });+ renderGeometry({+ ...geometry,+ barEdge: "left",+ insets: { ...geometry.insets, left: 60, right: 0 },+ });+ const rotatedRail = Object.assign(+ {},+ ...fixture.views["remoteDesktop.toolbarPosition"].style+ .flat(Infinity)+ .filter(Boolean),+ );+ const rotatedBack = Object.assign(+ {},+ ...fixture.views["remoteDesktop.backPosition"].style+ .flat(Infinity)+ .filter(Boolean),+ );+ expect(rotatedRail).toMatchObject({+ right: 0,+ left: undefined,+ width: 60,+ alignItems: "center",+ });expect(rotatedBack).toMatchObject({ left: 848, width: 44 });- expect(sent().filter(m => m.type === 'mouseButtons').at(-1)).toMatchObject({ rightInset: 0 });- renderGeometry({ ...geometry, barEdge: 'none' });- const noPreferredEdge = Object.assign({}, ...fixture.views['remoteDesktop.backPosition'].style.flat(Infinity).filter(Boolean));+ expect(+ sent()+ .filter((m) => m.type === "mouseButtons")+ .at(-1),+ ).toMatchObject({ rightInset: 0 });+ renderGeometry({ ...geometry, barEdge: "none" });+ const noPreferredEdge = Object.assign(+ {},+ ...fixture.views["remoteDesktop.backPosition"].style+ .flat(Infinity)+ .filter(Boolean),+ );expect(noPreferredEdge).toMatchObject({ left: 842, width: 44 });- const viewerNode = host.querySelector('[data-testid="remoteDesktop.viewer"]');- const starts = requests().filter(r => r.op === 'start').length;- const stops = requests().filter(r => r.op === 'stop').length;- renderGeometry({ ...geometry, regions: [{ kind: 'division', x: 0, y: 300, width: 900, height: 30 }] });- expect(sent().filter(m => m.type === 'mouseButtons').at(-1)).toMatchObject({ fitToInsets: false });- expect(host.querySelector('[data-testid="remoteDesktop.foldTouchpad"]')).toBeNull();+ const viewerNode = host.querySelector(+ '[data-testid="remoteDesktop.viewer"]',+ );+ const starts = requests().filter((r) => r.op === "start").length;+ const stops = requests().filter((r) => r.op === "stop").length;+ renderGeometry({+ ...geometry,+ regions: [{ kind: "division", x: 0, y: 300, width: 900, height: 30 }],+ });+ expect(+ sent()+ .filter((m) => m.type === "mouseButtons")+ .at(-1),+ ).toMatchObject({ fitToInsets: false });+ expect(+ host.querySelector('[data-testid="remoteDesktop.foldTouchpad"]'),+ ).toBeNull();fixture.size = { width: 700, height: 900 };- renderGeometry({ ...geometry, ...fixture.size, barEdge: 'none',- regions: [{ kind: 'division', x: 0, y: 400, width: 700, height: 30 }] });- expect(sent().filter(m => m.type === 'mouseButtons').at(-1)).toMatchObject({- fitToInsets: true, topInset: 0, bottomInset: 500,+ renderGeometry({+ ...geometry,+ ...fixture.size,+ barEdge: "none",+ regions: [{ kind: "division", x: 0, y: 400, width: 700, height: 30 }],+ });+ expect(+ sent()+ .filter((m) => m.type === "mouseButtons")+ .at(-1),+ ).toMatchObject({+ fitToInsets: true,+ topInset: 0,+ bottomInset: 0,+ });+ // Unit: 2026-10-24 retro Easter egg. Existing fold coverage did not switch+ // skins: a lower-rail swipe must restore the original viewport without+ // replacing the viewer or sending pointer input; vertical/cancelled gestures do nothing.+ const swipe = (dx: number, dy = 0, cancel = false) => {+ const rail = fixture.views["remoteDesktop.skinSwipe"];+ act(() =>+ rail.onStartShouldSetResponderCapture({+ nativeEvent: { pageX: 100, pageY: 440 },+ }),+ );+ act(() =>+ rail.onResponderGrant({ nativeEvent: { pageX: 100, pageY: 440 } }),+ );+ act(() =>+ cancel+ ? rail.onResponderTerminate()+ : rail.onResponderRelease({+ nativeEvent: { pageX: 100 + dx, pageY: 440 + dy },+ }),+ );+ };+ expect(+ host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),+ ).not.toBeNull();+ swipe(10, 80);+ swipe(100, 0, true);+ expect(+ host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),+ ).not.toBeNull();+ fixture.post.mockClear();+ const letter = fixture.views["remoteDesktop.retroKey.KeyA"];+ act(() => letter.onPressIn());+ expect(sent()).toContainEqual({+ type: "events",+ events: [{ kind: "key", code: "KeyA", down: true }],});+ const initialFrame = fixture.views["remoteDesktop.media"].style;+ swipe(-100); // Macintosh II → PowerBook: release keys even between retro variants.+ expect(fixture.views["remoteDesktop.media"].style).not.toEqual(+ initialFrame,+ );+ expect(+ host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),+ ).not.toBeNull();+ expect(sent()).toContainEqual({ type: "releaseInput" });+ swipe(-100); // PowerBook → ThinkPad, both retain real input.+ expect(+ host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),+ ).not.toBeNull();+ swipe(-100); // ThinkPad → modern.+ expect(+ host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),+ ).toBeNull();+ expect(sent()).toContainEqual({ type: "releaseInput" });+ act(() => letter.onPressOut());+ expect(+ sent()+ .filter((m) => m.type === "events")+ .at(-1),+ ).toEqual({ type: "events", events: [] });+ expect(sent().some((m) => m.type === "nativeTouchpad")).toBe(false);+ expect(+ sent()+ .filter((m) => m.type === "mouseButtons")+ .at(-1),+ ).toMatchObject({ topInset: 0, bottomInset: 500 });+ swipe(100);+ expect(+ host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),+ ).not.toBeNull();+ swipe(100); // ThinkPad → PowerBook.+ swipe(100); // PowerBook → Macintosh II restores the same viewport.+ expect(fixture.views["remoteDesktop.media"].style).toEqual(initialFrame);+ swipe(100); // Macintosh II → edge.+ expect(fixture.views["remoteDesktop.media"].style).not.toEqual(+ initialFrame,+ );+ swipe(100); // Edge → compact.+ swipe(100); // Compact → classic.+ swipe(100); // Classic wraps to modern.+ expect(+ host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),+ ).toBeNull();+ act(() => fixture.views["remoteDesktop.skinSwitch"].onPress()); // Accessible next wraps to classic.+ expect(+ host.querySelector('[data-testid="remoteDesktop.retroKeys"]'),+ ).not.toBeNull();+ // Return to a heritage palmrest. A drag outside its small visible control+ // must still move the remote pointer, without hitting the keyboard or skin rail.+ for (let index = 0; index < 3; index++) swipe(-100);+ expect(fixture.views["remoteDesktop.palmrest"]).toBeDefined();// Unit: Duo jitter regression. Drive the real folded-pad responder, not a// synthetic viewer command, to ensure the cursor ownership reaches WebView.- const pad = fixture.views['remoteDesktop.foldTouchpad'];+ const pad = fixture.views["remoteDesktop.foldTouchpad"];fixture.post.mockClear();act(() => pad.onResponderGrant({ nativeEvent: { pageX: 50, pageY: 550 } }));act(() => pad.onResponderMove({ nativeEvent: { pageX: 70, pageY: 560 } }));act(() => pad.onResponderRelease());- expect(sent().filter(m => m.type === 'nativeTouchpad')).toEqual([- { type: 'nativeTouchpad', phase: 'start' },- { type: 'nativeTouchpad', dx: 20, dy: 10 },- { type: 'nativeTouchpad', phase: 'end' },+ expect(sent().filter((m) => m.type === "nativeTouchpad")).toEqual([+ { type: "nativeTouchpad", phase: "start" },+ { type: "nativeTouchpad", dx: 20, dy: 10 },+ { type: "nativeTouchpad", phase: "end" },]);act(() => pad.onResponderGrant({ nativeEvent: { pageX: 70, pageY: 560 } }));act(() => pad.onResponderTerminate());- expect(sent().at(-1)).toEqual({ type: 'releaseInput' });- expect(host.querySelector('[data-testid="remoteDesktop.viewer"]')).toBe(viewerNode);+ expect(sent().at(-1)).toEqual({ type: "releaseInput" });+ expect(host.querySelector('[data-testid="remoteDesktop.viewer"]')).toBe(+ viewerNode,+ );fixture.size = { width: 900, height: 700 };renderGeometry(geometry);- expect(sent().filter(m => m.type === 'mouseButtons').at(-1)).toMatchObject({ fitToInsets: false });- expect(host.querySelector('[data-testid="remoteDesktop.viewer"]')).toBe(viewerNode);- expect(requests().filter(r => r.op === 'start')).toHaveLength(starts);- expect(requests().filter(r => r.op === 'stop')).toHaveLength(stops);+ expect(+ sent()+ .filter((m) => m.type === "mouseButtons")+ .at(-1),+ ).toMatchObject({ fitToInsets: false });+ expect(host.querySelector('[data-testid="remoteDesktop.viewer"]')).toBe(+ viewerNode,+ );+ expect(requests().filter((r) => r.op === "start")).toHaveLength(starts);+ expect(requests().filter((r) => r.op === "stop")).toHaveLength(stops);});it("rotation preserves the viewer and control lease", async () => {await connect();@@ -5350,7 +5718,11 @@ describe("remote desktop controls", () => {expect(requests().filter((r) => r.op === "control" && r.enabled),).toHaveLength(2);- expect(sent().filter((m) => m.type === "control").at(-1)).toEqual({+ expect(+ sent()+ .filter((m) => m.type === "control")+ .at(-1),+ ).toEqual({type: "control",enabled: false,});diff --git a/apps/mobile/src/remote-desktop/retroMacArtwork.ts b/apps/mobile/src/remote-desktop/retroMacArtwork.tsnew file mode 100644index 0000000000..037f9bd6d7--- /dev/null+++ b/apps/mobile/src/remote-desktop/retroMacArtwork.ts@@ -0,0 +1,36 @@+/** Static Metro assets: no download, native dependency or generated runtime image. */+export const retroMacArtwork = {+ display: require("../../assets/retro-mac/display.webp"),+ deck: require("../../assets/retro-mac/deck.webp"),+ compact: require("../../assets/retro-mac/display-compact.webp"),+ edge: require("../../assets/retro-mac/display-edge.webp"),+ rail: require("../../assets/retro-mac/deck-rail.webp"),+ keys: require("../../assets/retro-mac/deck-keys.webp"),+ pad: require("../../assets/retro-mac/deck-pad-small.webp"),+ darkKeycap: require("../../assets/retro-mac/keycap-dark.webp"),+ trackpoint: require("../../assets/retro-mac/trackpoint.webp"),+ heritage: {+ macii: {+ display: require("../../assets/retro-mac/macii-display.webp"),+ rail: require("../../assets/retro-mac/macii-rail.webp"),+ keys: require("../../assets/retro-mac/macii-keys.webp"),+ palm: require("../../assets/retro-mac/macii-palm-v2.webp"),+ control: require("../../assets/retro-mac/macii-control.webp"),+ },+ powerbook: {+ display: require("../../assets/retro-mac/powerbook-display.webp"),+ rail: require("../../assets/retro-mac/powerbook-rail.webp"),+ keys: require("../../assets/retro-mac/powerbook-keys.webp"),+ palm: require("../../assets/retro-mac/powerbook-palm-v2.webp"),+ control: require("../../assets/retro-mac/powerbook-control-cutout.webp"),+ },+ thinkpad: {+ display: require("../../assets/retro-mac/thinkpad-display.webp"),+ rail: require("../../assets/retro-mac/thinkpad-rail.webp"),+ keys: require("../../assets/retro-mac/thinkpad-keys.webp"),+ palm: require("../../assets/retro-mac/thinkpad-palm-v2.webp"),+ control: require("../../assets/retro-mac/thinkpad-control.webp"),+ },+ },+ keycap: require("../../assets/retro-mac/keycap.webp"),+};diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.mdindex 6d5e48e712..a2a9d1fba1 100644--- a/docs/design-rules/DESIGN.md+++ b/docs/design-rules/DESIGN.md@@ -729,6 +729,7 @@ The expanded teammate section previews five chats (local teammates, remote teamm- Standalone custom navigation controls use a 44pt visible circle and 44pt hit frame (`navigationChrome.target`), with 20pt artwork (`iconSize.action`) centered inside. Apply the native interactive glass effect after the explicit frame on a borderless SwiftUI Button; do not add `controlSize(large)` or another glass/padding layer. System toolbar items retain native sizing and positioning: never replace them with `Toolbar.View` to enforce this custom-control rule, because that breaks Duo's vertical adaptation.- Prefer the native navigation container for page back/close and toolbar actions. On Duo, let the system adapt navigation to the shared status/toolbar region; only the detail column gets the vertical bar in a split view. Sidebar-local menus stay in the sidebar.- Full-screen custom overlays (remote desktop) keep back and tools on the right in both Duo landscape rotations, centered on one rail below the system status area. Back comes before tools. Respect safe areas and reserved folds; do not mirror the rail from a video orientation event.+- Portrait tabletop remote desktop on iPhone Duo defaults to the Macintosh II-inspired case and functional keyboard (owner request, 2026-10-24). The lower-pane appearance rail accepts left/right swipes and an accessible tap to cycle directionally through classic, slim classic, full-screen retro, Macintosh II, PowerBook 170, ThinkPad 701C and modern (wrapping at either end), retaining the choice for this viewer. Slim and full-screen variants maximize the viewport and use a nearly full-width keyboard and invisible palmrest pointer surface; retain the original classic as a comparison. Switching between any two appearances releases held input. Pointer gestures cover the entire palmrest below the keys, independently of the much smaller visible touchpad, trackball or buttons; never extend this region over the keyboard or appearance rail. Use photorealistic classic Macintosh-inspired hardware artwork: textured ivory plastic, a deep CRT recess, a floppy slot and beveled keycaps (owner refinement, 2026-10-24). Hardware artwork keeps each model’s material in Light/Dark mode, with Light text tokens on ivory keycaps and Dark text tokens on graphite keycaps. Macintosh II and PowerBook retain their rainbow Apple badge; ThinkPad retains its black material and red TrackPoint. These are space-adapted homages, not mechanically exact replicas; surrounding app chrome follows the active theme. Fit the live viewer within the screen opening. Do not substitute flat CSS/vector panels for the physical material. Keep the live viewer and lease mounted across switches. Unfolded/landscape layouts and system keyboard panels retain their ordinary appearance. Implementation: `apps/mobile/src/remote-desktop/FoldDesktopSkin.tsx` and `RemoteDesktopScreen.tsx`.- Floating back/menu controls use the shared `navigationChrome.target` size; grouped actions use the same target breadth, without an extra outer padding ring. Use native Liquid Glass (regular for app navigation; clear over immersive remote desktop imagery), circle for a single icon and capsule for a group; do not tint neutral glass with opaque surface colors. Use semantic foregrounds and the existing non-glass fallback in both themes.- Clear glass over remote imagery follows the navigation theme: dark icons in Light and light icons in Dark. A localized light/dark backing inside the control outline protects contrast, with a matching translucent selected-state fill. Keep the material clear and the desktop outside the controls unchanged. This explicit two-mode palette is Cindy’s design choice; Clear material does not provide automatic foreground adaptation.- The mobile in-app HTML browser's floating controls sit over arbitrary page content. They keep regular glass and add the translucent `navigationChrome.pageTint` theme tint (70%, never opaque). Untinted regular glass adapts to the page behind it. Over a light page in Dark mode it turned light under light icons. The tint keeps the control polarity aligned with the app theme. The user approved this design on 2026-10-11.