TypeScript
fix(mobile): capture folded and unfolded Duo store screenshots (#23849)
Julius Marmingeff31a2a62b6b
diff --git a/.github/workflows/mobile-showcase-screenshots.yml b/.github/workflows/mobile-showcase-screenshots.ymlindex fc75c447c6d..c02be425c1a 100644--- a/.github/workflows/mobile-showcase-screenshots.yml+++ b/.github/workflows/mobile-showcase-screenshots.yml@@ -43,7 +43,7 @@ env:jobs:ios:- name: iPhone 6.9, iPhone 6.5, and iPad 13+ name: iPhone, iPhone Duo, and iPad 13if: inputs.platform == 'all' || inputs.platform == 'ios'runs-on: blacksmith-12vcpu-macos-26# Capturing every palette multiplies the device matrix by six, and only the@@ -87,6 +87,9 @@ jobs:brew install cameroncooke/axe/axeaxe --version+ - name: Install foldable simulator controls+ run: npm install --global [email protected]+- name: Capture iOS showcaserun: pnpm screenshots:mobile --platform ios --appearance "${{ inputs.appearance }}" --theme "${{ inputs.theme }}"diff --git a/apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx b/apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsxindex 8627ffa7e02..6e5d42c47d9 100644--- a/apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx+++ b/apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx@@ -1,13 +1,8 @@import { useEffect, useRef, useState, useSyncExternalStore } from "react";import { Keyboard, View } from "react-native";-import {- CommonActions,- type NavigationState,- type PartialState,- StackActions,- useNavigation,-} from "@react-navigation/native";+import { CommonActions, StackActions, useNavigation } from "@react-navigation/native";import { AsyncResult } from "effect/reactivity";+import { requireOptionalNativeModule } from "expo";import { useConnectionController } from "../connection/useConnectionController";import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";@@ -42,8 +37,6 @@ import { stageShowcaseAgentActivity } from "./stageShowcaseAgentActivity";const SHOWCASE_ENABLED = process.env.EXPO_PUBLIC_SHOWCASE === "1";const SHOWCASE_THREAD_ID = "remote-command-center";-type ShowcaseResetRoute = PartialState<NavigationState>["routes"][number];-function sceneFromPathname(pathname: string): ShowcaseScene | null {const routePath = pathname.split(/[?#]/u, 1)[0] ?? pathname;if (routePath === "/settings" || routePath.endsWith("/settings/environments")) {@@ -63,6 +56,18 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })function EnabledShowcaseCaptureCoordinator(props: { readonly pathname: string }) {const navigation = useNavigation();+ useEffect(() => {+ const menu = requireOptionalNativeModule<{+ closeMenu(): void;+ setToolsButtonVisible(visible: boolean): void;+ }>("ExpoDevMenu");+ // The dev menu can open after bundle loading and block orientation requests.+ const timer = setInterval(() => {+ menu?.closeMenu();+ menu?.setToolsButtonVisible(false);+ }, 1_000);+ return () => clearInterval(timer);+ }, []);const { connectPairingUrl } = useConnectionController();const {isReady: appearancePreferencesReady,@@ -237,40 +242,22 @@ function EnabledShowcaseCaptureCoordinator(props: { readonly pathname: string })navigation.dispatch(CommonActions.reset({ index: 0, routes: [{ name: "Home" }] }));return;}- const routes: ShowcaseResetRoute[] = [{ name: "Home" }];if (requestedScene === "environments") {- routes.push({- name: "SettingsSheet",- state: {- index: 0,- routes: [- {- name: "SettingsContent",- state: {- index: 1,- routes: [{ name: "Settings" }, { name: "SettingsEnvironments" }],- },- },- ],- },- });+ navigation.dispatch(+ CommonActions.navigate("SettingsSheet", {+ screen: "SettingsContent",+ params: { screen: "SettingsEnvironments" },+ }),+ );+ } else if (requestedScene === "terminal") {+ navigation.dispatch(+ CommonActions.navigate("ThreadTerminal", { ...params, terminalId: "term-1" }),+ );+ } else if (requestedScene === "review") {+ navigation.dispatch(CommonActions.navigate("ThreadReview", params));} else {- routes.push({ name: "Thread", params });- if (requestedScene === "terminal") {- routes.push({- name: "ThreadTerminal",- params: { ...params, terminalId: "term-1" },- });- } else if (requestedScene === "review") {- routes.push({ name: "ThreadReview", params });- }+ navigation.dispatch(CommonActions.navigate("Thread", params));}- navigation.dispatch(- CommonActions.reset({- index: routes.length - 1,- routes,- }),- );}, [hasFixture, navigation, requestedScene, scene, showcaseThread]);useEffect(() => {diff --git a/docs/operations/mobile-app-store-screenshots.md b/docs/operations/mobile-app-store-screenshots.mdindex 0078754ad9c..d063d80e90f 100644--- a/docs/operations/mobile-app-store-screenshots.md+++ b/docs/operations/mobile-app-store-screenshots.md@@ -52,8 +52,8 @@ verify process ownership. Concurrent screenshot harnesses in different worktreescollide or attach to the wrong Metro process.Every configured device defaults to dark appearance and the `t3-code` palette, so plain-`pnpm screenshots:mobile` produces 35 dark PNGs. Pass `--appearance light`, `--appearance dark`, or-`--appearance both` to override the configured appearance; `both` produces 70 PNGs.+`pnpm screenshots:mobile` produces 45 dark PNGs. Pass `--appearance light`, `--appearance dark`, or+`--appearance both` to override the configured appearance; `both` produces 90 PNGs.Pass `--theme <id>` (repeatable) or `--theme all` to capture the app's other palettes: `t3-code`,`t3-chat`, `grove`, `ocean`, `ember`, and `iris`. The runner hands the palette to the app as a launch@@ -63,18 +63,26 @@ multiplies the run by six; only the native build is shared.The default matrix is:-| Output folder | Capture target | Upload dimensions | Store slot |-| ------------------------------------- | ---------------------------- | ----------------- | ----------------------------------------- |-| `apple/iphone-6.9/dark/t3-code/` | disposable iPhone 17 Pro Max | 1320×2868 | App Store Connect iPhone 6.9-inch |-| `apple/iphone-6.5/dark/t3-code/` | disposable iPhone 14 Plus | 1284×2778 | App Store Connect iPhone 6.5-inch |-| `apple/ipad-13/dark/t3-code/` | iPad Pro 13-inch (M5) | 2752×2064 | App Store Connect iPad 13-inch, landscape |-| `google-play/phone/dark/t3-code/` | Pixel AVD at 420 dpi | 1080×1920 | Google Play phone, portrait 9:16 |-| `google-play/tablet-7/dark/t3-code/` | Pixel AVD at 600dp width | 1080×1920 | Google Play 7-inch tablet, portrait 9:16 |-| `google-play/tablet-10/dark/t3-code/` | Pixel AVD at 800dp width | 1440×2560 | Google Play 10-inch tablet, portrait 9:16 |--Each target captures thread, terminal, review, thread list, and environments, and every target but-the iPad also captures agent activity. Each palette folder's five or six screenshots satisfy the configured Apple limit of 1–10, Google+| Output folder | Capture target | Upload dimensions | Store slot |+| --------------------------------------- | ------------------------------ | ----------------- | ----------------------------------------- |+| `apple/iphone-6.9/dark/t3-code/` | disposable iPhone 17 Pro Max | 1320×2868 | App Store Connect iPhone 6.9-inch |+| `apple/iphone-6.5/dark/t3-code/` | disposable iPhone 14 Plus | 1284×2778 | App Store Connect iPhone 6.5-inch |+| `apple/iphone-duo-closed/dark/t3-code/` | iPhone Duo, folded portrait | 1398×2034 | App Store Connect iPhone Duo |+| `apple/iphone-duo-open/dark/t3-code/` | iPhone Duo, unfolded landscape | 2853×2007 | App Store Connect iPhone Duo |+| `apple/ipad-13/dark/t3-code/` | iPad Pro 13-inch (M5) | 2752×2064 | App Store Connect iPad 13-inch, landscape |+| `google-play/phone/dark/t3-code/` | Pixel AVD at 420 dpi | 1080×1920 | Google Play phone, portrait 9:16 |+| `google-play/tablet-7/dark/t3-code/` | Pixel AVD at 600dp width | 1080×1920 | Google Play 7-inch tablet, portrait 9:16 |+| `google-play/tablet-10/dark/t3-code/` | Pixel AVD at 800dp width | 1440×2560 | Google Play 10-inch tablet, portrait 9:16 |++Each target captures thread, terminal, review, thread list, and environments, and every target except+the iPad and Duo also captures agent activity. Each palette folder's five or six screenshots satisfy the configured Apple limit of 1–10, Googlephone requirement of 2–8, and Google tablet recommendation/slot minimum of 4 with a maximum of 8.+The two Duo folders each contain five scenes and upload to the same iPhone Duo slot (ten images+total). They omit agent activity to stay within that shared limit. Duo capture requires+an installed iOS runtime that supports iPhone Duo and `agent-device` on PATH, or+`AGENT_DEVICE_PATH` pointing to its executable; it sets and verifies the+simulator fold pose before launching the app.+Every palette gets its own leaf folder so one upload slot never mixes themes and each folder keeps astore-legal screenshot count.@@ -93,6 +101,8 @@ The generated tree is deliberately aligned with the store upload fields:├── apple/│ ├── iphone-6.9/dark/t3-code/{thread,terminal,review,threads,environments,agent-activity}.png│ ├── iphone-6.5/dark/t3-code/{thread,terminal,review,threads,environments,agent-activity}.png+ │ ├── iphone-duo-closed/dark/t3-code/{thread,terminal,review,threads,environments}.png+ │ ├── iphone-duo-open/dark/t3-code/{thread,terminal,review,threads,environments}.png│ └── ipad-13/dark/t3-code/{thread,terminal,review,threads,environments}.png└── google-play/├── phone/dark/t3-code/{thread,terminal,review,threads,environments,agent-activity}.png@@ -131,6 +141,7 @@ debug APK matches its accelerated emulator.Capture one scene or device:+ pnpm screenshots:mobile --device iphone-duo-closed --device iphone-duo-openpnpm screenshots:mobile --device iphone-6.9 --scene threadpnpm screenshots:mobile --platform android --scene reviewdiff --git a/scripts/mobile-showcase.config.ts b/scripts/mobile-showcase.config.tsindex 1d737b9fa4f..e8ec384924a 100644--- a/scripts/mobile-showcase.config.ts+++ b/scripts/mobile-showcase.config.ts@@ -33,6 +33,7 @@ export interface ShowcaseIosDevice {readonly appearance: ShowcaseAppearance;readonly theme: ShowcaseTheme;readonly orientation?: "portrait" | "landscape";+ readonly fold?: "closed" | "open";readonly scenes: ReadonlyArray<ShowcaseScene>;readonly storeAsset: ShowcaseStoreAssetSpec;}@@ -117,6 +118,26 @@ const config: ShowcaseConfig = {maximumUploadCount: 10,},},+ ...(["closed", "open"] as const).map((fold): ShowcaseIosDevice => ({+ id: `iphone-duo-${fold}`,+ platform: "ios",+ simulator: `T3 Showcase iPhone Duo ${fold}`,+ simulatorDeviceType: "com.apple.CoreSimulator.SimDeviceType.iPhone-Duo",+ appearance: "dark",+ theme: DEFAULT_SHOWCASE_THEME,+ orientation: fold === "closed" ? "portrait" : "landscape",+ fold,+ // Both poses share one ten-image App Store slot.+ scenes: ["thread", "terminal", "review", "threads", "environments"],+ storeAsset: {+ store: "apple",+ directory: `apple/iphone-duo-${fold}`,+ width: fold === "closed" ? 1398 : 2853,+ height: fold === "closed" ? 2034 : 2007,+ minimumUploadCount: 1,+ maximumUploadCount: 5,+ },+ })),{id: "ipad-13",platform: "ios",diff --git a/scripts/mobile-showcase.ts b/scripts/mobile-showcase.tsindex 8379604ba51..1182caac1cf 100644--- a/scripts/mobile-showcase.ts+++ b/scripts/mobile-showcase.ts@@ -1089,6 +1089,23 @@ async function captureIos(if (capture.device.orientation === "landscape") {await ensureIosFullScreenAppsMode(simulator.udid);}+ if (capture.device.fold) {+ const command = NodeProcess.env.AGENT_DEVICE_PATH ?? "agent-device";+ const target = [+ "--platform",+ "ios",+ "--udid",+ simulator.udid,+ "--session",+ `showcase-${simulator.udid}`,+ ];+ await runCommand(command, ["open", ...target]);+ try {+ await runCommand(command, ["fold", capture.device.fold, ...target]);+ } finally {+ await runCommand(command, ["close", ...target]);+ }+ }await normalizeIosSimulator(capture.appearance, simulator.udid);if (appPath) {await runCommand("xcrun", ["simctl", "uninstall", simulator.udid, ANDROID_PACKAGE]).catch(@@ -1164,14 +1181,21 @@ async function captureIos(showcaseCaptureDirectory(outputDirectory, capture),`${scene}.png`,);- await runCommand("xcrun", ["simctl", "io", simulator.udid, "screenshot", destination]);+ await runCommand("xcrun", [+ "simctl",+ "io",+ simulator.udid,+ "screenshot",+ ...(capture.device.fold ? ["--display", capture.device.fold === "closed" ? "1" : "3"] : []),+ destination,+ ]);if (capture.device.orientation === "landscape") {// A headless simulator keeps its display portrait while the rotated app// renders sideways inside it; with Simulator.app attached the display// itself rotates. Only post-rotate the former.const { width, height } = readPngDimensions(await NodeFSP.readFile(destination));if (height > width) {- await runCommand("sips", ["--rotate", "270", destination]);+ await runCommand("sips", ["--rotate", capture.device.fold ? "90" : "270", destination]);}}if (scene === "agent-activity") await unlockIosSimulator(simulator.udid);@@ -1533,6 +1557,17 @@ async function main(): Promise<void> {showcaseServers.push(server);await waitForPort(port, `${environment.label} server`);await seedShowcaseEnvironment({ baseDir, projectIds: environment.projectIds });+ // Legacy fixture threads are imported into V2 during server startup.+ await stopProcess(server);+ const seededServer = startShowcaseServer(+ baseDir,+ workspaceRoot,+ port,+ shellPath,+ labelProbeDirectory,+ );+ showcaseServers.push(seededServer);+ await waitForPort(port, `${environment.label} seeded server`);// The server begins listening before the ServerEnvironment layer// persists the environment id, so poll rather than read once.const environmentId = await waitForFileContent(