@aippy/runtime 0.2.4-dev.6 → 0.2.4-dev.7
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 +2 -2
- package/dist/core/runtime.d.ts +4 -8
- package/dist/device/index.js +23 -20
- package/dist/index/index.js +1 -1
- package/dist/{runtime-DgUMQgA3.js → runtime-BdIpqmWa.js} +112 -108
- package/package.json +1 -1
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-BdIpqmWa.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.7", a = {
|
|
26
26
|
version: r
|
|
27
27
|
}, i = a.version, t = "@aippy/runtime";
|
|
28
28
|
function p() {
|
package/dist/core/runtime.d.ts
CHANGED
|
@@ -44,13 +44,13 @@ export declare class AippyRuntime {
|
|
|
44
44
|
* Called by native code via: window.aippyRuntime.receiveMessage(message)
|
|
45
45
|
*
|
|
46
46
|
* Supports two message formats:
|
|
47
|
-
* 1. Motion: { endpoint: "0",
|
|
47
|
+
* 1. Motion: { command: "navigator.motion", endpoint: "0", data: { motion: {...} } }
|
|
48
48
|
* 2. Tweaks: { "tweakKey": { value: ..., type: ... }, ... }
|
|
49
49
|
*/
|
|
50
50
|
receiveMessage(message: any): Promise<void>;
|
|
51
51
|
/**
|
|
52
52
|
* Check if message is Motion format
|
|
53
|
-
* Motion: { endpoint: string,
|
|
53
|
+
* Motion: { command: "navigator.motion", endpoint: string, data: object }
|
|
54
54
|
*/
|
|
55
55
|
private isMotionMessage;
|
|
56
56
|
/**
|
|
@@ -60,16 +60,12 @@ export declare class AippyRuntime {
|
|
|
60
60
|
private isTweaksMessage;
|
|
61
61
|
/**
|
|
62
62
|
* Create a subscription to native events
|
|
63
|
-
* @param handler - WebKit message handler (e.g.,
|
|
64
|
-
* @param subscribePayload - Subscription parameters (e.g., { type: "motion" })
|
|
63
|
+
* @param handler - WebKit message handler (e.g., aippyListener)
|
|
64
|
+
* @param subscribePayload - Subscription parameters (e.g., { command: "navigator.motion", type: "motion" })
|
|
65
65
|
* @param callback - Callback to handle received data
|
|
66
66
|
* @returns Cancellable subscription
|
|
67
67
|
*/
|
|
68
68
|
createSubscription(handler: any, subscribePayload: any, callback: (data: any) => void): Cancellable;
|
|
69
|
-
/**
|
|
70
|
-
* Make a subscription message with unique endpoint
|
|
71
|
-
*/
|
|
72
|
-
private makeSubscriptionMessage;
|
|
73
69
|
/**
|
|
74
70
|
* Add motion listener (convenience method)
|
|
75
71
|
* @param callback - Callback to handle motion data
|
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 f = (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) => f(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { c as s, b as E } from "../runtime-BdIpqmWa.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 M = new P();
|
|
76
76
|
class O {
|
|
77
77
|
/**
|
|
78
78
|
* Check if geolocation is supported
|
|
@@ -197,7 +197,9 @@ async function y() {
|
|
|
197
197
|
return console.log("✅ [Aippy Sensors] No permission needed (granted by default)"), !0;
|
|
198
198
|
}
|
|
199
199
|
function S(a) {
|
|
200
|
-
|
|
200
|
+
console.log("🔧 [Aippy Sensors] watchMotionNative - Setting up native bridge listener");
|
|
201
|
+
const t = E.addMotionListener((e) => {
|
|
202
|
+
console.log("📦 [Aippy Sensors] watchMotionNative - Received native data:", e);
|
|
201
203
|
const i = {
|
|
202
204
|
gravity: {
|
|
203
205
|
x: e.gravity?.x ?? 0,
|
|
@@ -221,8 +223,9 @@ function S(a) {
|
|
|
221
223
|
},
|
|
222
224
|
timestamp: Date.now()
|
|
223
225
|
};
|
|
224
|
-
a(i);
|
|
226
|
+
console.log("✨ [Aippy Sensors] watchMotionNative - Transformed data:", i), a(i);
|
|
225
227
|
});
|
|
228
|
+
return console.log("✅ [Aippy Sensors] watchMotionNative - Listener setup complete"), t;
|
|
226
229
|
}
|
|
227
230
|
function N(a, t = !0) {
|
|
228
231
|
if (!m())
|
|
@@ -286,11 +289,11 @@ function N(a, t = !0) {
|
|
|
286
289
|
e = !1, window.removeEventListener("devicemotion", o), i && (i(), i = null);
|
|
287
290
|
};
|
|
288
291
|
}
|
|
289
|
-
function
|
|
292
|
+
function D(a, t = !0) {
|
|
290
293
|
const e = h();
|
|
291
294
|
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));
|
|
292
295
|
}
|
|
293
|
-
function
|
|
296
|
+
function L(a) {
|
|
294
297
|
if (!g())
|
|
295
298
|
throw s("Device orientation API is not supported", "NOT_SUPPORTED");
|
|
296
299
|
const t = (e) => {
|
|
@@ -306,7 +309,7 @@ function M(a) {
|
|
|
306
309
|
window.removeEventListener("deviceorientation", t);
|
|
307
310
|
};
|
|
308
311
|
}
|
|
309
|
-
class
|
|
312
|
+
class A {
|
|
310
313
|
/**
|
|
311
314
|
* Check if device orientation is supported
|
|
312
315
|
*/
|
|
@@ -404,8 +407,8 @@ class R {
|
|
|
404
407
|
return y();
|
|
405
408
|
}
|
|
406
409
|
}
|
|
407
|
-
const x = new
|
|
408
|
-
class
|
|
410
|
+
const x = new A();
|
|
411
|
+
class R {
|
|
409
412
|
/**
|
|
410
413
|
* Check if file system access is supported
|
|
411
414
|
*/
|
|
@@ -505,8 +508,8 @@ class A {
|
|
|
505
508
|
});
|
|
506
509
|
}
|
|
507
510
|
}
|
|
508
|
-
const
|
|
509
|
-
function
|
|
511
|
+
const T = new R();
|
|
512
|
+
function k(a) {
|
|
510
513
|
return new Promise((t) => {
|
|
511
514
|
if ("vibrate" in navigator)
|
|
512
515
|
navigator.vibrate(a), t();
|
|
@@ -522,18 +525,18 @@ function T(a) {
|
|
|
522
525
|
}
|
|
523
526
|
export {
|
|
524
527
|
P as CameraAPI,
|
|
525
|
-
|
|
528
|
+
R as FileSystemAPI,
|
|
526
529
|
O as GeolocationAPI,
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
+
A as SensorsAPI,
|
|
531
|
+
M as camera,
|
|
532
|
+
T as fileSystem,
|
|
530
533
|
U as geolocation,
|
|
531
534
|
h as hasNativeBridge,
|
|
532
535
|
m as isMotionSupported,
|
|
533
536
|
g as isOrientationSupported,
|
|
534
537
|
y as requestMotionPermission,
|
|
535
538
|
x as sensors,
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
+
k as vibrate,
|
|
540
|
+
D as watchMotion,
|
|
541
|
+
L as watchOrientation
|
|
539
542
|
};
|
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-BdIpqmWa.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,27 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
5
|
-
constructor(
|
|
6
|
-
super(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.name = "AippyRuntimeError", this.code =
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var m = (o, e, t) => e in o ? u(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var c = (o, e, t) => m(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
class d extends Error {
|
|
5
|
+
constructor(t, i = "AIPPY_ERROR", n) {
|
|
6
|
+
super(t);
|
|
7
|
+
c(this, "code");
|
|
8
|
+
c(this, "context");
|
|
9
|
+
this.name = "AippyRuntimeError", this.code = i, this.context = n;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const R = {
|
|
13
13
|
NOT_SUPPORTED: "NOT_SUPPORTED",
|
|
14
14
|
PERMISSION_DENIED: "PERMISSION_DENIED",
|
|
15
15
|
INVALID_CONFIG: "INVALID_CONFIG",
|
|
16
16
|
NETWORK_ERROR: "NETWORK_ERROR",
|
|
17
17
|
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
18
18
|
};
|
|
19
|
-
function
|
|
20
|
-
return new
|
|
19
|
+
function w(o, e = "UNKNOWN_ERROR", t) {
|
|
20
|
+
return new d(o, R[e], t);
|
|
21
21
|
}
|
|
22
|
-
class
|
|
22
|
+
class a {
|
|
23
23
|
constructor(e) {
|
|
24
|
-
|
|
24
|
+
c(this, "cancelled", !1);
|
|
25
25
|
this.cancelFn = e;
|
|
26
26
|
}
|
|
27
27
|
cancel() {
|
|
@@ -31,28 +31,28 @@ class l {
|
|
|
31
31
|
return this.cancelled;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class y {
|
|
35
35
|
constructor() {
|
|
36
|
-
|
|
36
|
+
c(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, t) {
|
|
39
|
+
this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(t);
|
|
40
40
|
}
|
|
41
|
-
removeEventListener(e,
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
|
|
41
|
+
removeEventListener(e, t) {
|
|
42
|
+
const i = this.listeners.get(e);
|
|
43
|
+
if (i) {
|
|
44
|
+
const n = i.indexOf(t);
|
|
45
|
+
n > -1 && i.splice(n, 1);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
emit(e,
|
|
49
|
-
const
|
|
50
|
-
|
|
48
|
+
emit(e, t) {
|
|
49
|
+
const i = this.listeners.get(e);
|
|
50
|
+
i && i.forEach((n) => n(t));
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
class
|
|
53
|
+
class f {
|
|
54
54
|
constructor() {
|
|
55
|
-
|
|
55
|
+
c(this, "emitter", new y());
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Emit a message to subscribers
|
|
@@ -63,47 +63,50 @@ class y {
|
|
|
63
63
|
/**
|
|
64
64
|
* Subscribe to messages on a specific endpoint
|
|
65
65
|
*/
|
|
66
|
-
subscribe(e,
|
|
67
|
-
const
|
|
68
|
-
n
|
|
66
|
+
subscribe(e, t) {
|
|
67
|
+
const i = (n) => {
|
|
68
|
+
t(n);
|
|
69
69
|
};
|
|
70
|
-
return this.emitter.addEventListener(e,
|
|
71
|
-
this.emitter.removeEventListener(e,
|
|
70
|
+
return this.emitter.addEventListener(e, i), new a(() => {
|
|
71
|
+
this.emitter.removeEventListener(e, i);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Subscribe to a single message (auto-unsubscribe after first message)
|
|
76
76
|
*/
|
|
77
|
-
once(e,
|
|
78
|
-
const
|
|
79
|
-
|
|
77
|
+
once(e, t) {
|
|
78
|
+
const i = this.subscribe(e, (n) => {
|
|
79
|
+
i.cancel(), t(n);
|
|
80
80
|
});
|
|
81
|
-
return
|
|
81
|
+
return i;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class h {
|
|
85
85
|
constructor() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
c(this, "receiveChannel", new f());
|
|
87
|
+
c(this, "seq", 0);
|
|
88
|
+
c(this, "motionListeners", []);
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Unified native data receiver - Routes to specific handlers based on message type
|
|
92
92
|
* Called by native code via: window.aippyRuntime.receiveMessage(message)
|
|
93
93
|
*
|
|
94
94
|
* Supports two message formats:
|
|
95
|
-
* 1. Motion: { endpoint: "0",
|
|
95
|
+
* 1. Motion: { command: "navigator.motion", endpoint: "0", data: { motion: {...} } }
|
|
96
96
|
* 2. Tweaks: { "tweakKey": { value: ..., type: ... }, ... }
|
|
97
97
|
*/
|
|
98
98
|
receiveMessage(e) {
|
|
99
|
-
return console.log("📩 [Aippy Runtime] receiveMessage called with:", e), !e || typeof e != "object" ? (console.warn("⚠️ [Aippy Runtime] Invalid message type:", typeof e), Promise.resolve()) : this.isMotionMessage(e) ? (console.log("✅ [Aippy Runtime] Detected MOTION message format, emitting to receive channel"), this.receiveChannel.emit(
|
|
99
|
+
return console.log("📩 [Aippy Runtime] receiveMessage called with:", e), !e || typeof e != "object" ? (console.warn("⚠️ [Aippy Runtime] Invalid message type:", typeof e), Promise.resolve()) : this.isMotionMessage(e) ? (console.log("✅ [Aippy Runtime] Detected MOTION message format, emitting to receive channel"), this.receiveChannel.emit({
|
|
100
|
+
endpoint: e.endpoint,
|
|
101
|
+
payload: e.data
|
|
102
|
+
}), Promise.resolve()) : this.isTweaksMessage(e) ? (console.log("✅ [Aippy Runtime] Detected TWEAKS message format, calling processNativeData"), typeof window < "u" && window.processNativeData && window.processNativeData(e), Promise.resolve()) : (console.warn("⚠️ [Aippy Runtime] Unknown message format:", e), Promise.resolve());
|
|
100
103
|
}
|
|
101
104
|
/**
|
|
102
105
|
* Check if message is Motion format
|
|
103
|
-
* Motion: { endpoint: string,
|
|
106
|
+
* Motion: { command: "navigator.motion", endpoint: string, data: object }
|
|
104
107
|
*/
|
|
105
108
|
isMotionMessage(e) {
|
|
106
|
-
return typeof e == "object" && "endpoint" in e && typeof e.endpoint == "string" && "
|
|
109
|
+
return typeof e == "object" && "command" in e && e.command === "navigator.motion" && "endpoint" in e && typeof e.endpoint == "string" && "data" in e && typeof e.data == "object" && e.data !== null;
|
|
107
110
|
}
|
|
108
111
|
/**
|
|
109
112
|
* Check if message is Tweaks format
|
|
@@ -112,57 +115,58 @@ class f {
|
|
|
112
115
|
isTweaksMessage(e) {
|
|
113
116
|
if (typeof e != "object" || e === null || "endpoint" in e || "payload" in e)
|
|
114
117
|
return !1;
|
|
115
|
-
const
|
|
116
|
-
return
|
|
117
|
-
const
|
|
118
|
-
return typeof
|
|
118
|
+
const t = Object.keys(e);
|
|
119
|
+
return t.length === 0 ? !1 : t.some((n) => {
|
|
120
|
+
const r = e[n];
|
|
121
|
+
return typeof r == "object" && r !== null && "value" in r;
|
|
119
122
|
});
|
|
120
123
|
}
|
|
121
124
|
/**
|
|
122
125
|
* Create a subscription to native events
|
|
123
|
-
* @param handler - WebKit message handler (e.g.,
|
|
124
|
-
* @param subscribePayload - Subscription parameters (e.g., { type: "motion" })
|
|
126
|
+
* @param handler - WebKit message handler (e.g., aippyListener)
|
|
127
|
+
* @param subscribePayload - Subscription parameters (e.g., { command: "navigator.motion", type: "motion" })
|
|
125
128
|
* @param callback - Callback to handle received data
|
|
126
129
|
* @returns Cancellable subscription
|
|
127
130
|
*/
|
|
128
|
-
createSubscription(e,
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
createSubscription(e, t, i) {
|
|
132
|
+
const n = (this.seq++).toString(), r = {
|
|
133
|
+
command: t.command,
|
|
134
|
+
parameters: {
|
|
135
|
+
type: t.type,
|
|
136
|
+
action: "subscribe",
|
|
137
|
+
endpoint: n
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
console.log("📨 [Aippy Runtime] Creating subscription with message:", JSON.stringify(r, null, 2));
|
|
141
|
+
const p = this.receiveChannel.subscribe(n, (s) => {
|
|
142
|
+
if (console.log(`📬 [Aippy Runtime] Received data on endpoint ${n}:`, s), s.error !== void 0) {
|
|
143
|
+
console.warn("⚠️ [Aippy Runtime] Received error, skipping:", s.error);
|
|
134
144
|
return;
|
|
135
145
|
}
|
|
136
|
-
|
|
146
|
+
i(s);
|
|
137
147
|
});
|
|
138
148
|
try {
|
|
139
|
-
console.log("📤 [Aippy Runtime] Sending postMessage to native iOS:",
|
|
140
|
-
} catch (
|
|
141
|
-
console.error("❌ [Aippy Runtime] Failed to send postMessage:",
|
|
149
|
+
console.log("📤 [Aippy Runtime] Sending postMessage to native iOS:", r), e.postMessage(r), console.log("✅ [Aippy Runtime] postMessage sent successfully");
|
|
150
|
+
} catch (s) {
|
|
151
|
+
console.error("❌ [Aippy Runtime] Failed to send postMessage:", s);
|
|
142
152
|
}
|
|
143
|
-
return new
|
|
144
|
-
console.log(`🔌 [Aippy Runtime] Unsubscribing from endpoint ${
|
|
153
|
+
return new a(() => {
|
|
154
|
+
console.log(`🔌 [Aippy Runtime] Unsubscribing from endpoint ${n}`), p.cancel();
|
|
145
155
|
try {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
156
|
+
const s = {
|
|
157
|
+
command: t.command,
|
|
158
|
+
parameters: {
|
|
159
|
+
type: t.type,
|
|
160
|
+
action: "unsubscribe",
|
|
161
|
+
endpoint: n
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
e.postMessage(s), console.log("✅ [Aippy Runtime] Unsubscribe message sent:", s);
|
|
165
|
+
} catch (s) {
|
|
166
|
+
console.error("❌ [Aippy Runtime] Failed to send unsubscribe message:", s);
|
|
152
167
|
}
|
|
153
168
|
});
|
|
154
169
|
}
|
|
155
|
-
/**
|
|
156
|
-
* Make a subscription message with unique endpoint
|
|
157
|
-
*/
|
|
158
|
-
makeSubscriptionMessage(e) {
|
|
159
|
-
return {
|
|
160
|
-
endpoint: (this.seq++).toString(),
|
|
161
|
-
payload: {
|
|
162
|
-
subscribe: e
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
170
|
/**
|
|
167
171
|
* Add motion listener (convenience method)
|
|
168
172
|
* @param callback - Callback to handle motion data
|
|
@@ -170,27 +174,27 @@ class f {
|
|
|
170
174
|
*/
|
|
171
175
|
addMotionListener(e) {
|
|
172
176
|
console.log("🎬 [Aippy Runtime] addMotionListener called"), this.motionListeners.push(e), console.log(`📝 [Aippy Runtime] Total motion listeners: ${this.motionListeners.length}`);
|
|
173
|
-
const
|
|
174
|
-
if (!
|
|
177
|
+
const t = window.webkit?.messageHandlers?.aippyListener;
|
|
178
|
+
if (!t)
|
|
175
179
|
return console.warn("⚠️ [Aippy Runtime] No webkit message handler found, using fallback mode"), () => {
|
|
176
|
-
const
|
|
177
|
-
|
|
180
|
+
const n = this.motionListeners.indexOf(e);
|
|
181
|
+
n > -1 && this.motionListeners.splice(n, 1);
|
|
178
182
|
};
|
|
179
183
|
console.log("✅ [Aippy Runtime] Webkit handler found, creating subscription");
|
|
180
|
-
const
|
|
181
|
-
|
|
184
|
+
const i = this.createSubscription(
|
|
185
|
+
t,
|
|
182
186
|
{
|
|
183
187
|
command: "navigator.motion",
|
|
184
188
|
type: "motion"
|
|
185
189
|
},
|
|
186
|
-
(
|
|
187
|
-
console.log("📥 [Aippy Runtime] Received motion data from native:",
|
|
190
|
+
(n) => {
|
|
191
|
+
console.log("📥 [Aippy Runtime] Received motion data from native:", n), n.motion && e(n.motion);
|
|
188
192
|
}
|
|
189
193
|
);
|
|
190
194
|
return () => {
|
|
191
|
-
console.log("🧹 [Aippy Runtime] Cleaning up motion listener"),
|
|
192
|
-
const
|
|
193
|
-
|
|
195
|
+
console.log("🧹 [Aippy Runtime] Cleaning up motion listener"), i.cancel();
|
|
196
|
+
const n = this.motionListeners.indexOf(e);
|
|
197
|
+
n > -1 && this.motionListeners.splice(n, 1);
|
|
194
198
|
};
|
|
195
199
|
}
|
|
196
200
|
/**
|
|
@@ -203,17 +207,17 @@ class f {
|
|
|
203
207
|
console.warn("⚠️ [Aippy Runtime] No motion listeners to broadcast to");
|
|
204
208
|
return;
|
|
205
209
|
}
|
|
206
|
-
const
|
|
207
|
-
console.log("📊 [Aippy Runtime] Broadcasting motion data:",
|
|
210
|
+
const t = e.motion || e;
|
|
211
|
+
console.log("📊 [Aippy Runtime] Broadcasting motion data:", t), this.motionListeners.forEach((i, n) => {
|
|
208
212
|
try {
|
|
209
|
-
console.log(`📲 [Aippy Runtime] Calling listener #${
|
|
210
|
-
} catch (
|
|
211
|
-
console.error(`⚠️ [Aippy Runtime] Error in motion listener #${
|
|
213
|
+
console.log(`📲 [Aippy Runtime] Calling listener #${n + 1}`), i(t);
|
|
214
|
+
} catch (r) {
|
|
215
|
+
console.error(`⚠️ [Aippy Runtime] Error in motion listener #${n + 1}:`, r);
|
|
212
216
|
}
|
|
213
217
|
});
|
|
214
218
|
}
|
|
215
219
|
}
|
|
216
|
-
function
|
|
220
|
+
function g(o) {
|
|
217
221
|
if (console.log("🎯 [Aippy Runtime] processMotionData called by iOS with data:", o), !o || typeof o != "object") {
|
|
218
222
|
console.warn("⚠️ [Aippy Runtime] Invalid motion data type:", typeof o);
|
|
219
223
|
return;
|
|
@@ -222,17 +226,17 @@ function h(o) {
|
|
|
222
226
|
console.warn("⚠️ [Aippy Runtime] Motion data missing valid motion field");
|
|
223
227
|
return;
|
|
224
228
|
}
|
|
225
|
-
console.log("✅ [Aippy Runtime] Motion data validated, broadcasting to listeners"),
|
|
229
|
+
console.log("✅ [Aippy Runtime] Motion data validated, broadcasting to listeners"), l.broadcastMotionData(o);
|
|
226
230
|
}
|
|
227
|
-
const
|
|
228
|
-
typeof window < "u" && (window.aippyRuntime =
|
|
231
|
+
const l = new h();
|
|
232
|
+
typeof window < "u" && (window.aippyRuntime = l, window.processMotionData = g);
|
|
229
233
|
export {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
d as A,
|
|
235
|
+
a as C,
|
|
236
|
+
R as E,
|
|
237
|
+
f as R,
|
|
238
|
+
h as a,
|
|
239
|
+
l as b,
|
|
240
|
+
w as c,
|
|
241
|
+
g as p
|
|
238
242
|
};
|