Skip to content

Commit 2405387

Browse files
fix(mobile): capture folded and unfolded Duo store screenshots
1 parent f055995 commit 2405387

5 files changed

Lines changed: 113 additions & 56 deletions

File tree

‎.github/workflows/mobile-showcase-screenshots.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ env:
4343

4444
jobs:
4545
ios:
46-
name: iPhone 6.9, iPhone 6.5, and iPad 13
46+
name: iPhone, iPhone Duo, and iPad 13
4747
if: inputs.platform == 'all' || inputs.platform == 'ios'
4848
runs-on: blacksmith-12vcpu-macos-26
4949
# Capturing every palette multiplies the device matrix by six, and only the
@@ -87,6 +87,9 @@ jobs:
8787
brew install cameroncooke/axe/axe
8888
axe --version
8989
90+
- name: Install foldable simulator controls
91+
run: npm install --global [email protected]
92+
9093
- name: Capture iOS showcase
9194
run: pnpm screenshots:mobile --platform ios --appearance "${{ inputs.appearance }}" --theme "${{ inputs.theme }}"
9295

‎apps/mobile/src/features/showcase/ShowcaseCaptureCoordinator.tsx‎

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import { useEffect, useRef, useState, useSyncExternalStore } from "react";
22
import { Keyboard, View } from "react-native";
3-
import {
4-
CommonActions,
5-
type NavigationState,
6-
type PartialState,
7-
StackActions,
8-
useNavigation,
9-
} from "@react-navigation/native";
3+
import { CommonActions, StackActions, useNavigation } from "@react-navigation/native";
104
import { AsyncResult } from "effect/reactivity";
5+
import { requireOptionalNativeModule } from "expo";
116

127
import { useConnectionController } from "../connection/useConnectionController";
138
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
@@ -42,8 +37,6 @@ import { stageShowcaseAgentActivity } from "./stageShowcaseAgentActivity";
4237
const SHOWCASE_ENABLED = process.env.EXPO_PUBLIC_SHOWCASE === "1";
4338
const SHOWCASE_THREAD_ID = "remote-command-center";
4439

45-
type ShowcaseResetRoute = PartialState<NavigationState>["routes"][number];
46-
4740
function sceneFromPathname(pathname: string): ShowcaseScene | null {
4841
const routePath = pathname.split(/[?#]/u, 1)[0] ?? pathname;
4942
if (routePath === "/settings" || routePath.endsWith("/settings/environments")) {
@@ -63,6 +56,18 @@ export function ShowcaseCaptureCoordinator(props: { readonly pathname: string })
6356

6457
function EnabledShowcaseCaptureCoordinator(props: { readonly pathname: string }) {
6558
const navigation = useNavigation();
59+
useEffect(() => {
60+
const menu = requireOptionalNativeModule<{
61+
closeMenu(): void;
62+
setToolsButtonVisible(visible: boolean): void;
63+
}>("ExpoDevMenu");
64+
// The dev menu can open after bundle loading and block orientation requests.
65+
const timer = setInterval(() => {
66+
menu?.closeMenu();
67+
menu?.setToolsButtonVisible(false);
68+
}, 1_000);
69+
return () => clearInterval(timer);
70+
}, []);
6671
const { connectPairingUrl } = useConnectionController();
6772
const {
6873
isReady: appearancePreferencesReady,
@@ -237,40 +242,22 @@ function EnabledShowcaseCaptureCoordinator(props: { readonly pathname: string })
237242
navigation.dispatch(CommonActions.reset({ index: 0, routes: [{ name: "Home" }] }));
238243
return;
239244
}
240-
const routes: ShowcaseResetRoute[] = [{ name: "Home" }];
241245
if (requestedScene === "environments") {
242-
routes.push({
243-
name: "SettingsSheet",
244-
state: {
245-
index: 0,
246-
routes: [
247-
{
248-
name: "SettingsContent",
249-
state: {
250-
index: 1,
251-
routes: [{ name: "Settings" }, { name: "SettingsEnvironments" }],
252-
},
253-
},
254-
],
255-
},
256-
});
246+
navigation.dispatch(
247+
CommonActions.navigate("SettingsSheet", {
248+
screen: "SettingsContent",
249+
params: { screen: "SettingsEnvironments" },
250+
}),
251+
);
252+
} else if (requestedScene === "terminal") {
253+
navigation.dispatch(
254+
CommonActions.navigate("ThreadTerminal", { ...params, terminalId: "term-1" }),
255+
);
256+
} else if (requestedScene === "review") {
257+
navigation.dispatch(CommonActions.navigate("ThreadReview", params));
257258
} else {
258-
routes.push({ name: "Thread", params });
259-
if (requestedScene === "terminal") {
260-
routes.push({
261-
name: "ThreadTerminal",
262-
params: { ...params, terminalId: "term-1" },
263-
});
264-
} else if (requestedScene === "review") {
265-
routes.push({ name: "ThreadReview", params });
266-
}
259+
navigation.dispatch(CommonActions.navigate("Thread", params));
267260
}
268-
navigation.dispatch(
269-
CommonActions.reset({
270-
index: routes.length - 1,
271-
routes,
272-
}),
273-
);
274261
}, [hasFixture, navigation, requestedScene, scene, showcaseThread]);
275262

276263
useEffect(() => {

‎docs/operations/mobile-app-store-screenshots.md‎

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ verify process ownership. Concurrent screenshot harnesses in different worktrees
5252
collide or attach to the wrong Metro process.
5353

5454
Every configured device defaults to dark appearance and the `t3-code` palette, so plain
55-
`pnpm screenshots:mobile` produces 35 dark PNGs. Pass `--appearance light`, `--appearance dark`, or
56-
`--appearance both` to override the configured appearance; `both` produces 70 PNGs.
55+
`pnpm screenshots:mobile` produces 45 dark PNGs. Pass `--appearance light`, `--appearance dark`, or
56+
`--appearance both` to override the configured appearance; `both` produces 90 PNGs.
5757

5858
Pass `--theme <id>` (repeatable) or `--theme all` to capture the app's other palettes: `t3-code`,
5959
`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.
6363

6464
The default matrix is:
6565

66-
| Output folder | Capture target | Upload dimensions | Store slot |
67-
| ------------------------------------- | ---------------------------- | ----------------- | ----------------------------------------- |
68-
| `apple/iphone-6.9/dark/t3-code/` | disposable iPhone 17 Pro Max | 1320×2868 | App Store Connect iPhone 6.9-inch |
69-
| `apple/iphone-6.5/dark/t3-code/` | disposable iPhone 14 Plus | 1284×2778 | App Store Connect iPhone 6.5-inch |
70-
| `apple/ipad-13/dark/t3-code/` | iPad Pro 13-inch (M5) | 2752×2064 | App Store Connect iPad 13-inch, landscape |
71-
| `google-play/phone/dark/t3-code/` | Pixel AVD at 420 dpi | 1080×1920 | Google Play phone, portrait 9:16 |
72-
| `google-play/tablet-7/dark/t3-code/` | Pixel AVD at 600dp width | 1080×1920 | Google Play 7-inch tablet, portrait 9:16 |
73-
| `google-play/tablet-10/dark/t3-code/` | Pixel AVD at 800dp width | 1440×2560 | Google Play 10-inch tablet, portrait 9:16 |
74-
75-
Each target captures thread, terminal, review, thread list, and environments, and every target but
76-
the iPad also captures agent activity. Each palette folder's five or six screenshots satisfy the configured Apple limit of 1–10, Google
66+
| Output folder | Capture target | Upload dimensions | Store slot |
67+
| --------------------------------------- | ------------------------------ | ----------------- | ----------------------------------------- |
68+
| `apple/iphone-6.9/dark/t3-code/` | disposable iPhone 17 Pro Max | 1320×2868 | App Store Connect iPhone 6.9-inch |
69+
| `apple/iphone-6.5/dark/t3-code/` | disposable iPhone 14 Plus | 1284×2778 | App Store Connect iPhone 6.5-inch |
70+
| `apple/iphone-duo-closed/dark/t3-code/` | iPhone Duo, folded portrait | 1398×2034 | App Store Connect iPhone Duo |
71+
| `apple/iphone-duo-open/dark/t3-code/` | iPhone Duo, unfolded landscape | 2853×2007 | App Store Connect iPhone Duo |
72+
| `apple/ipad-13/dark/t3-code/` | iPad Pro 13-inch (M5) | 2752×2064 | App Store Connect iPad 13-inch, landscape |
73+
| `google-play/phone/dark/t3-code/` | Pixel AVD at 420 dpi | 1080×1920 | Google Play phone, portrait 9:16 |
74+
| `google-play/tablet-7/dark/t3-code/` | Pixel AVD at 600dp width | 1080×1920 | Google Play 7-inch tablet, portrait 9:16 |
75+
| `google-play/tablet-10/dark/t3-code/` | Pixel AVD at 800dp width | 1440×2560 | Google Play 10-inch tablet, portrait 9:16 |
76+
77+
Each target captures thread, terminal, review, thread list, and environments, and every target except
78+
the iPad and Duo also captures agent activity. Each palette folder's five or six screenshots satisfy the configured Apple limit of 1–10, Google
7779
phone requirement of 2–8, and Google tablet recommendation/slot minimum of 4 with a maximum of 8.
80+
The two Duo folders each contain five scenes and upload to the same iPhone Duo slot (ten images
81+
total). They omit agent activity to stay within that shared limit. Duo capture requires
82+
an installed iOS runtime that supports iPhone Duo and `agent-device` on PATH, or
83+
`AGENT_DEVICE_PATH` pointing to its executable; it sets and verifies the
84+
simulator fold pose before launching the app.
85+
7886
Every palette gets its own leaf folder so one upload slot never mixes themes and each folder keeps a
7987
store-legal screenshot count.
8088

@@ -93,6 +101,8 @@ The generated tree is deliberately aligned with the store upload fields:
93101
├── apple/
94102
│ ├── iphone-6.9/dark/t3-code/{thread,terminal,review,threads,environments,agent-activity}.png
95103
│ ├── iphone-6.5/dark/t3-code/{thread,terminal,review,threads,environments,agent-activity}.png
104+
│ ├── iphone-duo-closed/dark/t3-code/{thread,terminal,review,threads,environments}.png
105+
│ ├── iphone-duo-open/dark/t3-code/{thread,terminal,review,threads,environments}.png
96106
│ └── ipad-13/dark/t3-code/{thread,terminal,review,threads,environments}.png
97107
└── google-play/
98108
├── phone/dark/t3-code/{thread,terminal,review,threads,environments,agent-activity}.png
@@ -131,6 +141,7 @@ debug APK matches its accelerated emulator.
131141

132142
Capture one scene or device:
133143

144+
pnpm screenshots:mobile --device iphone-duo-closed --device iphone-duo-open
134145
pnpm screenshots:mobile --device iphone-6.9 --scene thread
135146
pnpm screenshots:mobile --platform android --scene review
136147

‎scripts/mobile-showcase.config.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export interface ShowcaseIosDevice {
3333
readonly appearance: ShowcaseAppearance;
3434
readonly theme: ShowcaseTheme;
3535
readonly orientation?: "portrait" | "landscape";
36+
readonly fold?: "closed" | "open";
3637
readonly scenes: ReadonlyArray<ShowcaseScene>;
3738
readonly storeAsset: ShowcaseStoreAssetSpec;
3839
}
@@ -117,6 +118,26 @@ const config: ShowcaseConfig = {
117118
maximumUploadCount: 10,
118119
},
119120
},
121+
...(["closed", "open"] as const).map((fold): ShowcaseIosDevice => ({
122+
id: `iphone-duo-${fold}`,
123+
platform: "ios",
124+
simulator: `T3 Showcase iPhone Duo ${fold}`,
125+
simulatorDeviceType: "com.apple.CoreSimulator.SimDeviceType.iPhone-Duo",
126+
appearance: "dark",
127+
theme: DEFAULT_SHOWCASE_THEME,
128+
orientation: fold === "closed" ? "portrait" : "landscape",
129+
fold,
130+
// Both poses share one ten-image App Store slot.
131+
scenes: ["thread", "terminal", "review", "threads", "environments"],
132+
storeAsset: {
133+
store: "apple",
134+
directory: `apple/iphone-duo-${fold}`,
135+
width: fold === "closed" ? 1398 : 2853,
136+
height: fold === "closed" ? 2034 : 2007,
137+
minimumUploadCount: 1,
138+
maximumUploadCount: 5,
139+
},
140+
})),
120141
{
121142
id: "ipad-13",
122143
platform: "ios",

‎scripts/mobile-showcase.ts‎

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,23 @@ async function captureIos(
10891089
if (capture.device.orientation === "landscape") {
10901090
await ensureIosFullScreenAppsMode(simulator.udid);
10911091
}
1092+
if (capture.device.fold) {
1093+
const command = NodeProcess.env.AGENT_DEVICE_PATH ?? "agent-device";
1094+
const target = [
1095+
"--platform",
1096+
"ios",
1097+
"--udid",
1098+
simulator.udid,
1099+
"--session",
1100+
`showcase-${simulator.udid}`,
1101+
];
1102+
await runCommand(command, ["open", ...target]);
1103+
try {
1104+
await runCommand(command, ["fold", capture.device.fold, ...target]);
1105+
} finally {
1106+
await runCommand(command, ["close", ...target]);
1107+
}
1108+
}
10921109
await normalizeIosSimulator(capture.appearance, simulator.udid);
10931110
if (appPath) {
10941111
await runCommand("xcrun", ["simctl", "uninstall", simulator.udid, ANDROID_PACKAGE]).catch(
@@ -1164,14 +1181,21 @@ async function captureIos(
11641181
showcaseCaptureDirectory(outputDirectory, capture),
11651182
`${scene}.png`,
11661183
);
1167-
await runCommand("xcrun", ["simctl", "io", simulator.udid, "screenshot", destination]);
1184+
await runCommand("xcrun", [
1185+
"simctl",
1186+
"io",
1187+
simulator.udid,
1188+
"screenshot",
1189+
...(capture.device.fold ? ["--display", capture.device.fold === "closed" ? "1" : "3"] : []),
1190+
destination,
1191+
]);
11681192
if (capture.device.orientation === "landscape") {
11691193
// A headless simulator keeps its display portrait while the rotated app
11701194
// renders sideways inside it; with Simulator.app attached the display
11711195
// itself rotates. Only post-rotate the former.
11721196
const { width, height } = readPngDimensions(await NodeFSP.readFile(destination));
11731197
if (height > width) {
1174-
await runCommand("sips", ["--rotate", "270", destination]);
1198+
await runCommand("sips", ["--rotate", capture.device.fold ? "90" : "270", destination]);
11751199
}
11761200
}
11771201
if (scene === "agent-activity") await unlockIosSimulator(simulator.udid);
@@ -1533,6 +1557,17 @@ async function main(): Promise<void> {
15331557
showcaseServers.push(server);
15341558
await waitForPort(port, `${environment.label} server`);
15351559
await seedShowcaseEnvironment({ baseDir, projectIds: environment.projectIds });
1560+
// Legacy fixture threads are imported into V2 during server startup.
1561+
await stopProcess(server);
1562+
const seededServer = startShowcaseServer(
1563+
baseDir,
1564+
workspaceRoot,
1565+
port,
1566+
shellPath,
1567+
labelProbeDirectory,
1568+
);
1569+
showcaseServers.push(seededServer);
1570+
await waitForPort(port, `${environment.label} seeded server`);
15361571
// The server begins listening before the ServerEnvironment layer
15371572
// persists the environment id, so poll rather than read once.
15381573
const environmentId = await waitForFileContent(

0 commit comments

Comments
 (0)