feat(demo): DEMO_MODE — boot straight to an unlocked wallet for capture

Adds a debug-only capture mode so screenshots/video never depend on the
onboarding/PIN flow, whose synthetic taps are unreliable under the headless
emulator (both flutter_test and adb input drop taps on the PIN confirm screen).

lib/entities/demo_mode.dart: on launch, when kDebugMode AND
--dart-define=DEMO_MODE=true, create a fresh throwaway Wownero wallet through
the real WalletNewVM.create() (so walletInfo/derivation/paths/persistence and
changeCurrentWallet all happen exactly as in the UI), then set the PIN and
allow auth — landing on the dashboard. Reuses the wallet on later launches.
Both halves are compile-time const/kDebugMode, so this is tree-shaken out of
release: DEMO_MODE cannot be enabled in a store binary.

lib/main.dart: call maybeSetupDemoWallet() during bootstrap and force the
initial route to the dashboard in demo mode.

tools/demo/{build-apk,capture}.sh: DEMO=1 bakes the define into a local build;
flutter drive passes it so scenarios start at the dashboard.

Verified end to end: demo build boots to a live Wownero wallet and captured a
clean 1080x1920 store set (dashboard/receive/send/swap/settings) with no PIN.
This also implements the SCREENSHOT_MODE the iOS UITest scaffold already
references (store/SCREENSHOTS.md Path B).

Note: the API-35 emulator needs -gpu host (real GPU) for deep-page rendering;
-gpu software hard-crashes qemu on the Receive page. Stills use screencap
(screenrecord's encoder is unrelated).
This commit is contained in:
jwinterm
2026-08-03 08:33:22 -04:00
parent 731adb84f1
commit 4be2424486
4 changed files with 107 additions and 6 deletions
+11 -1
View File
@@ -45,6 +45,8 @@ docker run --rm \
-e SKIP_DEPS="$SKIP_DEPS" \
-e BUILD_MODE="$BUILD_MODE" \
-e TARGET_PLATFORM="$TARGET_PLATFORM" \
-e DEMO="${DEMO:-0}" \
-e DEMO_PIN="${DEMO_PIN:-0801}" \
-e HOST_UID="$HOST_UID" \
-e HOST_GID="$HOST_GID" \
"$IMAGE" bash -c '
@@ -214,7 +216,15 @@ step "compile svg assets"
step "build apk ($BUILD_MODE / ${TARGET_PLATFORM:-universal})"
EXTRA=""
[[ -n "$TARGET_PLATFORM" ]] && EXTRA="--target-platform=$TARGET_PLATFORM"
flutter build apk --dart-define-from-file=env.json --$BUILD_MODE $EXTRA
# DEMO=1 bakes in DEMO_MODE so the app boots straight to an unlocked demo
# wallet (kDebugMode-gated, impossible in release). Lets capture skip the
# onboarding/PIN flow entirely.
DEMO_DEFINES=""
if [[ "${DEMO:-0}" == "1" ]]; then
DEMO_DEFINES="--dart-define=DEMO_MODE=true --dart-define=DEMO_PIN=${DEMO_PIN:-0801}"
echo "DEMO_MODE baked in"
fi
flutter build apk --dart-define-from-file=env.json --$BUILD_MODE $EXTRA $DEMO_DEFINES
echo
echo "==> artifacts:"
+2
View File
@@ -272,6 +272,8 @@ cmd_record() {
--target=integration_test/demo/scenarios/'"$scenario"'.dart \
-d "$SERIAL" \
--dart-define-from-file=env.json \
--dart-define=DEMO_MODE=true \
--dart-define=DEMO_PIN='"${DEMO_PIN:-0801}"' \
--dart-define=DEMO_WALLET_SEED="$DEMO_SEED" \
--dart-define=DEMO_SEND_ADDRESS="$DEMO_SEND_ADDR"
' 2>&1 | tee "$RAW_DIR/$scenario.drive.log"