@simon-says-build/demo-player 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/DemoHost.js +13 -5
- package/src/build-gate.js +10 -0
- package/src/core.js +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simon-says-build/demo-player",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "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.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
package/src/DemoHost.js
CHANGED
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
//
|
|
14
14
|
// No JSX, so it needs nothing from the app's Babel setup beyond React Native's.
|
|
15
15
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
-
import { Linking, NativeModules, Pressable, ScrollView, StyleSheet, Text, TextInput, View, useWindowDimensions } from 'react-native';
|
|
16
|
+
import { Linking, NativeModules, Platform, Settings, Pressable, ScrollView, StyleSheet, Text, TextInput, View, useWindowDimensions } from 'react-native';
|
|
17
17
|
import { pageName } from './page-name.js';
|
|
18
|
-
import { OVERLAY_ID, cardBox, pinnedBox, setTuckedDemo, overlayAnnounced, currentDemo, demoConfig, findTarget, handlerFor, introBody, introOf, onDemo, phoneSteps, playDemo, releaseOf, reviewChangesOf, scalePoint, rescueNote, screenCandidates, stepTitle, targetOfKey } from './core.js';
|
|
18
|
+
import { OVERLAY_ID, cardBox, pinnedBox, setTuckedDemo, overlayAnnounced, tapInside, currentDemo, demoConfig, findTarget, handlerFor, introBody, introOf, onDemo, phoneSteps, playDemo, releaseOf, reviewChangesOf, scalePoint, rescueNote, screenCandidates, stepTitle, targetOfKey } from './core.js';
|
|
19
19
|
import { demoApi, tourOf } from './api.js';
|
|
20
20
|
import { signInFirst, openInApp } from './signin.js';
|
|
21
21
|
import { runEvent, fillStep } from './events.js';
|
|
22
|
-
import { nativeRuntime, buildGap, needLinks, openNeed, staleBody } from './build-gate.js';
|
|
22
|
+
import { nativeRuntime, buildGap, needLinks, openNeed, staleBody, skipBuildGate } from './build-gate.js';
|
|
23
23
|
|
|
24
24
|
const h = React.createElement;
|
|
25
25
|
const FIND_FOR_MS = 8000; // a step's element may appear after a navigation settles
|
|
@@ -94,7 +94,8 @@ function Player({ config, router, insets, onClose, children }) {
|
|
|
94
94
|
// THE BUILD FIRST (0.12.0): a review made for another native build of
|
|
95
95
|
// this dev app never starts here — the person is sent to install the
|
|
96
96
|
// right one (build-gate.js). Nothing else runs: no sign-in, no steps.
|
|
97
|
-
const
|
|
97
|
+
const skip = config.here || (Platform.OS === 'ios' && skipBuildGate(Settings));
|
|
98
|
+
const gap = skip ? null : buildGap(d, nativeRuntime(globalThis.expo?.modules, NativeModules));
|
|
98
99
|
if (gap) {
|
|
99
100
|
const links = needLinks({ demo: d, gap, demoId: config.id, token: config.token });
|
|
100
101
|
setStale({ gap, links, appName: d.projectName || d.appName || 'the app' });
|
|
@@ -337,7 +338,14 @@ function Player({ config, router, insets, onClose, children }) {
|
|
|
337
338
|
}));
|
|
338
339
|
})();
|
|
339
340
|
|
|
340
|
-
|
|
341
|
+
// A try step's tap, seen as it passes (never intercepted): the touch that
|
|
342
|
+
// ends on the ringed element is the viewer trying it (core.js tapInside).
|
|
343
|
+
const onTouchEnd = (e) => {
|
|
344
|
+
if (step?.kind !== 'try' || tried || !rect) return;
|
|
345
|
+
const { pageX, pageY } = e.nativeEvent || {};
|
|
346
|
+
if (tapInside(rect, pageX, pageY)) setTimeout(() => setTried(true), 600);
|
|
347
|
+
};
|
|
348
|
+
return h(View, { ref: rootRef, style: s.root, collapsable: false, onTouchEnd },
|
|
341
349
|
children,
|
|
342
350
|
h(View, { pointerEvents: 'box-none', style: StyleSheet.absoluteFill, testID: OVERLAY_ID }, overlay));
|
|
343
351
|
}
|
package/src/build-gate.js
CHANGED
|
@@ -25,6 +25,16 @@ export function nativeRuntime(mods = globalThis.expo?.modules, nativeModules = {
|
|
|
25
25
|
return typeof u.runtimeVersion === 'string' && u.runtimeVersion && !u.runtimeVersion.startsWith('file:') ? u.runtimeVersion : null;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// SSB'S OWN SIMULATOR SKIPS IT (0.13.2): a rehearsal and the review check run
|
|
29
|
+
// the app's simulator build (drivers/phone-review-sim.mjs), whose fingerprint
|
|
30
|
+
// is never the review's dev build, and the check stopped every rehearsal at
|
|
31
|
+
// "this review needs a newer build" — Connie Ho's ended "never opened"
|
|
32
|
+
// (demo xKkA8qPU7MS7p2yo5F7E, 2026-11-05 20:05 ET). The driver writes the app's
|
|
33
|
+
// iOS default `SSBSkipBuildGate` = YES; react-native's Settings reads it.
|
|
34
|
+
export function skipBuildGate(settings) {
|
|
35
|
+
try { return !!settings?.get?.('SSBSkipBuildGate'); } catch { return false; }
|
|
36
|
+
}
|
|
37
|
+
|
|
28
38
|
/** What the review needs that this build is not: null = play it, else { need, have }. */
|
|
29
39
|
export function buildGap(demo, have) {
|
|
30
40
|
const need = demo?.platform === 'ios' && typeof demo?.preview?.fingerprint === 'string' ? demo.preview.fingerprint : null;
|
package/src/core.js
CHANGED
|
@@ -10,7 +10,7 @@ import { bubbleBox } from './step-place.js';
|
|
|
10
10
|
// What this player is, said when the app registers for "Ready to see"
|
|
11
11
|
// (packages/ssb-overlay sends it; functions/in-app-notify.mjs clientOf). Kept
|
|
12
12
|
// equal to package.json by test/core.test.mjs.
|
|
13
|
-
export const PLAYER_VERSION = '0.13.
|
|
13
|
+
export const PLAYER_VERSION = '0.13.2';
|
|
14
14
|
|
|
15
15
|
export const HOST = 5;
|
|
16
16
|
export const TEXT = 6;
|
|
@@ -191,6 +191,17 @@ export function pinnedBox(at, screen, insets, card) {
|
|
|
191
191
|
return { left, width, top: covers ? Math.max(top, bottom) : top };
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
// A TAP ON THE RINGED ELEMENT (0.13.1): a `try` step is done when the viewer's
|
|
195
|
+
// touch lands on it (with a little slop for a finger). Watching for the element
|
|
196
|
+
// to leave the screen missed a modal: Connie Ho's profile opens OVER the walks
|
|
197
|
+
// list, the photo stays mounted, and the card kept offering "Show me" after
|
|
198
|
+
// Michael had tapped it (2026-11-05). Pure.
|
|
199
|
+
export function tapInside(rect, x, y, slop = 10) {
|
|
200
|
+
return !!rect && Number.isFinite(x) && Number.isFinite(y)
|
|
201
|
+
&& x >= rect.left - slop && x <= rect.left + rect.width + slop
|
|
202
|
+
&& y >= rect.top - slop && y <= rect.top + rect.height + slop;
|
|
203
|
+
}
|
|
204
|
+
|
|
194
205
|
// COLLAPSED, AND RESUMED FROM THE SSB BUTTON (0.13.0): collapsing leaves only
|
|
195
206
|
// the in-app SSB button (packages/ssb-overlay), whose tap resumes the review.
|
|
196
207
|
// The overlay says it is there (`announceOverlay`); without one the player
|