@ateam-ai-mobile/expo 0.1.5 → 0.1.8
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/android/build.gradle +16 -0
- package/android/src/main/java/expo/modules/adavision/AdaVisionModule.kt +75 -0
- package/dist/attachmentCache-DhQTqi2E.d.mts +18 -0
- package/dist/attachmentCache-DhQTqi2E.d.ts +18 -0
- package/dist/bootstrap.d.mts +95 -0
- package/dist/bootstrap.d.ts +95 -0
- package/dist/bootstrap.js +2991 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/bootstrap.mjs +66 -0
- package/dist/bootstrap.mjs.map +1 -0
- package/dist/chunk-4BMWVN25.mjs +91 -0
- package/dist/chunk-4BMWVN25.mjs.map +1 -0
- package/dist/chunk-6LXF3JVX.mjs +96 -0
- package/dist/chunk-6LXF3JVX.mjs.map +1 -0
- package/dist/chunk-7FWYEHN5.mjs +203 -0
- package/dist/chunk-7FWYEHN5.mjs.map +1 -0
- package/dist/chunk-C7M5WAHA.mjs +1798 -0
- package/dist/chunk-C7M5WAHA.mjs.map +1 -0
- package/dist/chunk-FF6ZZZXH.mjs +71 -0
- package/dist/chunk-FF6ZZZXH.mjs.map +1 -0
- package/dist/chunk-GF2MPTAB.mjs +647 -0
- package/dist/chunk-GF2MPTAB.mjs.map +1 -0
- package/dist/chunk-J6XRNX7P.mjs +19 -0
- package/dist/chunk-J6XRNX7P.mjs.map +1 -0
- package/dist/chunk-KOXF2FZM.mjs +92 -0
- package/dist/chunk-KOXF2FZM.mjs.map +1 -0
- package/dist/chunk-L4V7OCJ3.mjs +71 -0
- package/dist/chunk-L4V7OCJ3.mjs.map +1 -0
- package/dist/chunk-PCAEUX2N.mjs +67 -0
- package/dist/chunk-PCAEUX2N.mjs.map +1 -0
- package/dist/chunk-WMJKH4XE.mjs +34 -0
- package/dist/chunk-WMJKH4XE.mjs.map +1 -0
- package/dist/chunk-XQSY6MHP.mjs +213 -0
- package/dist/chunk-XQSY6MHP.mjs.map +1 -0
- package/dist/chunk-Z5AI2SXX.mjs +1810 -0
- package/dist/chunk-Z5AI2SXX.mjs.map +1 -0
- package/dist/createBridge.js +41 -10
- package/dist/createBridge.js.map +1 -1
- package/dist/createBridge.mjs +7 -1
- package/dist/createBridge.mjs.map +1 -1
- package/dist/device/createDeviceProvider.d.mts +23 -0
- package/dist/device/createDeviceProvider.d.ts +23 -0
- package/dist/device/createDeviceProvider.js +1228 -0
- package/dist/device/createDeviceProvider.js.map +1 -0
- package/dist/device/createDeviceProvider.mjs +19 -0
- package/dist/device/createDeviceProvider.mjs.map +1 -0
- package/dist/device-bridge/collectors/appEngagement.d.mts +10 -0
- package/dist/device-bridge/collectors/appEngagement.d.ts +10 -0
- package/dist/device-bridge/collectors/appEngagement.js +128 -0
- package/dist/device-bridge/collectors/appEngagement.js.map +1 -0
- package/dist/device-bridge/collectors/appEngagement.mjs +12 -0
- package/dist/device-bridge/collectors/appEngagement.mjs.map +1 -0
- package/dist/device-bridge/collectors/health.d.mts +24 -0
- package/dist/device-bridge/collectors/health.d.ts +24 -0
- package/dist/device-bridge/collectors/health.js +238 -0
- package/dist/device-bridge/collectors/health.js.map +1 -0
- package/dist/device-bridge/collectors/health.mjs +18 -0
- package/dist/device-bridge/collectors/health.mjs.map +1 -0
- package/dist/device-bridge/cookies.d.mts +49 -0
- package/dist/device-bridge/cookies.d.ts +49 -0
- package/dist/device-bridge/cookies.js +90 -0
- package/dist/device-bridge/cookies.js.map +1 -0
- package/dist/device-bridge/cookies.mjs +14 -0
- package/dist/device-bridge/cookies.mjs.map +1 -0
- package/dist/device-bridge/index.d.mts +495 -0
- package/dist/device-bridge/index.d.ts +495 -0
- package/dist/device-bridge/index.js +2121 -0
- package/dist/device-bridge/index.js.map +1 -0
- package/dist/device-bridge/index.mjs +34 -0
- package/dist/device-bridge/index.mjs.map +1 -0
- package/dist/device-bridge/nfc.d.mts +30 -0
- package/dist/device-bridge/nfc.d.ts +30 -0
- package/dist/device-bridge/nfc.js +109 -0
- package/dist/device-bridge/nfc.js.map +1 -0
- package/dist/device-bridge/nfc.mjs +14 -0
- package/dist/device-bridge/nfc.mjs.map +1 -0
- package/dist/index.d.mts +509 -18
- package/dist/index.d.ts +509 -18
- package/dist/index.js +1706 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -194
- package/dist/index.mjs.map +1 -1
- package/dist/maps/index.d.mts +56 -0
- package/dist/maps/index.d.ts +56 -0
- package/dist/maps/index.js +95 -0
- package/dist/maps/index.js.map +1 -0
- package/dist/maps/index.mjs +17 -0
- package/dist/maps/index.mjs.map +1 -0
- package/dist/oauth/expoOAuth.d.mts +18 -0
- package/dist/oauth/expoOAuth.d.ts +18 -0
- package/dist/oauth/expoOAuth.js +102 -0
- package/dist/oauth/expoOAuth.js.map +1 -0
- package/dist/oauth/expoOAuth.mjs +8 -0
- package/dist/oauth/expoOAuth.mjs.map +1 -0
- package/dist/types-BRanJYTn.d.mts +138 -0
- package/dist/types-BRanJYTn.d.ts +138 -0
- package/dist/vision/index.d.mts +83 -0
- package/dist/vision/index.d.ts +83 -0
- package/dist/vision/index.js +101 -0
- package/dist/vision/index.js.map +1 -0
- package/dist/vision/index.mjs +28 -0
- package/dist/vision/index.mjs.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/AdaMaps/AdaMapsModule.swift +180 -0
- package/ios/AdaMaps.podspec +25 -0
- package/ios/AdaVision.podspec +32 -0
- package/ios/AdaVisionModule.swift +486 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/analytics/coremldata.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/coremldata.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/metadata.json +773 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model0/analytics/coremldata.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model0/coremldata.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model0/model.mil +720 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model0/weights/weight.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model1/coremldata.bin +0 -0
- package/package.json +113 -7
- package/src/args.ts +56 -0
- package/src/bootstrap.ts +159 -0
- package/src/camera/CameraTaskHost.tsx +175 -0
- package/src/camera/cameraTasks.ts +129 -0
- package/src/createBridge.ts +3 -1
- package/src/device/createDeviceProvider.ts +917 -0
- package/src/device-bridge/actions/calendar-actions.ts +217 -0
- package/src/device-bridge/actions/dnd.ts +74 -0
- package/src/device-bridge/actions/health-actions.ts +58 -0
- package/src/device-bridge/actions/index.ts +12 -0
- package/src/device-bridge/actions/messaging.ts +74 -0
- package/src/device-bridge/actions/navigation.ts +88 -0
- package/src/device-bridge/actions/queue-poller.ts +151 -0
- package/src/device-bridge/background.ts +137 -0
- package/src/device-bridge/biometrics.ts +64 -0
- package/src/device-bridge/capabilities.ts +218 -0
- package/src/device-bridge/collectors/appEngagement.ts +120 -0
- package/src/device-bridge/collectors/battery.ts +83 -0
- package/src/device-bridge/collectors/calendar.ts +162 -0
- package/src/device-bridge/collectors/camera.ts +27 -0
- package/src/device-bridge/collectors/connectivity.ts +60 -0
- package/src/device-bridge/collectors/contacts.ts +200 -0
- package/src/device-bridge/collectors/health.ts +299 -0
- package/src/device-bridge/collectors/index.ts +12 -0
- package/src/device-bridge/collectors/location.ts +236 -0
- package/src/device-bridge/collectors/mood.ts +141 -0
- package/src/device-bridge/collectors/notifications.ts +70 -0
- package/src/device-bridge/cookies.ts +89 -0
- package/src/device-bridge/dynamic-connector.ts +422 -0
- package/src/device-bridge/index.ts +467 -0
- package/src/device-bridge/nfc.ts +85 -0
- package/src/device-bridge/plugin.ts +71 -0
- package/src/device-bridge/relay-client.ts +237 -0
- package/src/device-bridge/scanner.ts +42 -0
- package/src/device-bridge/sharing.ts +35 -0
- package/src/device-bridge/types.ts +326 -0
- package/src/device-state/activityClassifier.ts +151 -0
- package/src/device-state/activityEngine.ts +252 -0
- package/src/device-state/collectors.ts +35 -0
- package/src/device-state/domains/activity.ts +93 -0
- package/src/device-state/domains/capability.ts +60 -0
- package/src/device-state/domains/connectivity.ts +60 -0
- package/src/device-state/domains/deviceContext.ts +57 -0
- package/src/device-state/domains/interaction.ts +60 -0
- package/src/device-state/domains/spatial.ts +367 -0
- package/src/device-state/domains/visual.ts +121 -0
- package/src/device-state/events.ts +49 -0
- package/src/device-state/headingSource.ts +119 -0
- package/src/device-state/index.ts +78 -0
- package/src/device-state/quality.ts +60 -0
- package/src/device-state/replay.ts +285 -0
- package/src/device-state/spatialEvents.ts +300 -0
- package/src/device-state/turnDetector.ts +121 -0
- package/src/device-state/visualEngine.ts +341 -0
- package/src/geo.ts +23 -0
- package/src/haptics.ts +4 -0
- package/src/index.ts +37 -0
- package/src/maps/index.ts +81 -0
- package/src/maps/normalize.ts +225 -0
- package/src/oauth/expoOAuth.tsx +113 -0
- package/src/vision/analysis.js +80 -0
- package/src/vision/index.ts +146 -0
- package/src/vision/ring.js +35 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The broker between a plugin's `await` and a mounted camera.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS. expo-camera has no headless capture: scanning a barcode and
|
|
5
|
+
* recording a clip both require a MOUNTED `<CameraView>`. But a plugin calls
|
|
6
|
+
* `native.scanner.scanOnce()` and expects a promise — it has no way to mount
|
|
7
|
+
* anything, and it must not have to.
|
|
8
|
+
*
|
|
9
|
+
* So the API enqueues a TASK here and awaits it; `CameraTaskHost`, mounted once
|
|
10
|
+
* by the app, notices, shows the camera, does the work, and settles the
|
|
11
|
+
* promise. This is the same split as the Visual engine, for the same reason —
|
|
12
|
+
* and it is why `native.camera.scanBarcode` refuses and points here rather than
|
|
13
|
+
* pretending a function call can own a React lifecycle.
|
|
14
|
+
*
|
|
15
|
+
* ONE TASK AT A TIME, and it is the phone that says so: there is one camera. A
|
|
16
|
+
* second request while one is running is REJECTED rather than queued, because a
|
|
17
|
+
* queued scan would open the camera again minutes later, long after the user
|
|
18
|
+
* moved on and with no idea why it appeared.
|
|
19
|
+
*/
|
|
20
|
+
export interface ScanTask {
|
|
21
|
+
kind: 'scan';
|
|
22
|
+
opts: { formats?: string[]; timeoutMs?: number };
|
|
23
|
+
resolve: (v: { data: string; format: string }) => void;
|
|
24
|
+
reject: (e: Error) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface RecordTask {
|
|
28
|
+
kind: 'record';
|
|
29
|
+
opts: { maxDurationMs?: number; withAudio?: boolean };
|
|
30
|
+
resolve: (v: { uri: string; durationMs: number | null }) => void;
|
|
31
|
+
reject: (e: Error) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type CameraTask = ScanTask | RecordTask;
|
|
35
|
+
|
|
36
|
+
type Listener = () => void;
|
|
37
|
+
|
|
38
|
+
/** Typed failure, so a caller can say something specific and true. */
|
|
39
|
+
export function cameraError(code: string, message: string): Error {
|
|
40
|
+
const err: any = new Error(message);
|
|
41
|
+
err.code = code;
|
|
42
|
+
return err;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
class CameraTaskBroker {
|
|
46
|
+
private task: CameraTask | null = null;
|
|
47
|
+
private listeners = new Set<Listener>();
|
|
48
|
+
/** Set by the host while a camera is mounted and ready. */
|
|
49
|
+
private hostMounted = false;
|
|
50
|
+
|
|
51
|
+
current(): CameraTask | null { return this.task; }
|
|
52
|
+
|
|
53
|
+
subscribe(fn: Listener): () => void {
|
|
54
|
+
this.listeners.add(fn);
|
|
55
|
+
return () => this.listeners.delete(fn);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Declare that a `CameraTaskHost` exists.
|
|
60
|
+
*
|
|
61
|
+
* Without it nothing will ever settle the promise, so a request must fail
|
|
62
|
+
* IMMEDIATELY and say why. The alternative is a plugin awaiting forever,
|
|
63
|
+
* which is the worst failure of the set: no error, no timeout, no camera,
|
|
64
|
+
* and a conversation that simply stops.
|
|
65
|
+
*/
|
|
66
|
+
setHostMounted(mounted: boolean): void {
|
|
67
|
+
this.hostMounted = mounted;
|
|
68
|
+
if (!mounted) this.fail(cameraError('UNAVAILABLE', 'The camera surface was dismissed before the task completed.'));
|
|
69
|
+
this.notify();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
isHostMounted(): boolean { return this.hostMounted; }
|
|
73
|
+
|
|
74
|
+
/** Enqueue and hand back the promise the plugin awaits. */
|
|
75
|
+
run<T>(kind: CameraTask['kind'], opts: any): Promise<T> {
|
|
76
|
+
if (!this.hostMounted) {
|
|
77
|
+
return Promise.reject(cameraError(
|
|
78
|
+
'UNAVAILABLE',
|
|
79
|
+
'No camera surface is mounted in this app, so the camera cannot be shown. ' +
|
|
80
|
+
'The host must render <CameraTaskHost /> once, near the app root.',
|
|
81
|
+
));
|
|
82
|
+
}
|
|
83
|
+
if (this.task) {
|
|
84
|
+
return Promise.reject(cameraError(
|
|
85
|
+
'BUSY',
|
|
86
|
+
`The camera is already in use (${this.task.kind}). Only one camera task can run at a time.`,
|
|
87
|
+
));
|
|
88
|
+
}
|
|
89
|
+
return new Promise<T>((resolve, reject) => {
|
|
90
|
+
this.task = { kind, opts, resolve, reject } as unknown as CameraTask;
|
|
91
|
+
this.notify();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Settle the running task successfully and clear it. */
|
|
96
|
+
complete(value: any): void {
|
|
97
|
+
const t = this.task;
|
|
98
|
+
if (!t) return;
|
|
99
|
+
this.task = null;
|
|
100
|
+
this.notify();
|
|
101
|
+
t.resolve(value);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Settle the running task with a failure and clear it. */
|
|
105
|
+
fail(err: Error): void {
|
|
106
|
+
const t = this.task;
|
|
107
|
+
if (!t) return;
|
|
108
|
+
this.task = null;
|
|
109
|
+
this.notify();
|
|
110
|
+
t.reject(err);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The user backed out.
|
|
115
|
+
*
|
|
116
|
+
* A distinct code, because "the user chose not to" is not a malfunction and
|
|
117
|
+
* a guide should say something different about it than about a broken lens.
|
|
118
|
+
*/
|
|
119
|
+
cancel(): void {
|
|
120
|
+
this.fail(cameraError('CANCELLED', 'Cancelled — the camera was dismissed before anything was captured.'));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private notify(): void {
|
|
124
|
+
for (const fn of this.listeners) { try { fn(); } catch { /* a bad listener is not the broker's problem */ } }
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** One broker per app: there is one camera. */
|
|
129
|
+
export const cameraTasks = new CameraTaskBroker();
|
package/src/createBridge.ts
CHANGED
|
@@ -16,6 +16,8 @@ import * as ExpoSMS from 'expo-sms';
|
|
|
16
16
|
import * as ExpoLinking from 'expo-linking';
|
|
17
17
|
import { Platform } from 'react-native';
|
|
18
18
|
import * as Device from 'expo-device';
|
|
19
|
+
// The SDK's one reverse geocode — the same call native.maps.reverseGeocode makes.
|
|
20
|
+
import { reverseGeocode } from './maps';
|
|
19
21
|
|
|
20
22
|
import type { Bridge } from '@ateam-ai-mobile/plugin-runtime';
|
|
21
23
|
|
|
@@ -361,7 +363,7 @@ export function createBridge(connectorId: string, deviceId: string): Bridge {
|
|
|
361
363
|
accuracy: ExpoLocation.Accuracy.Balanced,
|
|
362
364
|
});
|
|
363
365
|
|
|
364
|
-
const
|
|
366
|
+
const geo = await reverseGeocode({
|
|
365
367
|
latitude: location.coords.latitude,
|
|
366
368
|
longitude: location.coords.longitude,
|
|
367
369
|
});
|