react-native-tapline 1.4.0 → 1.6.0
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/TaplineNative.podspec +3 -1
- package/dist/actions.d.ts +75 -2
- package/dist/actions.js +333 -25
- package/dist/actions.js.map +1 -1
- package/dist/alerts.d.ts +2 -0
- package/dist/alerts.js +5 -0
- package/dist/alerts.js.map +1 -1
- package/dist/anim.d.ts +25 -0
- package/dist/anim.js +311 -0
- package/dist/anim.js.map +1 -0
- package/dist/appinfo.d.ts +12 -0
- package/dist/appinfo.js +78 -0
- package/dist/appinfo.js.map +1 -0
- package/dist/checks.d.ts +43 -1
- package/dist/checks.js +17 -5
- package/dist/checks.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.js +28 -2
- package/dist/client.js.map +1 -1
- package/dist/commands.js +28 -0
- package/dist/commands.js.map +1 -1
- package/dist/glass.d.ts +3 -0
- package/dist/glass.js +81 -0
- package/dist/glass.js.map +1 -0
- package/dist/glassclip.d.ts +18 -0
- package/dist/glassclip.js +69 -0
- package/dist/glassclip.js.map +1 -0
- package/dist/guard.d.ts +17 -0
- package/dist/guard.js +44 -0
- package/dist/guard.js.map +1 -0
- package/dist/idle.d.ts +43 -0
- package/dist/idle.js +379 -0
- package/dist/idle.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +18 -1
- package/dist/inspect.js +48 -8
- package/dist/inspect.js.map +1 -1
- package/dist/loading.d.ts +17 -0
- package/dist/loading.js +96 -0
- package/dist/loading.js.map +1 -0
- package/dist/locale.js +1 -1
- package/dist/locale.js.map +1 -1
- package/dist/media.d.ts +71 -0
- package/dist/media.js +516 -0
- package/dist/media.js.map +1 -0
- package/dist/methods.js +14 -1
- package/dist/methods.js.map +1 -1
- package/dist/move.d.ts +40 -0
- package/dist/move.js +125 -0
- package/dist/move.js.map +1 -0
- package/dist/native.d.ts +5 -0
- package/dist/native.js.map +1 -1
- package/dist/network.d.ts +4 -0
- package/dist/network.js +49 -1
- package/dist/network.js.map +1 -1
- package/dist/place.d.ts +23 -0
- package/dist/place.js +66 -0
- package/dist/place.js.map +1 -0
- package/dist/placekey.d.ts +29 -0
- package/dist/placekey.js +134 -0
- package/dist/placekey.js.map +1 -0
- package/dist/routetree.d.ts +27 -0
- package/dist/routetree.js +216 -0
- package/dist/routetree.js.map +1 -0
- package/dist/types.d.ts +28 -2
- package/dist/types.js +5 -1
- package/dist/types.js.map +1 -1
- package/dist/uxcheck.d.ts +57 -0
- package/dist/uxcheck.js +222 -0
- package/dist/uxcheck.js.map +1 -0
- package/dist/wait.d.ts +5 -0
- package/dist/wait.js +34 -3
- package/dist/wait.js.map +1 -1
- package/ios/TaplineNativeModule.swift +61 -0
- package/package.json +1 -1
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
interface ExpoMediaLibrary {
|
|
2
|
+
createAssetAsync: (uri: string) => Promise<unknown>;
|
|
3
|
+
deleteAssetsAsync: (ids: string[]) => Promise<unknown>;
|
|
4
|
+
getPermissionsAsync: (writeOnly?: boolean) => Promise<unknown>;
|
|
5
|
+
requestPermissionsAsync: (writeOnly?: boolean) => Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
interface CameraRollModule {
|
|
8
|
+
save: (uri: string, options?: {
|
|
9
|
+
type?: string;
|
|
10
|
+
}) => Promise<unknown>;
|
|
11
|
+
deletePhotos: (uris: string[]) => Promise<unknown>;
|
|
12
|
+
}
|
|
13
|
+
interface FileSystemModule {
|
|
14
|
+
cacheDirectory: string;
|
|
15
|
+
writeAsStringAsync: (uri: string, contents: string, options: {
|
|
16
|
+
encoding: string;
|
|
17
|
+
}) => Promise<unknown>;
|
|
18
|
+
deleteAsync: (uri: string, options?: {
|
|
19
|
+
idempotent?: boolean;
|
|
20
|
+
}) => Promise<unknown>;
|
|
21
|
+
}
|
|
22
|
+
type PickerModule = Record<string, unknown>;
|
|
23
|
+
export interface MediaModules {
|
|
24
|
+
expo: ExpoMediaLibrary | null;
|
|
25
|
+
cameraRoll: CameraRollModule | null;
|
|
26
|
+
fileSystem: FileSystemModule | null;
|
|
27
|
+
imagePicker: PickerModule | null;
|
|
28
|
+
}
|
|
29
|
+
/** Replace the optional modules (tests); undefined restores the lookup. */
|
|
30
|
+
export declare function setMediaModules(next: MediaModules | undefined): void;
|
|
31
|
+
/** How long an OS prompt is waited for before the answer says a person must (tests shorten it). */
|
|
32
|
+
export declare function setMediaPatience(ms: number): void;
|
|
33
|
+
/** The asset ids this session has added and not yet removed. */
|
|
34
|
+
export declare function addedAssetIds(): readonly string[];
|
|
35
|
+
export interface AddOutcome {
|
|
36
|
+
/** The new asset's id; absent when a person must answer the OS prompt first. */
|
|
37
|
+
id?: string;
|
|
38
|
+
needsPerson?: boolean;
|
|
39
|
+
/** Ids of earlier saves that finished after their `needsPerson` answer; the host remembers them. */
|
|
40
|
+
late?: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface RemoveOutcome {
|
|
43
|
+
removed: number;
|
|
44
|
+
/** The person has not answered the OS delete confirmation yet. */
|
|
45
|
+
pending?: boolean;
|
|
46
|
+
/** The person declined the delete; the pictures stay (and stay remembered). */
|
|
47
|
+
declined?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** A picture handed to a photo picker, as an `expo-image-picker` asset describes it. */
|
|
50
|
+
export interface TaplinePickerPicture {
|
|
51
|
+
uri: string;
|
|
52
|
+
fileName: string;
|
|
53
|
+
mimeType: string;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
base64: string;
|
|
57
|
+
}
|
|
58
|
+
/** What a hook receives when pictures are armed for the app's own picker. */
|
|
59
|
+
export type TaplinePickerHook = (pictures: readonly TaplinePickerPicture[]) => void | Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* For an app whose photo picker is not expo-image-picker: called when the agent arms test pictures
|
|
62
|
+
* (`media` with `picker: true`), so the app can hand them to its own picker once. Returns the unregister function.
|
|
63
|
+
*/
|
|
64
|
+
export declare function registerTaplinePickerHook(hook: TaplinePickerHook): () => void;
|
|
65
|
+
/** Puts the picker back as the app made it and forgets pictures not yet used. Called after one use and on disconnect. */
|
|
66
|
+
export declare function resetMedia(): void;
|
|
67
|
+
/** Whether a picker stub is waiting for its one use. */
|
|
68
|
+
export declare function pickerArmed(): boolean;
|
|
69
|
+
/** `media {op: "add" | "remove" | "picker", ...}` (AGENT-TOOLS 1.12 §17.6). One picture per `add` and `picker` request. */
|
|
70
|
+
export declare function media(rawParams: unknown): Promise<unknown>;
|
|
71
|
+
export {};
|
package/dist/media.js
ADDED
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setMediaModules = setMediaModules;
|
|
4
|
+
exports.setMediaPatience = setMediaPatience;
|
|
5
|
+
exports.addedAssetIds = addedAssetIds;
|
|
6
|
+
exports.registerTaplinePickerHook = registerTaplinePickerHook;
|
|
7
|
+
exports.resetMedia = resetMedia;
|
|
8
|
+
exports.pickerArmed = pickerArmed;
|
|
9
|
+
exports.media = media;
|
|
10
|
+
const events_1 = require("./events");
|
|
11
|
+
const types_1 = require("./types");
|
|
12
|
+
/**
|
|
13
|
+
* `media` (AGENT-TOOLS 1.12 §17.6): test pictures for an app's photo picker.
|
|
14
|
+
*
|
|
15
|
+
* - `add`: saves a picture the host sent into the phone's photo library through the app's own
|
|
16
|
+
* `expo-media-library` (else `@react-native-camera-roll/camera-roll`). The OS asks the person for access.
|
|
17
|
+
* - `remove`: deletes only the assets this session added.
|
|
18
|
+
* - `picker`: the next `expo-image-picker` call (or a registered hook) gets the pictures, without the OS picker.
|
|
19
|
+
*
|
|
20
|
+
* Every module is optional and loaded the way the SDK loads react-native-view-shot. Tapline never reads
|
|
21
|
+
* the photo library: nothing here lists, queries or fetches assets.
|
|
22
|
+
*/
|
|
23
|
+
const UNSUPPORTED_LIBRARY = "this app has no photo-library module (expo-media-library or @react-native-camera-roll/camera-roll); Tapwright's media adds pictures for any app.";
|
|
24
|
+
const UNSUPPORTED_FILES = "this app has no expo-file-system, which Tapline needs to hand a picture to the photo library (npx expo install expo-file-system).";
|
|
25
|
+
/** How long to wait for the person to answer an OS prompt before telling the agent a person must. */
|
|
26
|
+
const DEFAULT_PATIENCE_MS = 4000;
|
|
27
|
+
function fn(value) {
|
|
28
|
+
return typeof value === 'function';
|
|
29
|
+
}
|
|
30
|
+
function isExpoMediaLibrary(value) {
|
|
31
|
+
return (0, types_1.isRecord)(value) && fn(value.createAssetAsync) && fn(value.deleteAssetsAsync) && fn(value.requestPermissionsAsync) && fn(value.getPermissionsAsync);
|
|
32
|
+
}
|
|
33
|
+
function isCameraRoll(value) {
|
|
34
|
+
return (0, types_1.isRecord)(value) && fn(value.save) && fn(value.deletePhotos);
|
|
35
|
+
}
|
|
36
|
+
function isFileSystem(value) {
|
|
37
|
+
return (0, types_1.isRecord)(value) && typeof value.cacheDirectory === 'string' && fn(value.writeAsStringAsync) && fn(value.deleteAsync);
|
|
38
|
+
}
|
|
39
|
+
/** A module's exports, or its `default` when that is where an ES module put them. */
|
|
40
|
+
function unwrap(mod, check) {
|
|
41
|
+
if (check(mod))
|
|
42
|
+
return mod;
|
|
43
|
+
return (0, types_1.isRecord)(mod) && check(mod.default) ? mod.default : null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Metro needs literal module names, and treats a require as optional only when it sits directly inside a `try`
|
|
47
|
+
* block: otherwise an app without the module fails to bundle at all (found on the phone with Wayfare, 2026-11-12).
|
|
48
|
+
*/
|
|
49
|
+
function load(name) {
|
|
50
|
+
switch (name) {
|
|
51
|
+
case 'expo-media-library':
|
|
52
|
+
try {
|
|
53
|
+
return require('expo-media-library');
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
case '@react-native-camera-roll/camera-roll':
|
|
59
|
+
try {
|
|
60
|
+
return require('@react-native-camera-roll/camera-roll');
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
case 'expo-file-system/legacy':
|
|
66
|
+
try {
|
|
67
|
+
return require('expo-file-system/legacy');
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
case 'expo-file-system':
|
|
73
|
+
try {
|
|
74
|
+
return require('expo-file-system');
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
default:
|
|
80
|
+
try {
|
|
81
|
+
return require('expo-image-picker');
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function tryLoad(name, check) {
|
|
89
|
+
try {
|
|
90
|
+
return unwrap(load(name), check);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
let override;
|
|
97
|
+
let loaded;
|
|
98
|
+
function modules() {
|
|
99
|
+
if (override !== undefined)
|
|
100
|
+
return override;
|
|
101
|
+
if (loaded === undefined) {
|
|
102
|
+
const cameraRollRaw = tryLoadRaw('@react-native-camera-roll/camera-roll');
|
|
103
|
+
const cameraRollModule = unwrap(cameraRollRaw, isCameraRoll) ?? ((0, types_1.isRecord)(cameraRollRaw) ? unwrap(cameraRollRaw.CameraRoll, isCameraRoll) : null);
|
|
104
|
+
const picker = tryLoadRaw('expo-image-picker');
|
|
105
|
+
loaded = {
|
|
106
|
+
expo: tryLoad('expo-media-library', isExpoMediaLibrary),
|
|
107
|
+
cameraRoll: cameraRollModule,
|
|
108
|
+
// SDK 54 moved the classic API to /legacy; older SDKs have it at the top.
|
|
109
|
+
fileSystem: tryLoad('expo-file-system/legacy', isFileSystem) ?? tryLoad('expo-file-system', isFileSystem),
|
|
110
|
+
imagePicker: (0, types_1.isRecord)(picker) ? picker : null,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return loaded;
|
|
114
|
+
}
|
|
115
|
+
function tryLoadRaw(name) {
|
|
116
|
+
try {
|
|
117
|
+
return load(name);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** Replace the optional modules (tests); undefined restores the lookup. */
|
|
124
|
+
function setMediaModules(next) {
|
|
125
|
+
override = next;
|
|
126
|
+
loaded = undefined;
|
|
127
|
+
resetMedia();
|
|
128
|
+
addedIds.length = 0;
|
|
129
|
+
permissionPending = null;
|
|
130
|
+
pendingSaves.clear();
|
|
131
|
+
abandonedSaves.clear();
|
|
132
|
+
completedSaves.clear();
|
|
133
|
+
lateSaved.length = 0;
|
|
134
|
+
}
|
|
135
|
+
let patienceMs = DEFAULT_PATIENCE_MS;
|
|
136
|
+
/** How long an OS prompt is waited for before the answer says a person must (tests shorten it). */
|
|
137
|
+
function setMediaPatience(ms) {
|
|
138
|
+
patienceMs = ms;
|
|
139
|
+
}
|
|
140
|
+
// ---- state kept in memory for this session ----------------------------------
|
|
141
|
+
/**
|
|
142
|
+
* Asset ids added, in order, each with the host that added it (its `owner`, one per host process): `remove` only
|
|
143
|
+
* deletes its own host's pictures, never an earlier host's that the app still remembers. Never written anywhere.
|
|
144
|
+
*/
|
|
145
|
+
const addedIds = [];
|
|
146
|
+
let permissionPending = null;
|
|
147
|
+
/** A camera-roll save the person has not answered yet, by host and picture name, so a retry waits for it instead of saving twice. */
|
|
148
|
+
const pendingSaves = new Map();
|
|
149
|
+
/** Names of saves whose caller was already told `needsPerson`: if one completes, nobody is waiting for its id. */
|
|
150
|
+
const abandonedSaves = new Set();
|
|
151
|
+
/** The id of an abandoned save that completed, by host and picture name, until a retry collects it (so a retry saves nothing twice). */
|
|
152
|
+
const completedSaves = new Map();
|
|
153
|
+
/**
|
|
154
|
+
* Ids of abandoned saves that completed and that no answer has carried to the host yet. The next `add` answer
|
|
155
|
+
* reports them (`late`), so the host can remember them for `remove` after a JS reload.
|
|
156
|
+
*/
|
|
157
|
+
const lateSaved = [];
|
|
158
|
+
/** A retry got this save's id itself: it is neither late nor waiting to be collected. */
|
|
159
|
+
function collected(name, id) {
|
|
160
|
+
if (completedSaves.get(name) === id)
|
|
161
|
+
completedSaves.delete(name);
|
|
162
|
+
const at = lateSaved.findIndex((late) => late.id === id);
|
|
163
|
+
if (at >= 0)
|
|
164
|
+
lateSaved.splice(at, 1);
|
|
165
|
+
}
|
|
166
|
+
/** The late ids of this host, taken out of the list. */
|
|
167
|
+
function takeLate(owner) {
|
|
168
|
+
const mine = lateSaved.filter((late) => late.owner === owner).map((late) => late.id);
|
|
169
|
+
for (let i = lateSaved.length - 1; i >= 0; i--)
|
|
170
|
+
if (lateSaved[i]?.owner === owner)
|
|
171
|
+
lateSaved.splice(i, 1);
|
|
172
|
+
return mine;
|
|
173
|
+
}
|
|
174
|
+
/** The asset ids this session has added and not yet removed. */
|
|
175
|
+
function addedAssetIds() {
|
|
176
|
+
return addedIds.map((added) => added.id);
|
|
177
|
+
}
|
|
178
|
+
/** The host that asks: its `owner` token, or '' from a host that sends none. */
|
|
179
|
+
function ownerOf(params) {
|
|
180
|
+
return typeof params.owner === 'string' ? params.owner : '';
|
|
181
|
+
}
|
|
182
|
+
/** Waits for `promise` for `ms`; `{done:false}` when it is still waiting (it carries on in the background). */
|
|
183
|
+
function within(promise, ms) {
|
|
184
|
+
return new Promise((resolve, reject) => {
|
|
185
|
+
const timer = setTimeout(() => resolve({ done: false }), ms);
|
|
186
|
+
promise.then((value) => {
|
|
187
|
+
clearTimeout(timer);
|
|
188
|
+
resolve({ done: true, value });
|
|
189
|
+
}, (error) => {
|
|
190
|
+
clearTimeout(timer);
|
|
191
|
+
reject(error);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function badParams(message) {
|
|
196
|
+
return new types_1.TaplineError('bad_params', message);
|
|
197
|
+
}
|
|
198
|
+
function paramString(params, key) {
|
|
199
|
+
const value = params[key];
|
|
200
|
+
if (typeof value !== 'string' || value === '')
|
|
201
|
+
throw badParams(`${key} must be a non-empty string`);
|
|
202
|
+
return value;
|
|
203
|
+
}
|
|
204
|
+
function paramNumber(params, key) {
|
|
205
|
+
const value = params[key];
|
|
206
|
+
return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : undefined;
|
|
207
|
+
}
|
|
208
|
+
function extensionOf(mime) {
|
|
209
|
+
return mime === 'image/png' ? 'png' : 'jpg';
|
|
210
|
+
}
|
|
211
|
+
function isGranted(result) {
|
|
212
|
+
return (0, types_1.isRecord)(result) && (result.granted === true || result.status === 'granted');
|
|
213
|
+
}
|
|
214
|
+
/** expo-media-library: write-only access, asked once. `granted`, `denied`, or `pending` while the person has not answered. */
|
|
215
|
+
async function expoAccess(lib) {
|
|
216
|
+
const current = await lib.getPermissionsAsync(true);
|
|
217
|
+
if (isGranted(current))
|
|
218
|
+
return 'granted';
|
|
219
|
+
if ((0, types_1.isRecord)(current) && current.canAskAgain === false)
|
|
220
|
+
return 'denied';
|
|
221
|
+
permissionPending ??= lib.requestPermissionsAsync(true).finally(() => {
|
|
222
|
+
permissionPending = null;
|
|
223
|
+
});
|
|
224
|
+
const waited = await within(permissionPending, patienceMs);
|
|
225
|
+
if (!waited.done)
|
|
226
|
+
return 'pending';
|
|
227
|
+
return isGranted(waited.value) ? 'granted' : 'denied';
|
|
228
|
+
}
|
|
229
|
+
function assetIdOf(asset) {
|
|
230
|
+
if ((0, types_1.isRecord)(asset) && typeof asset.id === 'string' && asset.id !== '')
|
|
231
|
+
return asset.id;
|
|
232
|
+
throw new types_1.TaplineError('internal', 'the photo library did not return the new picture\'s id');
|
|
233
|
+
}
|
|
234
|
+
async function writeTemp(files, mime, data) {
|
|
235
|
+
const uri = `${files.cacheDirectory}tapline-media-${Date.now()}-${Math.floor(Math.random() * 1e6)}.${extensionOf(mime)}`;
|
|
236
|
+
await files.writeAsStringAsync(uri, data, { encoding: 'base64' });
|
|
237
|
+
return uri;
|
|
238
|
+
}
|
|
239
|
+
async function addPicture(params) {
|
|
240
|
+
const outcome = await addOne(params);
|
|
241
|
+
const late = takeLate(ownerOf(params)).filter((id) => id !== outcome.id);
|
|
242
|
+
return late.length > 0 ? { ...outcome, late } : outcome;
|
|
243
|
+
}
|
|
244
|
+
async function addOne(params) {
|
|
245
|
+
const name = paramString(params, 'name');
|
|
246
|
+
const mime = paramString(params, 'mime');
|
|
247
|
+
const data = paramString(params, 'data');
|
|
248
|
+
const { expo, cameraRoll, fileSystem } = modules();
|
|
249
|
+
if (expo === null && cameraRoll === null)
|
|
250
|
+
throw new types_1.TaplineError('unsupported', UNSUPPORTED_LIBRARY);
|
|
251
|
+
if (fileSystem === null)
|
|
252
|
+
throw new types_1.TaplineError('unsupported', UNSUPPORTED_FILES);
|
|
253
|
+
if (expo !== null) {
|
|
254
|
+
const access = await expoAccess(expo);
|
|
255
|
+
if (access === 'pending')
|
|
256
|
+
return { needsPerson: true };
|
|
257
|
+
if (access === 'denied') {
|
|
258
|
+
throw new types_1.TaplineError('not_actionable', 'the person did not allow adding photos (Settings > the app > Photos); ask your user to allow it, then call media again.');
|
|
259
|
+
}
|
|
260
|
+
const uri = await writeTemp(fileSystem, mime, data);
|
|
261
|
+
try {
|
|
262
|
+
const id = assetIdOf(await expo.createAssetAsync(uri));
|
|
263
|
+
addedIds.push({ id, owner: ownerOf(params) });
|
|
264
|
+
return { id };
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
await fileSystem.deleteAsync(uri, { idempotent: true }).catch(() => undefined);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// @react-native-camera-roll: iOS asks for add-only access by itself when the save starts.
|
|
271
|
+
const library = cameraRoll;
|
|
272
|
+
if (library === null)
|
|
273
|
+
throw new types_1.TaplineError('unsupported', UNSUPPORTED_LIBRARY);
|
|
274
|
+
// One host's save is never another's: a restarted host adding the same name saves its own picture.
|
|
275
|
+
const key = `${ownerOf(params)}\u0000${name}`;
|
|
276
|
+
const finished = completedSaves.get(key);
|
|
277
|
+
if (finished !== undefined) {
|
|
278
|
+
collected(key, finished);
|
|
279
|
+
return { id: finished };
|
|
280
|
+
}
|
|
281
|
+
let saving = pendingSaves.get(key);
|
|
282
|
+
let temp = null;
|
|
283
|
+
if (saving === undefined) {
|
|
284
|
+
const uri = await writeTemp(fileSystem, mime, data);
|
|
285
|
+
temp = uri;
|
|
286
|
+
saving = library.save(uri, { type: 'photo' }).then((saved) => {
|
|
287
|
+
if (typeof saved !== 'string' || saved === '')
|
|
288
|
+
throw new types_1.TaplineError('internal', 'the photo library did not return the new picture\'s id');
|
|
289
|
+
return saved;
|
|
290
|
+
});
|
|
291
|
+
pendingSaves.set(key, saving);
|
|
292
|
+
const cleanup = () => {
|
|
293
|
+
pendingSaves.delete(key);
|
|
294
|
+
if (temp !== null)
|
|
295
|
+
void fileSystem.deleteAsync(temp, { idempotent: true }).catch(() => undefined);
|
|
296
|
+
};
|
|
297
|
+
saving.then((id) => {
|
|
298
|
+
cleanup();
|
|
299
|
+
const owner = ownerOf(params);
|
|
300
|
+
addedIds.push({ id, owner });
|
|
301
|
+
if (abandonedSaves.delete(key)) {
|
|
302
|
+
completedSaves.set(key, id);
|
|
303
|
+
lateSaved.push({ id, owner });
|
|
304
|
+
}
|
|
305
|
+
}, () => {
|
|
306
|
+
cleanup();
|
|
307
|
+
abandonedSaves.delete(key);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
const waited = await within(saving, patienceMs);
|
|
311
|
+
if (!waited.done) {
|
|
312
|
+
abandonedSaves.add(key);
|
|
313
|
+
return { needsPerson: true };
|
|
314
|
+
}
|
|
315
|
+
collected(key, waited.value);
|
|
316
|
+
return { id: waited.value };
|
|
317
|
+
}
|
|
318
|
+
function forget(ids) {
|
|
319
|
+
for (const id of ids) {
|
|
320
|
+
const at = addedIds.findIndex((added) => added.id === id);
|
|
321
|
+
if (at >= 0)
|
|
322
|
+
addedIds.splice(at, 1);
|
|
323
|
+
// A removed picture is no longer a finished save: adding the same name again must save a new one.
|
|
324
|
+
for (const [key, saved] of completedSaves)
|
|
325
|
+
if (saved === id)
|
|
326
|
+
completedSaves.delete(key);
|
|
327
|
+
for (let i = lateSaved.length - 1; i >= 0; i--)
|
|
328
|
+
if (lateSaved[i]?.id === id)
|
|
329
|
+
lateSaved.splice(i, 1);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
async function removePictures(params) {
|
|
333
|
+
const { expo, cameraRoll } = modules();
|
|
334
|
+
if (expo === null && cameraRoll === null)
|
|
335
|
+
throw new types_1.TaplineError('unsupported', UNSUPPORTED_LIBRARY);
|
|
336
|
+
// This host's pictures in the phone's memory, plus the ids the host kept itself (after a JS reload). An earlier
|
|
337
|
+
// host's pictures stay: a restarted host is another session (1.5 review).
|
|
338
|
+
const owner = ownerOf(params);
|
|
339
|
+
const mine = addedIds.filter((added) => added.owner === owner).map((added) => added.id);
|
|
340
|
+
const fromHost = Array.isArray(params.ids) ? params.ids.filter((id) => typeof id === 'string' && id !== '') : [];
|
|
341
|
+
const ids = [...new Set([...mine, ...fromHost])];
|
|
342
|
+
if (ids.length === 0)
|
|
343
|
+
return { removed: 0 };
|
|
344
|
+
const deleting = expo !== null ? expo.deleteAssetsAsync(ids) : cameraRoll.deletePhotos(ids);
|
|
345
|
+
const settle = (outcome) => {
|
|
346
|
+
const declined = outcome === false;
|
|
347
|
+
if (!declined)
|
|
348
|
+
forget(ids);
|
|
349
|
+
return declined;
|
|
350
|
+
};
|
|
351
|
+
const waited = await within(deleting, patienceMs);
|
|
352
|
+
if (!waited.done) {
|
|
353
|
+
deleting.then(settle, () => undefined);
|
|
354
|
+
return { removed: ids.length, pending: true };
|
|
355
|
+
}
|
|
356
|
+
return settle(waited.value) ? { removed: 0, declined: true } : { removed: ids.length };
|
|
357
|
+
}
|
|
358
|
+
const hooks = new Set();
|
|
359
|
+
/**
|
|
360
|
+
* For an app whose photo picker is not expo-image-picker: called when the agent arms test pictures
|
|
361
|
+
* (`media` with `picker: true`), so the app can hand them to its own picker once. Returns the unregister function.
|
|
362
|
+
*/
|
|
363
|
+
function registerTaplinePickerHook(hook) {
|
|
364
|
+
hooks.add(hook);
|
|
365
|
+
return () => {
|
|
366
|
+
hooks.delete(hook);
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
const WRAPPED = ['launchImageLibraryAsync', 'launchCameraAsync'];
|
|
370
|
+
let staged = [];
|
|
371
|
+
let armed = null;
|
|
372
|
+
let restoreOriginals = null;
|
|
373
|
+
function asPicture(p) {
|
|
374
|
+
return { ...p, uri: `data:${p.mimeType};base64,${p.base64}` };
|
|
375
|
+
}
|
|
376
|
+
function pickerResult(pictures) {
|
|
377
|
+
return {
|
|
378
|
+
canceled: false,
|
|
379
|
+
assets: pictures.map((p) => ({
|
|
380
|
+
uri: `data:${p.mimeType};base64,${p.base64}`,
|
|
381
|
+
assetId: null,
|
|
382
|
+
width: p.width,
|
|
383
|
+
height: p.height,
|
|
384
|
+
type: 'image',
|
|
385
|
+
fileName: p.fileName,
|
|
386
|
+
fileSize: Math.floor((p.base64.length * 3) / 4),
|
|
387
|
+
mimeType: p.mimeType,
|
|
388
|
+
exif: null,
|
|
389
|
+
base64: null,
|
|
390
|
+
})),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
/** Wraps the picker's launch functions; false when the module's properties can't be replaced. */
|
|
394
|
+
function installWrappers(mod) {
|
|
395
|
+
if (restoreOriginals !== null)
|
|
396
|
+
return true;
|
|
397
|
+
const originals = new Map();
|
|
398
|
+
const wrapper = (name) => async (...args) => {
|
|
399
|
+
const pictures = armed;
|
|
400
|
+
const original = originals.get(name);
|
|
401
|
+
if (pictures === null) {
|
|
402
|
+
// Nothing pending any more: behave as the app's own picker does.
|
|
403
|
+
return typeof original === 'function' ? original(...args) : undefined;
|
|
404
|
+
}
|
|
405
|
+
// One use: the original is back before the result is handed over.
|
|
406
|
+
resetMedia();
|
|
407
|
+
(0, events_1.emitEvent)('pickerSkipped', { count: pictures.length });
|
|
408
|
+
return pickerResult(pictures);
|
|
409
|
+
};
|
|
410
|
+
const done = [];
|
|
411
|
+
for (const name of WRAPPED) {
|
|
412
|
+
const original = mod[name];
|
|
413
|
+
if (typeof original !== 'function')
|
|
414
|
+
continue;
|
|
415
|
+
originals.set(name, original);
|
|
416
|
+
const replacement = wrapper(name);
|
|
417
|
+
try {
|
|
418
|
+
mod[name] = replacement;
|
|
419
|
+
}
|
|
420
|
+
catch {
|
|
421
|
+
// read-only export
|
|
422
|
+
}
|
|
423
|
+
if (mod[name] === replacement)
|
|
424
|
+
done.push(name);
|
|
425
|
+
}
|
|
426
|
+
if (done.length === 0)
|
|
427
|
+
return false;
|
|
428
|
+
restoreOriginals = () => {
|
|
429
|
+
for (const name of done) {
|
|
430
|
+
try {
|
|
431
|
+
mod[name] = originals.get(name);
|
|
432
|
+
}
|
|
433
|
+
catch {
|
|
434
|
+
// already gone
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
return true;
|
|
439
|
+
}
|
|
440
|
+
async function armPicker(params) {
|
|
441
|
+
const index = paramNumber(params, 'index') ?? 1;
|
|
442
|
+
const total = paramNumber(params, 'total') ?? 1;
|
|
443
|
+
const data = paramString(params, 'data');
|
|
444
|
+
const mime = paramString(params, 'mime');
|
|
445
|
+
const name = paramString(params, 'name');
|
|
446
|
+
if (index === 1)
|
|
447
|
+
staged = [];
|
|
448
|
+
staged.push({
|
|
449
|
+
fileName: name,
|
|
450
|
+
mimeType: mime,
|
|
451
|
+
width: paramNumber(params, 'width') ?? 0,
|
|
452
|
+
height: paramNumber(params, 'height') ?? 0,
|
|
453
|
+
base64: data,
|
|
454
|
+
});
|
|
455
|
+
if (index < total)
|
|
456
|
+
return { pictures: staged.length, hooks: 0 };
|
|
457
|
+
const pictures = staged;
|
|
458
|
+
staged = [];
|
|
459
|
+
const mod = modules().imagePicker;
|
|
460
|
+
const wrapped = mod !== null && installWrappers(mod);
|
|
461
|
+
if (!wrapped && hooks.size === 0) {
|
|
462
|
+
throw new types_1.TaplineError('unsupported', mod === null
|
|
463
|
+
? "this app has no expo-image-picker; register a hook with registerTaplinePickerHook(fn) in the app so Tapline can hand its own picker the pictures."
|
|
464
|
+
: "this app's expo-image-picker can't be wrapped (its exports are read-only); register a hook with registerTaplinePickerHook(fn).");
|
|
465
|
+
}
|
|
466
|
+
armed = wrapped ? pictures : null;
|
|
467
|
+
let called = 0;
|
|
468
|
+
const forHooks = hooks.size > 0 ? pictures.map(asPicture) : [];
|
|
469
|
+
for (const hook of [...hooks]) {
|
|
470
|
+
try {
|
|
471
|
+
await hook(forHooks);
|
|
472
|
+
called += 1;
|
|
473
|
+
}
|
|
474
|
+
catch {
|
|
475
|
+
// a broken hook must not break the run
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
(0, events_1.emitEvent)('pickerArmed', { count: pictures.length });
|
|
479
|
+
return { pictures: pictures.length, hooks: called };
|
|
480
|
+
}
|
|
481
|
+
/** Puts the picker back as the app made it and forgets pictures not yet used. Called after one use and on disconnect. */
|
|
482
|
+
function resetMedia() {
|
|
483
|
+
const restore = restoreOriginals;
|
|
484
|
+
restoreOriginals = null;
|
|
485
|
+
armed = null;
|
|
486
|
+
staged = [];
|
|
487
|
+
if (restore !== null)
|
|
488
|
+
restore();
|
|
489
|
+
}
|
|
490
|
+
/** Whether a picker stub is waiting for its one use. */
|
|
491
|
+
function pickerArmed() {
|
|
492
|
+
return armed !== null;
|
|
493
|
+
}
|
|
494
|
+
// ---- the protocol method --------------------------------------------------------
|
|
495
|
+
/** `media {op: "add" | "remove" | "picker", ...}` (AGENT-TOOLS 1.12 §17.6). One picture per `add` and `picker` request. */
|
|
496
|
+
async function media(rawParams) {
|
|
497
|
+
if (!(0, types_1.isRecord)(rawParams))
|
|
498
|
+
throw badParams('params must be an object');
|
|
499
|
+
switch (rawParams.op) {
|
|
500
|
+
case 'add':
|
|
501
|
+
return addPicture(rawParams);
|
|
502
|
+
case 'remove':
|
|
503
|
+
return removePictures(rawParams);
|
|
504
|
+
case 'picker':
|
|
505
|
+
return armPicker(rawParams);
|
|
506
|
+
case 'disarm': {
|
|
507
|
+
// The host's journey stopped: a stub nobody used goes back, so a person's next pick is their own.
|
|
508
|
+
const was = armed !== null || staged.length > 0;
|
|
509
|
+
resetMedia();
|
|
510
|
+
return { disarmed: was };
|
|
511
|
+
}
|
|
512
|
+
default:
|
|
513
|
+
throw badParams('op must be "add", "remove", "picker" or "disarm"');
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":";;AA4JA,0CAUC;AAKD,4CAEC;AAqCD,sCAEC;AAmOD,8DAKC;AAuHD,gCAMC;AAGD,kCAEC;AAKD,sBAkBC;AArlBD,qCAAqC;AACrC,mCAAiD;AAEjD;;;;;;;;;;GAUG;AAEH,MAAM,mBAAmB,GACvB,kJAAkJ,CAAC;AACrJ,MAAM,iBAAiB,GACrB,mIAAmI,CAAC;AAEtI,qGAAqG;AACrG,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAqCjC,SAAS,EAAE,CAAC,KAAc;IACxB,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;AAC5J,CAAC;AAED,SAAS,YAAY,CAAC,K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YAChD,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;QAC3B,CAAC;QACD;YACE,MAAM,SAAS,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
|
package/dist/methods.js
CHANGED
|
@@ -5,7 +5,13 @@ const actions_1 = require("./actions");
|
|
|
5
5
|
const checks_1 = require("./checks");
|
|
6
6
|
const crash_1 = require("./crash");
|
|
7
7
|
const commands_1 = require("./commands");
|
|
8
|
+
const glass_1 = require("./glass");
|
|
8
9
|
const inspect_1 = require("./inspect");
|
|
10
|
+
const media_1 = require("./media");
|
|
11
|
+
const move_1 = require("./move");
|
|
12
|
+
const place_1 = require("./place");
|
|
13
|
+
const routetree_1 = require("./routetree");
|
|
14
|
+
const types_1 = require("./types");
|
|
9
15
|
const live_1 = require("./live");
|
|
10
16
|
const perf_1 = require("./perf");
|
|
11
17
|
const wait_1 = require("./wait");
|
|
@@ -14,6 +20,7 @@ const wait_1 = require("./wait");
|
|
|
14
20
|
/** An action changes the screen: let anyone watching see the result soon. */
|
|
15
21
|
function action(fn) {
|
|
16
22
|
return async (params) => {
|
|
23
|
+
(0, actions_1.beginAction)();
|
|
17
24
|
try {
|
|
18
25
|
return await fn(params);
|
|
19
26
|
}
|
|
@@ -24,7 +31,7 @@ function action(fn) {
|
|
|
24
31
|
}
|
|
25
32
|
/** Protocol method name -> implementation. */
|
|
26
33
|
exports.methods = {
|
|
27
|
-
tree: (params) => (0, inspect_1.tree)(params),
|
|
34
|
+
tree: (params) => ((0, types_1.isRecord)(params) && params.glass === true ? (0, glass_1.glassTree)(params) : (0, inspect_1.tree)(params)),
|
|
28
35
|
press: action((params) => (0, actions_1.press)(params)),
|
|
29
36
|
longPress: action((params) => (0, actions_1.longPress)(params)),
|
|
30
37
|
type: action((params) => (0, actions_1.typeText)(params)),
|
|
@@ -43,6 +50,8 @@ exports.methods = {
|
|
|
43
50
|
logs: (params) => (0, actions_1.getLogs)(params),
|
|
44
51
|
inspect: (params) => (0, actions_1.inspect)(params),
|
|
45
52
|
audit: (params) => (0, actions_1.audit)(params),
|
|
53
|
+
uxCheck: (params) => (0, actions_1.uxCheck)(params),
|
|
54
|
+
media: (params) => (0, media_1.media)(params),
|
|
46
55
|
reload: () => (0, actions_1.reload)(),
|
|
47
56
|
perfStart: () => (0, perf_1.perfStart)(),
|
|
48
57
|
perfStop: (params) => (0, perf_1.perfStop)(params),
|
|
@@ -52,5 +61,9 @@ exports.methods = {
|
|
|
52
61
|
screenshot: (params) => (0, actions_1.screenshot)(params),
|
|
53
62
|
feed: (params) => (0, live_1.feedMethod)(params),
|
|
54
63
|
overlay: () => (0, inspect_1.overlay)(),
|
|
64
|
+
// AGENT-TOOLS 1.13 §18: where the app is, the places its route tree lists, and one move with the next target waited for.
|
|
65
|
+
place: async () => (0, place_1.placeData)(),
|
|
66
|
+
places: async () => (0, routetree_1.knownPlaces)(),
|
|
67
|
+
move: action((params) => (0, move_1.move)(params)),
|
|
55
68
|
};
|
|
56
69
|
//# sourceMappingURL=methods.js.map
|