@simon-says-build/demo-player
v0.16.8
Published
SimonSays mobile demo player: walks a preview's viewer through a job's change, inside the app. Renders nothing unless the bundle carries a demo.
Readme
@simon-says-build/demo-player
The mobile half of SimonSays demos (docs/MOBILE-DEMO.md): a job's preview, opened in the app's dev client, walks the viewer through the change.
import { router } from "expo-router";
import { DemoHost } from "@simon-says-build/demo-player";
<DemoHost
router={router}
demo={{
id: process.env.EXPO_PUBLIC_SSB_DEMO_ID,
token: process.env.EXPO_PUBLIC_SSB_DEMO_TOKEN,
api: process.env.EXPO_PUBLIC_SSB_API,
}}
>
{/* the app */}
</DemoHost>Pass the process.env.EXPO_PUBLIC_* reads in the app's own code. Expo inlines them where the app references them, so the values only exist in a bundle a demo preview served.
Without all three it renders its children and nothing else. Elements are found by testID, then accessibilityLabel, then visible text, by walking React's tree. No component needs wrapping.
0.16.8: every goto arrives as a link, not only one between two of the same screen: the router opened /demo/nearby-check-in-lab inside the walk's stack with no header, 25 points off where it was recorded.
0.16.7: a goto to another one of the same screen arrives as a link, the way SSB's recorder moves (linkIn); the router is asked only if the app did not follow. navigate, replace and push each left the first walk on screen going from /walk/a to /walk/b. The step after any goto looks 25 s for its element, not 8, before asking where it went.
0.16.6: the overlay is accessibility-modal whenever there is a review to play (card or pill), and not when there is none. 0.16.5 left the tucked pill unreadable over the app's own sheet.
0.16.5: the overlay is accessibility-modal only while a card is up. Never modal (0.16.4) left the card unreadable whenever the app presented its own sheet; tucked to its pill, the overlay still leaves the app readable.
0.16.4: the app stays reachable under the overlay. On iOS the overlay draws in react-native-screens' FullWindowOverlay, whose container is accessibilityViewIsModal unless told otherwise: with the player mounted, VoiceOver and SSB's simulator saw the player and nothing of the app. It now passes unstable_accessibilityContainerViewIsModal={false}; the chapter card stays modal by its own prop.
0.8.0: a planned review's events (event steps, docs/PLANNED-REVIEW.md). The player asks SSB to run a helper on the review's private copy ("and now a walker arrives"), waits until it's done, and fills {name} in that person's later steps from its outputs. A person with a planned state has it set up (@state) before they're signed in, so their world is current every time the review opens. A failed setup stays on its card with the reason and a Next button.
0.7.0: the sign-in link opens through the app's router (openInApp), not Linking.openURL. The link names app.json's scheme, and a review plays in the dev build, whose scheme can differ (Walk2Gether's is walk2gether-dev), so the OS opened the production app or nothing. Without a router, the OS opens it as before.
0.6.0: SSB signs the viewer in on a phone's private, seeded copy (docs/MOBILE-DEMO.md "Sign-in (stage 2: SSB signs in)"). Before each person's part the player asks the demo API for their sign-in link (POST /api/demo/:id/signin), opens it with Linking.openURL, waits for the app to settle, and starts on the screen the link opened. The walk's own sign-in steps are skipped. The app must handle <scheme>://auth?token=<custom token>&next=<path>: sign in with the custom token, then route to next. Where there is no link (the app's real backend, no URL scheme, the copy not up), the card says who to sign in as, as before.
npm test runs the pure half.
