@aippy/runtime 0.2.4-dev.7 โ 0.2.4-dev.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/dist/core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as d, A as f, C as u, E as A, R as _, b as m, c as R, p as g } from "../runtime-
|
|
1
|
+
import { a as d, A as f, C as u, E as A, R as _, b as m, c as R, p as g } from "../runtime-DjBdOttl.js";
|
|
2
2
|
const s = {
|
|
3
3
|
mode: "development",
|
|
4
4
|
debug: !1,
|
|
@@ -22,7 +22,7 @@ function c(e) {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
const r = "0.2.4-dev.
|
|
25
|
+
const r = "0.2.4-dev.8", a = {
|
|
26
26
|
version: r
|
|
27
27
|
}, i = a.version, t = "@aippy/runtime";
|
|
28
28
|
function p() {
|
package/dist/core/runtime.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare class AippyRuntime {
|
|
|
39
39
|
receiveChannel: ReceiveChannel;
|
|
40
40
|
private seq;
|
|
41
41
|
private motionListeners;
|
|
42
|
+
private noListenersWarned;
|
|
42
43
|
/**
|
|
43
44
|
* Unified native data receiver - Routes to specific handlers based on message type
|
|
44
45
|
* Called by native code via: window.aippyRuntime.receiveMessage(message)
|
package/dist/device/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var v = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var w = (a, t, e) =>
|
|
4
|
-
import { c as s, b as
|
|
2
|
+
var E = (a, t, e) => t in a ? v(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var w = (a, t, e) => E(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { c as s, b as f } from "../runtime-DjBdOttl.js";
|
|
5
5
|
class P {
|
|
6
6
|
constructor() {
|
|
7
7
|
w(this, "stream", null);
|
|
@@ -72,7 +72,7 @@ class P {
|
|
|
72
72
|
this.stream && (this.stream.getTracks().forEach((t) => t.stop()), this.stream = null);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const D = new P();
|
|
76
76
|
class O {
|
|
77
77
|
/**
|
|
78
78
|
* Check if geolocation is supported
|
|
@@ -198,8 +198,7 @@ async function y() {
|
|
|
198
198
|
}
|
|
199
199
|
function S(a) {
|
|
200
200
|
console.log("๐ง [Aippy Sensors] watchMotionNative - Setting up native bridge listener");
|
|
201
|
-
const t =
|
|
202
|
-
console.log("๐ฆ [Aippy Sensors] watchMotionNative - Received native data:", e);
|
|
201
|
+
const t = f.addMotionListener((e) => {
|
|
203
202
|
const i = {
|
|
204
203
|
gravity: {
|
|
205
204
|
x: e.gravity?.x ?? 0,
|
|
@@ -223,7 +222,7 @@ function S(a) {
|
|
|
223
222
|
},
|
|
224
223
|
timestamp: Date.now()
|
|
225
224
|
};
|
|
226
|
-
|
|
225
|
+
a(i);
|
|
227
226
|
});
|
|
228
227
|
return console.log("โ
[Aippy Sensors] watchMotionNative - Listener setup complete"), t;
|
|
229
228
|
}
|
|
@@ -289,7 +288,7 @@ function N(a, t = !0) {
|
|
|
289
288
|
e = !1, window.removeEventListener("devicemotion", o), i && (i(), i = null);
|
|
290
289
|
};
|
|
291
290
|
}
|
|
292
|
-
function
|
|
291
|
+
function M(a, t = !0) {
|
|
293
292
|
const e = h();
|
|
294
293
|
return console.log(`๐ฏ [Aippy Sensors] watchMotion - Using ${e ? "NATIVE BRIDGE" : "WEB API"} mode`), e ? (console.log("๐ฑ [Aippy Sensors] Starting native bridge motion listener"), S(a)) : (console.log("๐ [Aippy Sensors] Starting Web API motion listener (may require permission)"), N(a, t));
|
|
295
294
|
}
|
|
@@ -508,8 +507,8 @@ class R {
|
|
|
508
507
|
});
|
|
509
508
|
}
|
|
510
509
|
}
|
|
511
|
-
const
|
|
512
|
-
function
|
|
510
|
+
const k = new R();
|
|
511
|
+
function T(a) {
|
|
513
512
|
return new Promise((t) => {
|
|
514
513
|
if ("vibrate" in navigator)
|
|
515
514
|
navigator.vibrate(a), t();
|
|
@@ -528,15 +527,15 @@ export {
|
|
|
528
527
|
R as FileSystemAPI,
|
|
529
528
|
O as GeolocationAPI,
|
|
530
529
|
A as SensorsAPI,
|
|
531
|
-
|
|
532
|
-
|
|
530
|
+
D as camera,
|
|
531
|
+
k as fileSystem,
|
|
533
532
|
U as geolocation,
|
|
534
533
|
h as hasNativeBridge,
|
|
535
534
|
m as isMotionSupported,
|
|
536
535
|
g as isOrientationSupported,
|
|
537
536
|
y as requestMotionPermission,
|
|
538
537
|
x as sensors,
|
|
539
|
-
|
|
540
|
-
|
|
538
|
+
T as vibrate,
|
|
539
|
+
M as watchMotion,
|
|
541
540
|
L as watchOrientation
|
|
542
541
|
};
|
package/dist/index/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_CONFIG as o, SDK_NAME as t, VERSION as r, getConfigFromEnv as i, getVersionInfo as s, mergeConfig as n } from "../core/index.js";
|
|
2
|
-
import { a as m, A as c, C as d, E as f, R as u, b as l, c as A, p as S } from "../runtime-
|
|
2
|
+
import { a as m, A as c, C as d, E as f, R as u, b as l, c as A, p as S } from "../runtime-DjBdOttl.js";
|
|
3
3
|
import { CameraAPI as C, FileSystemAPI as R, GeolocationAPI as x, SensorsAPI as M, camera as P, fileSystem as I, geolocation as g, hasNativeBridge as y, isMotionSupported as O, isOrientationSupported as b, requestMotionPermission as v, sensors as D, vibrate as h, watchMotion as w, watchOrientation as F } from "../device/index.js";
|
|
4
4
|
import { c as T, a as V, P as _, b as k, p as G, d as H } from "../pwa-8DGmPqLV.js";
|
|
5
5
|
import { a as q, b as B } from "../useTweaks-QxMRmg7i.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var u = Object.defineProperty;
|
|
2
|
-
var m = (o, e,
|
|
3
|
-
var
|
|
2
|
+
var m = (o, e, n) => e in o ? u(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
|
|
3
|
+
var r = (o, e, n) => m(o, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
class d extends Error {
|
|
5
|
-
constructor(
|
|
6
|
-
super(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.name = "AippyRuntimeError", this.code = i, this.context =
|
|
5
|
+
constructor(n, i = "AIPPY_ERROR", t) {
|
|
6
|
+
super(n);
|
|
7
|
+
r(this, "code");
|
|
8
|
+
r(this, "context");
|
|
9
|
+
this.name = "AippyRuntimeError", this.code = i, this.context = t;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
const R = {
|
|
@@ -16,12 +16,12 @@ const R = {
|
|
|
16
16
|
NETWORK_ERROR: "NETWORK_ERROR",
|
|
17
17
|
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
18
18
|
};
|
|
19
|
-
function
|
|
20
|
-
return new d(o, R[e],
|
|
19
|
+
function g(o, e = "UNKNOWN_ERROR", n) {
|
|
20
|
+
return new d(o, R[e], n);
|
|
21
21
|
}
|
|
22
22
|
class a {
|
|
23
23
|
constructor(e) {
|
|
24
|
-
|
|
24
|
+
r(this, "cancelled", !1);
|
|
25
25
|
this.cancelFn = e;
|
|
26
26
|
}
|
|
27
27
|
cancel() {
|
|
@@ -31,28 +31,28 @@ class a {
|
|
|
31
31
|
return this.cancelled;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class f {
|
|
35
35
|
constructor() {
|
|
36
|
-
|
|
36
|
+
r(this, "listeners", /* @__PURE__ */ new Map());
|
|
37
37
|
}
|
|
38
|
-
addEventListener(e,
|
|
39
|
-
this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(
|
|
38
|
+
addEventListener(e, n) {
|
|
39
|
+
this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(n);
|
|
40
40
|
}
|
|
41
|
-
removeEventListener(e,
|
|
41
|
+
removeEventListener(e, n) {
|
|
42
42
|
const i = this.listeners.get(e);
|
|
43
43
|
if (i) {
|
|
44
|
-
const
|
|
45
|
-
|
|
44
|
+
const t = i.indexOf(n);
|
|
45
|
+
t > -1 && i.splice(t, 1);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
emit(e,
|
|
48
|
+
emit(e, n) {
|
|
49
49
|
const i = this.listeners.get(e);
|
|
50
|
-
i && i.forEach((
|
|
50
|
+
i && i.forEach((t) => t(n));
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
class
|
|
53
|
+
class y {
|
|
54
54
|
constructor() {
|
|
55
|
-
|
|
55
|
+
r(this, "emitter", new f());
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Emit a message to subscribers
|
|
@@ -63,9 +63,9 @@ class f {
|
|
|
63
63
|
/**
|
|
64
64
|
* Subscribe to messages on a specific endpoint
|
|
65
65
|
*/
|
|
66
|
-
subscribe(e,
|
|
67
|
-
const i = (
|
|
68
|
-
t
|
|
66
|
+
subscribe(e, n) {
|
|
67
|
+
const i = (t) => {
|
|
68
|
+
n(t);
|
|
69
69
|
};
|
|
70
70
|
return this.emitter.addEventListener(e, i), new a(() => {
|
|
71
71
|
this.emitter.removeEventListener(e, i);
|
|
@@ -74,18 +74,19 @@ class f {
|
|
|
74
74
|
/**
|
|
75
75
|
* Subscribe to a single message (auto-unsubscribe after first message)
|
|
76
76
|
*/
|
|
77
|
-
once(e,
|
|
78
|
-
const i = this.subscribe(e, (
|
|
79
|
-
i.cancel(), t
|
|
77
|
+
once(e, n) {
|
|
78
|
+
const i = this.subscribe(e, (t) => {
|
|
79
|
+
i.cancel(), n(t);
|
|
80
80
|
});
|
|
81
81
|
return i;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
class h {
|
|
85
85
|
constructor() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
r(this, "receiveChannel", new y());
|
|
87
|
+
r(this, "seq", 0);
|
|
88
|
+
r(this, "motionListeners", []);
|
|
89
|
+
r(this, "noListenersWarned", !1);
|
|
89
90
|
}
|
|
90
91
|
/**
|
|
91
92
|
* Unified native data receiver - Routes to specific handlers based on message type
|
|
@@ -115,10 +116,10 @@ class h {
|
|
|
115
116
|
isTweaksMessage(e) {
|
|
116
117
|
if (typeof e != "object" || e === null || "endpoint" in e || "payload" in e)
|
|
117
118
|
return !1;
|
|
118
|
-
const
|
|
119
|
-
return
|
|
120
|
-
const
|
|
121
|
-
return typeof
|
|
119
|
+
const n = Object.keys(e);
|
|
120
|
+
return n.length === 0 ? !1 : n.some((t) => {
|
|
121
|
+
const c = e[t];
|
|
122
|
+
return typeof c == "object" && c !== null && "value" in c;
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
/**
|
|
@@ -128,37 +129,37 @@ class h {
|
|
|
128
129
|
* @param callback - Callback to handle received data
|
|
129
130
|
* @returns Cancellable subscription
|
|
130
131
|
*/
|
|
131
|
-
createSubscription(e,
|
|
132
|
-
const
|
|
133
|
-
command:
|
|
132
|
+
createSubscription(e, n, i) {
|
|
133
|
+
const t = (this.seq++).toString(), c = {
|
|
134
|
+
command: n.command,
|
|
134
135
|
parameters: {
|
|
135
|
-
type:
|
|
136
|
+
type: n.type,
|
|
136
137
|
action: "subscribe",
|
|
137
|
-
endpoint:
|
|
138
|
+
endpoint: t
|
|
138
139
|
}
|
|
139
140
|
};
|
|
140
|
-
console.log("๐จ [Aippy Runtime] Creating subscription with message:", JSON.stringify(
|
|
141
|
-
const
|
|
142
|
-
if (console.log(`๐ฌ [Aippy Runtime] Received data on endpoint ${
|
|
141
|
+
console.log("๐จ [Aippy Runtime] Creating subscription with message:", JSON.stringify(c, null, 2));
|
|
142
|
+
const l = this.receiveChannel.subscribe(t, (s) => {
|
|
143
|
+
if (console.log(`๐ฌ [Aippy Runtime] Received data on endpoint ${t}:`, s), s.error !== void 0) {
|
|
143
144
|
console.warn("โ ๏ธ [Aippy Runtime] Received error, skipping:", s.error);
|
|
144
145
|
return;
|
|
145
146
|
}
|
|
146
147
|
i(s);
|
|
147
148
|
});
|
|
148
149
|
try {
|
|
149
|
-
console.log("๐ค [Aippy Runtime] Sending postMessage to native iOS:",
|
|
150
|
+
console.log("๐ค [Aippy Runtime] Sending postMessage to native iOS:", c), e.postMessage(c), console.log("โ
[Aippy Runtime] postMessage sent successfully");
|
|
150
151
|
} catch (s) {
|
|
151
152
|
console.error("โ [Aippy Runtime] Failed to send postMessage:", s);
|
|
152
153
|
}
|
|
153
154
|
return new a(() => {
|
|
154
|
-
console.log(`๐ [Aippy Runtime] Unsubscribing from endpoint ${
|
|
155
|
+
console.log(`๐ [Aippy Runtime] Unsubscribing from endpoint ${t}`), l.cancel();
|
|
155
156
|
try {
|
|
156
157
|
const s = {
|
|
157
|
-
command:
|
|
158
|
+
command: n.command,
|
|
158
159
|
parameters: {
|
|
159
|
-
type:
|
|
160
|
+
type: n.type,
|
|
160
161
|
action: "unsubscribe",
|
|
161
|
-
endpoint:
|
|
162
|
+
endpoint: t
|
|
162
163
|
}
|
|
163
164
|
};
|
|
164
165
|
e.postMessage(s), console.log("โ
[Aippy Runtime] Unsubscribe message sent:", s);
|
|
@@ -174,27 +175,27 @@ class h {
|
|
|
174
175
|
*/
|
|
175
176
|
addMotionListener(e) {
|
|
176
177
|
console.log("๐ฌ [Aippy Runtime] addMotionListener called"), this.motionListeners.push(e), console.log(`๐ [Aippy Runtime] Total motion listeners: ${this.motionListeners.length}`);
|
|
177
|
-
const
|
|
178
|
-
if (!
|
|
178
|
+
const n = window.webkit?.messageHandlers?.aippyListener;
|
|
179
|
+
if (!n)
|
|
179
180
|
return console.warn("โ ๏ธ [Aippy Runtime] No webkit message handler found, using fallback mode"), () => {
|
|
180
|
-
const
|
|
181
|
-
|
|
181
|
+
const t = this.motionListeners.indexOf(e);
|
|
182
|
+
t > -1 && this.motionListeners.splice(t, 1);
|
|
182
183
|
};
|
|
183
184
|
console.log("โ
[Aippy Runtime] Webkit handler found, creating subscription");
|
|
184
185
|
const i = this.createSubscription(
|
|
185
|
-
|
|
186
|
+
n,
|
|
186
187
|
{
|
|
187
188
|
command: "navigator.motion",
|
|
188
189
|
type: "motion"
|
|
189
190
|
},
|
|
190
|
-
(
|
|
191
|
-
console.log("๐ฅ [Aippy Runtime] Received motion data from native:",
|
|
191
|
+
(t) => {
|
|
192
|
+
console.log("๐ฅ [Aippy Runtime] Received motion data from native:", t), t.motion && e(t.motion);
|
|
192
193
|
}
|
|
193
194
|
);
|
|
194
195
|
return () => {
|
|
195
196
|
console.log("๐งน [Aippy Runtime] Cleaning up motion listener"), i.cancel();
|
|
196
|
-
const
|
|
197
|
-
|
|
197
|
+
const t = this.motionListeners.indexOf(e);
|
|
198
|
+
t > -1 && this.motionListeners.splice(t, 1);
|
|
198
199
|
};
|
|
199
200
|
}
|
|
200
201
|
/**
|
|
@@ -203,22 +204,22 @@ class h {
|
|
|
203
204
|
* @param data - Motion data from iOS
|
|
204
205
|
*/
|
|
205
206
|
broadcastMotionData(e) {
|
|
206
|
-
if (
|
|
207
|
-
console.warn("โ ๏ธ [Aippy Runtime] No motion listeners to broadcast to");
|
|
207
|
+
if (this.motionListeners.length === 0) {
|
|
208
|
+
this.noListenersWarned || (console.warn("โ ๏ธ [Aippy Runtime] No motion listeners to broadcast to"), this.noListenersWarned = !0);
|
|
208
209
|
return;
|
|
209
210
|
}
|
|
210
|
-
const
|
|
211
|
-
|
|
211
|
+
const n = e.motion || e;
|
|
212
|
+
this.motionListeners.forEach((i) => {
|
|
212
213
|
try {
|
|
213
|
-
|
|
214
|
-
} catch (
|
|
215
|
-
console.error(
|
|
214
|
+
i(n);
|
|
215
|
+
} catch (t) {
|
|
216
|
+
console.error("โ ๏ธ [Aippy Runtime] Error in motion listener:", t);
|
|
216
217
|
}
|
|
217
218
|
});
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
|
-
function
|
|
221
|
-
if (
|
|
221
|
+
function w(o) {
|
|
222
|
+
if (!o || typeof o != "object") {
|
|
222
223
|
console.warn("โ ๏ธ [Aippy Runtime] Invalid motion data type:", typeof o);
|
|
223
224
|
return;
|
|
224
225
|
}
|
|
@@ -226,17 +227,17 @@ function g(o) {
|
|
|
226
227
|
console.warn("โ ๏ธ [Aippy Runtime] Motion data missing valid motion field");
|
|
227
228
|
return;
|
|
228
229
|
}
|
|
229
|
-
|
|
230
|
+
p.broadcastMotionData(o);
|
|
230
231
|
}
|
|
231
|
-
const
|
|
232
|
-
typeof window < "u" && (window.aippyRuntime =
|
|
232
|
+
const p = new h();
|
|
233
|
+
typeof window < "u" && (window.aippyRuntime = p, window.processMotionData = w);
|
|
233
234
|
export {
|
|
234
235
|
d as A,
|
|
235
236
|
a as C,
|
|
236
237
|
R as E,
|
|
237
|
-
|
|
238
|
+
y as R,
|
|
238
239
|
h as a,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
p as b,
|
|
241
|
+
g as c,
|
|
242
|
+
w as p
|
|
242
243
|
};
|