@mentra/crust 3.3.0-dev.388 → 3.3.0-dev.391

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.
@@ -14,12 +14,14 @@ import com.mentra.crust.heading.HeadingManager
14
14
  import com.mentra.crust.jsc.JSCRuntime
15
15
  import com.mentra.crust.jsc.InstalledMiniappManifest
16
16
  import com.mentra.crust.jsc.JSCPolyfillBridge
17
+ import com.mentra.crust.receivers.IncidentReportDelivery
17
18
 
18
19
  class CrustModule : Module() {
19
20
  companion object {
20
21
  private const val TAG = "CrustModule"
21
22
 
22
23
  @Volatile private var eventEmitter: ((String, Map<String, Any>) -> Unit)? = null
24
+ private val incidentReports = IncidentReportDelivery()
23
25
 
24
26
  fun emitPhoneNotification(
25
27
  context: android.content.Context,
@@ -51,9 +53,8 @@ class CrustModule : Module() {
51
53
  NotificationProcessBridge.emitDismissed(context, notificationKey, packageName)
52
54
  }
53
55
 
54
- fun emitSubmitIncidentReport(data: Map<String, Any>) {
55
- emitEvent("submit_incident_report", data)
56
- }
56
+ /** Returns false when no started JS report service received the request. */
57
+ fun emitSubmitIncidentReport(data: Map<String, Any>): Boolean = incidentReports.deliver(data)
57
58
 
58
59
  private fun emitEvent(eventName: String, data: Map<String, Any>) {
59
60
  val emitter = eventEmitter
@@ -137,6 +138,7 @@ class CrustModule : Module() {
137
138
 
138
139
  OnCreate {
139
140
  eventEmitter = { eventName, data -> sendEvent(eventName, data) }
141
+ incidentReports.attach { data -> sendEvent("submit_incident_report", data) }
140
142
  registerNotificationBridgeIfPossible()
141
143
  installRuntimeIfPossible("OnCreate")
142
144
  }
@@ -150,12 +152,19 @@ class CrustModule : Module() {
150
152
  notificationEventReceiver = null
151
153
  notificationBridgeContext = null
152
154
  eventEmitter = null
155
+ incidentReports.detach()
153
156
  }
154
157
 
155
158
  Function("hello") {
156
159
  "Hello world! 👋"
157
160
  }
158
161
 
162
+ // SubmitIncidentReportService reports its listener state so broadcasts that
163
+ // arrive before it subscribes get an immediate failed receipt, not silence.
164
+ Function("setIncidentReportServiceReady") { ready: Boolean ->
165
+ incidentReports.setServiceReady(ready)
166
+ }
167
+
159
168
  AsyncFunction("setValueAsync") { value: String ->
160
169
  sendEvent("onChange", mapOf("value" to value))
161
170
  }
@@ -0,0 +1,56 @@
1
+ package com.mentra.crust.receivers
2
+
3
+ import android.util.Log
4
+
5
+ /**
6
+ * Hands incident requests to the JS report service only while it is subscribed.
7
+ *
8
+ * Crust's native OnCreate is not enough: the JS listener starts later, from the
9
+ * signed-in engine, and Expo drops events that no listener receives. Requests are
10
+ * not queued; [deliver] returns false so the receiver can answer immediately.
11
+ */
12
+ internal class IncidentReportDelivery {
13
+ @Volatile private var emitter: ((Map<String, Any>) -> Unit)? = null
14
+ @Volatile private var serviceReady = false
15
+
16
+ /** Called from Crust OnCreate. A new JS runtime has not subscribed yet. */
17
+ fun attach(emit: (Map<String, Any>) -> Unit) {
18
+ serviceReady = false
19
+ emitter = emit
20
+ }
21
+
22
+ /** Called from Crust OnDestroy. */
23
+ fun detach() {
24
+ serviceReady = false
25
+ emitter = null
26
+ }
27
+
28
+ /** Called by the JS report service after subscribing and before unsubscribing. */
29
+ fun setServiceReady(ready: Boolean) {
30
+ serviceReady = ready
31
+ }
32
+
33
+ /** Returns true only when the request was handed to a subscribed JS report service. */
34
+ fun deliver(request: Map<String, Any>): Boolean {
35
+ val emit = emitter
36
+ if (emit == null) {
37
+ Log.w(TAG, "Incident report request not delivered: Crust module is not created")
38
+ return false
39
+ }
40
+ if (!serviceReady) {
41
+ Log.w(TAG, "Incident report request not delivered: report service is not started")
42
+ return false
43
+ }
44
+ return try {
45
+ emit(request)
46
+ true
47
+ } catch (e: Exception) {
48
+ Log.e(TAG, "Error delivering incident report request", e)
49
+ false
50
+ }
51
+ }
52
+
53
+ private companion object {
54
+ const val TAG = "SubmitIncidentReport"
55
+ }
56
+ }
@@ -5,13 +5,16 @@ import android.content.Context
5
5
  import android.content.Intent
6
6
  import android.util.Log
7
7
  import com.mentra.crust.CrustModule
8
+ import org.json.JSONObject
8
9
 
9
10
  /**
10
11
  * Receives incident-report requests and forwards them into React Native so
11
12
  * the app can file a normal incident through the existing mobile incident pipeline.
13
+ * When the JS report service is not subscribed, the request is not queued: the
14
+ * caller immediately receives a correlated failed INCIDENT_REPORT_RESULT.
12
15
  */
13
16
  class SubmitIncidentReportReceiver internal constructor(
14
- private val emitReport: (Map<String, Any>) -> Unit,
17
+ private val emitReport: (Map<String, Any>) -> Boolean,
15
18
  ) : BroadcastReceiver() {
16
19
  constructor() : this(CrustModule::emitSubmitIncidentReport)
17
20
 
@@ -38,6 +41,33 @@ class SubmitIncidentReportReceiver internal constructor(
38
41
  }
39
42
  }
40
43
 
41
- emitReport(body)
44
+ if (!emitReport(body)) {
45
+ Log.i(RESULT_LOG_TAG, "INCIDENT_REPORT_RESULT ${unavailableResult(body)}")
46
+ }
47
+ }
48
+
49
+ internal companion object {
50
+ // Callers read every receipt from the ReactNativeJS tag, where the JS report
51
+ // service logs filed/skipped/failed results; keep this one on the same tag.
52
+ const val RESULT_LOG_TAG = "ReactNativeJS"
53
+ const val UNAVAILABLE_ERROR =
54
+ "Incident report service is not running; the request was not queued. " +
55
+ "Open the Mentra App, sign in, and send a new request."
56
+
57
+ /** Mirrors SubmitIncidentReportService's IncidentReportResult correlation fields. */
58
+ fun unavailableResult(request: Map<String, Any>): String {
59
+ fun read(key: String) = (request[key] as? String)?.takeIf { it.isNotBlank() }
60
+ val testRunId = read("test_run_id")
61
+ return JSONObject()
62
+ .apply {
63
+ (read("alert_id") ?: testRunId)?.let { put("alert_id", it) }
64
+ testRunId?.let { put("test_run_id", it) }
65
+ put("failure_code", read("failure_code") ?: "unknown")
66
+ read("scenario_name")?.let { put("scenario_name", it) }
67
+ put("status", "failed")
68
+ put("error", UNAVAILABLE_ERROR)
69
+ }
70
+ .toString()
71
+ }
42
72
  }
43
73
  }
@@ -0,0 +1,85 @@
1
+ package com.mentra.crust.receivers
2
+
3
+ import org.junit.Assert.assertEquals
4
+ import org.junit.Assert.assertFalse
5
+ import org.junit.Assert.assertTrue
6
+ import org.junit.Test
7
+ import org.junit.runner.RunWith
8
+ import org.robolectric.RobolectricTestRunner
9
+ import org.robolectric.annotation.Config
10
+
11
+ @RunWith(RobolectricTestRunner::class)
12
+ @Config(sdk = [28], manifest = Config.NONE)
13
+ class IncidentReportDeliveryTest {
14
+ private val request = mapOf<String, Any>("alert_id" to "request-1")
15
+
16
+ @Test
17
+ fun refusesRequestBeforeCrustIsCreated() {
18
+ val delivery = IncidentReportDelivery()
19
+ delivery.setServiceReady(true)
20
+ assertFalse(delivery.deliver(request))
21
+ }
22
+
23
+ @Test
24
+ fun refusesRequestAfterCrustIsCreatedButBeforeReportServiceSubscribes() {
25
+ val emitted = mutableListOf<Map<String, Any>>()
26
+ val delivery = IncidentReportDelivery()
27
+ delivery.attach { emitted.add(it) }
28
+ assertFalse(delivery.deliver(request))
29
+ assertTrue(emitted.isEmpty())
30
+ }
31
+
32
+ @Test
33
+ fun deliversWhileReportServiceIsSubscribed() {
34
+ val emitted = mutableListOf<Map<String, Any>>()
35
+ val delivery = IncidentReportDelivery()
36
+ delivery.attach { emitted.add(it) }
37
+ delivery.setServiceReady(true)
38
+ assertTrue(delivery.deliver(request))
39
+ assertEquals(listOf(request), emitted)
40
+ }
41
+
42
+ @Test
43
+ fun refusedRequestsAreNotReplayedWhenTheServiceStarts() {
44
+ val emitted = mutableListOf<Map<String, Any>>()
45
+ val delivery = IncidentReportDelivery()
46
+ delivery.attach { emitted.add(it) }
47
+ assertFalse(delivery.deliver(request))
48
+ delivery.setServiceReady(true)
49
+ assertTrue(emitted.isEmpty())
50
+ }
51
+
52
+ @Test
53
+ fun serviceStopAndRestartGateDelivery() {
54
+ val emitted = mutableListOf<Map<String, Any>>()
55
+ val delivery = IncidentReportDelivery()
56
+ delivery.attach { emitted.add(it) }
57
+ delivery.setServiceReady(true)
58
+ delivery.setServiceReady(false)
59
+ assertFalse(delivery.deliver(request))
60
+ delivery.setServiceReady(true)
61
+ assertTrue(delivery.deliver(request))
62
+ assertEquals(1, emitted.size)
63
+ }
64
+
65
+ @Test
66
+ fun crustRecreationRequiresTheNewRuntimeToSubscribe() {
67
+ val emitted = mutableListOf<Map<String, Any>>()
68
+ val delivery = IncidentReportDelivery()
69
+ delivery.attach { emitted.add(it) }
70
+ delivery.setServiceReady(true)
71
+ delivery.detach()
72
+ assertFalse(delivery.deliver(request))
73
+ delivery.attach { emitted.add(it) }
74
+ assertFalse(delivery.deliver(request))
75
+ assertTrue(emitted.isEmpty())
76
+ }
77
+
78
+ @Test
79
+ fun emitterFailureIsReportedAsUndelivered() {
80
+ val delivery = IncidentReportDelivery()
81
+ delivery.attach { throw IllegalStateException("bridge gone") }
82
+ delivery.setServiceReady(true)
83
+ assertFalse(delivery.deliver(request))
84
+ }
85
+ }
@@ -5,14 +5,28 @@ import android.net.Uri
5
5
  import org.junit.Assert.assertEquals
6
6
  import org.junit.Assert.assertFalse
7
7
  import org.junit.Assert.assertTrue
8
+ import org.junit.Before
8
9
  import org.junit.Test
9
10
  import org.junit.runner.RunWith
11
+ import org.json.JSONObject
10
12
  import org.robolectric.RobolectricTestRunner
11
13
  import org.robolectric.annotation.Config
14
+ import org.robolectric.shadows.ShadowLog
12
15
 
13
16
  @RunWith(RobolectricTestRunner::class)
14
17
  @Config(sdk = [28], manifest = Config.NONE)
15
18
  class SubmitIncidentReportReceiverTest {
19
+ @Before
20
+ fun clearLogs() {
21
+ ShadowLog.clear()
22
+ }
23
+
24
+ private fun receipts(): List<JSONObject> =
25
+ ShadowLog.getLogsForTag("ReactNativeJS")
26
+ .map { it.msg }
27
+ .filter { it.startsWith("INCIDENT_REPORT_RESULT ") }
28
+ .map { JSONObject(it.removePrefix("INCIDENT_REPORT_RESULT ")) }
29
+
16
30
  @Test
17
31
  fun forwardsReportMetadataAndPrimitiveExtras() {
18
32
  val events = mutableListOf<Map<String, Any>>()
@@ -48,4 +62,65 @@ class SubmitIncidentReportReceiverTest {
48
62
  receiver.onReceive(null, Intent("com.mentra.OTHER_ACTION"))
49
63
  assertTrue(events.isEmpty())
50
64
  }
65
+
66
+ @Test
67
+ fun deliveredRequestsLeaveTheReceiptToTheReportService() {
68
+ val receiver = SubmitIncidentReportReceiver { true }
69
+ receiver.onReceive(null, Intent("com.mentra.SUBMIT_INCIDENT_REPORT").putExtra("alert_id", "request-1"))
70
+ assertTrue(receipts().isEmpty())
71
+ }
72
+
73
+ @Test
74
+ fun undeliveredRequestGetsAnImmediateCorrelatedFailedReceipt() {
75
+ val receiver = SubmitIncidentReportReceiver { false }
76
+ receiver.onReceive(null, Intent("com.mentra.SUBMIT_INCIDENT_REPORT").apply {
77
+ putExtra("alert_id", "request-1")
78
+ putExtra("test_run_id", "run-1")
79
+ putExtra("failure_code", "unpair_failed")
80
+ putExtra("scenario_name", "no-glasses-android")
81
+ putExtra("failure_message", "Crash during Unpair")
82
+ })
83
+ val receipt = receipts().single()
84
+ assertEquals("request-1", receipt.getString("alert_id"))
85
+ assertEquals("run-1", receipt.getString("test_run_id"))
86
+ assertEquals("unpair_failed", receipt.getString("failure_code"))
87
+ assertEquals("no-glasses-android", receipt.getString("scenario_name"))
88
+ assertEquals("failed", receipt.getString("status"))
89
+ assertEquals(SubmitIncidentReportReceiver.UNAVAILABLE_ERROR, receipt.getString("error"))
90
+ assertFalse(receipt.has("report_id"))
91
+ assertFalse(receipt.has("incident_id"))
92
+ assertFalse(receipt.toString().contains("Crash during Unpair"))
93
+ }
94
+
95
+ @Test
96
+ fun undeliveredReceiptUsesTheServiceCorrelationDefaults() {
97
+ val receiver = SubmitIncidentReportReceiver { false }
98
+ receiver.onReceive(null, Intent("com.mentra.SUBMIT_INCIDENT_REPORT").apply {
99
+ putExtra("alert_id", " ")
100
+ putExtra("test_run_id", "run-1")
101
+ putExtra("failure_code", 7)
102
+ })
103
+ val receipt = receipts().single()
104
+ assertEquals("run-1", receipt.getString("alert_id"))
105
+ assertEquals("unknown", receipt.getString("failure_code"))
106
+ assertFalse(receipt.has("scenario_name"))
107
+ }
108
+
109
+ @Test
110
+ fun eachUndeliveredRetransmitGetsItsOwnReceiptAndNothingIsQueued() {
111
+ val attempts = mutableListOf<Map<String, Any>>()
112
+ val receiver = SubmitIncidentReportReceiver { attempts.add(it); false }
113
+ val intent = Intent("com.mentra.SUBMIT_INCIDENT_REPORT").putExtra("alert_id", "request-1")
114
+ receiver.onReceive(null, intent)
115
+ receiver.onReceive(null, intent)
116
+ assertEquals(2, attempts.size)
117
+ assertEquals(listOf("request-1", "request-1"), receipts().map { it.getString("alert_id") })
118
+ }
119
+
120
+ @Test
121
+ fun unsupportedActionsDoNotProduceReceipts() {
122
+ val receiver = SubmitIncidentReportReceiver { false }
123
+ receiver.onReceive(null, Intent("com.mentra.OTHER_ACTION"))
124
+ assertTrue(receipts().isEmpty())
125
+ }
51
126
  }
@@ -11,6 +11,8 @@ declare class CrustModule extends NativeModule<CrustModuleEvents> {
11
11
  body: string;
12
12
  }>;
13
13
  showAVRoutePicker(tintColor?: string | null): void;
14
+ /** Android: whether the JS incident report service is subscribed to submit_incident_report. */
15
+ setIncidentReportServiceReady(ready: boolean): void;
14
16
  /**
15
17
  * iOS: configure `preferredScreenEdgesDeferringSystemGestures`. When an
16
18
  * edge is deferred, the first swipe across that edge is consumed by the
@@ -1 +1 @@
1
- {"version":3,"file":"CrustModule.d.ts","sourceRoot":"","sources":["../src/CrustModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAsB,MAAM,MAAM,CAAA;AAEtD,OAAO,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAA;AAE7D,OAAO,OAAO,WAAY,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IAC/D,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,IAAI,MAAM;IACf,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3C,iBAAiB,CACf,MA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,OAAO,CAAC,OAAO,CAAC;IAC3D;;;;;OAKG;IACH,0BAA0B,IAAI,MAAM;CACrC;;AAGD,wBAAwD"}
@@ -1 +1 @@
1
- {"version":3,"file":"CrustModule.js","sourceRoot":"","sources":["../src/CrustModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,mBAAmB,EAAC,MAAM,MAAM,CAAA;AA8LtD,yDAAyD;AACzD,eAAe,mBAAmB,CAAc,OAAO,CAAC,CAAA","sourcesContent":["import {NativeModule, requireNativeModule} from \"expo\"\n\nimport {CrustModuleEvents, InstalledApp} from \"./Crust.types\"\n\ndeclare class CrustModule extends NativeModule<CrustModuleEvents> {\n PI: number\n hello(): string\n setValueAsync(value: string): Promise<void>\n nativeHttpRequest(\n method: string,\n url: string,\n headers: Record<string, string>,\n body?: string | null,\n ): Promise<{status: number; statusText: string; headers: Record<string, string>; body: string}>\n showAVRoutePicker(tintColor?: string | null): void\n\n /**\n * iOS: configure `preferredScreenEdgesDeferringSystemGestures`. When an\n * edge is deferred, the first swipe across that edge is consumed by the\n * app and the system gesture (Control Center, Notification Center, Home\n * indicator) only fires on a second swipe — i.e. a two-swipe-to-exit UX.\n *\n * Pass `[]` to restore default behavior. Android: no-op (Android has no\n * per-app equivalent; system gestures are configured at the OS level).\n */\n setDeferredSystemGestures(edges: Array<\"top\" | \"bottom\" | \"left\" | \"right\" | \"all\">): Promise<void>\n\n // MentraOS Notification Commands\n setNotificationConfig(listenerEnabled: boolean, blocklist: string[]): Promise<void>\n getInstalledApps(): Promise<InstalledApp[]>\n getInstalledAppsForNotifications(): Promise<InstalledApp[]>\n hasNotificationListenerPermission(): Promise<boolean>\n refreshNotificationListener(): Promise<boolean>\n openNotificationListenerSettings(): Promise<boolean>\n isBetaBuild(): Promise<boolean>\n // location services commands\n showLocationServicesDialog(): Promise<boolean>\n isLocationServicesEnabled(): Promise<boolean>\n openLocationSettings(): Promise<boolean>\n openAppSettings(): Promise<boolean>\n openBluetoothSettings(): Promise<boolean>\n\n // Image Processing Commands\n processGalleryImage(\n inputPath: string,\n outputPath: string,\n options: {\n lensCorrection?: boolean\n colorCorrection?: boolean\n },\n ): Promise<{\n success: boolean\n outputPath?: string\n processingTimeMs?: number\n error?: string\n }>\n\n mergeHdrBrackets(\n underPath: string,\n normalPath: string,\n overPath: string,\n outputPath: string,\n ): Promise<{\n success: boolean\n outputPath?: string\n processingTimeMs?: number\n error?: string\n }>\n\n stabilizeVideo(\n inputPath: string,\n imuPath: string,\n outputPath: string,\n ): Promise<{\n success: boolean\n outputPath?: string\n processingTimeMs?: number\n error?: string\n }>\n\n // Media Library Commands\n saveToGalleryWithDate(\n filePath: string,\n captureTimeMillis?: number,\n displayName?: string,\n ): Promise<{\n success: boolean\n uri?: string\n identifier?: string\n existing?: boolean\n error?: string\n }>\n\n // Navigation (Android only — iOS stubs return error)\n startNavigation(\n lat: number,\n lng: number,\n options?: {\n simulate?: boolean\n speedMultiplier?: number\n /** Optional multi-stop list. When present takes precedence over lat/lng. Last entry is the final destination. */\n stops?: Array<{lat: number; lng: number}>\n /** \"walking\" | \"driving\" | \"cycling\" | \"two_wheeler\". Defaults driving. */\n mode?: string\n avoid?: {highways?: boolean; tolls?: boolean; ferries?: boolean}\n /** Force a reroute when the user is more than N meters past a pivot they didn't take. */\n missedTurnRerouteMeters?: number\n },\n ): Promise<{ok: boolean; error?: string}>\n stopNavigation(): Promise<{ok: boolean; error?: string}>\n\n /**\n * Show the Google Nav SDK Terms & Conditions dialog if not already\n * accepted. Idempotent — resolves immediately with `{accepted: true}`\n * when the user has already accepted (cached in-process / on-disk /\n * inside the SDK).\n */\n requestNavigationPermission(): Promise<{ok: boolean; accepted: boolean; error?: string}>\n\n /**\n * Dev-only: clear cached T&C acceptance (SDK flag + on-disk pref +\n * in-process flag) so the next requestNavigationPermission() re-shows\n * the dialog. Android only; iOS returns {ok: false, error: \"not\n * supported on iOS\"}.\n */\n resetNavigationPermission(): Promise<{ok: boolean; error?: string}>\n\n /**\n * Dev-only: nudge the simulated user position ~offsetMeters perpendicular\n * to the route so the Nav SDK reroutes. Default 20m. Android only.\n */\n simulateDeviation(offsetMeters?: number): Promise<{ok: boolean; error?: string}>\n\n /**\n * Dev toggle. When enabled, the native NavigationManager shifts every\n * reported location ~8m perpendicular to the route bearing, simulating\n * a pedestrian walking on the wrong sidewalk. Only meaningful in\n * simulate mode; lets us verify the SDK's along-path pivot trigger\n * fires even when the user never crosses the 7m pivot point radius.\n * Android-only today; iOS is a no-op stub.\n */\n setWrongSidewalkOffset(enabled: boolean): Promise<{ok: boolean; error?: string}>\n\n /**\n * Dev toggle. When enabled, the native NavigationManager takes over\n * from the Google simulator and walks the user along a modified\n * polyline that omits crossing micro-steps — reproducing the\n * wrong-sidewalk-then-missed-the-turn scenario. Android-only today;\n * iOS is a no-op stub.\n */\n setSkipCrossings(enabled: boolean): Promise<{ok: boolean; error?: string}>\n\n // Heading / compass (Android only)\n startHeading(): Promise<{ok: boolean; error?: string}>\n stopHeading(): Promise<{ok: boolean; error?: string}>\n\n // MentraJS Runtime — per-miniapp JSContext lifecycle.\n /**\n * Spawn a per-miniapp JS context. Re-spawn is allowed: a live context\n * with the same packageName is killed first. Returns true if the\n * polyfill bundle + miniapp source evaluated without throwing.\n *\n * The polyfill bundle is `mobile/modules/mentrajs-runtime/dist/startup.js`\n * (shipped inside the host binary). It installs window-style globals\n * (console, timers, fetch, localStorage, crypto) atop the JSC runtime.\n */\n mentraJsSpawn(packageName: string, polyfillBundle: string, miniappJs: string): Promise<boolean>\n mentraJsEvaluate(packageName: string, source: string): Promise<unknown>\n mentraJsKill(packageName: string): Promise<void>\n /**\n * Push a `{kind: \"event\"|\"response\", …}` envelope into the named\n * context's globalThis.__deliver. Returns when the underlying\n * evaluateScript completes (the JS handler runs synchronously on the\n * context's queue).\n */\n mentraJsDispatchToJs(packageName: string, envelope: Record<string, unknown>): Promise<void>\n mentraJsSetManifest(packageName: string, permissions: string[]): Promise<void>\n /** Diagnostic — returns the packageNames of every live JSContext. */\n mentraJsAlivePackages(): string[]\n /** Diagnostic — force a GC cycle on the named context. */\n mentraJsDebugForceGC(packageName: string): Promise<boolean>\n /**\n * Read the bundled MentraJS polyfill (startup.js) shipped inside the\n * host binary. Synchronous — host RN code calls this once on app boot\n * and caches the string, then passes it to every mentraJsSpawn so\n * every JSContext starts with the same polyfill ABI.\n */\n mentraJsLoadPolyfillBundle(): string\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<CrustModule>(\"Crust\")\n"]}
1
+ {"version":3,"file":"CrustModule.js","sourceRoot":"","sources":["../src/CrustModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,mBAAmB,EAAC,MAAM,MAAM,CAAA;AAgMtD,yDAAyD;AACzD,eAAe,mBAAmB,CAAc,OAAO,CAAC,CAAA","sourcesContent":["import {NativeModule, requireNativeModule} from \"expo\"\n\nimport {CrustModuleEvents, InstalledApp} from \"./Crust.types\"\n\ndeclare class CrustModule extends NativeModule<CrustModuleEvents> {\n PI: number\n hello(): string\n setValueAsync(value: string): Promise<void>\n nativeHttpRequest(\n method: string,\n url: string,\n headers: Record<string, string>,\n body?: string | null,\n ): Promise<{status: number; statusText: string; headers: Record<string, string>; body: string}>\n showAVRoutePicker(tintColor?: string | null): void\n /** Android: whether the JS incident report service is subscribed to submit_incident_report. */\n setIncidentReportServiceReady(ready: boolean): void\n\n /**\n * iOS: configure `preferredScreenEdgesDeferringSystemGestures`. When an\n * edge is deferred, the first swipe across that edge is consumed by the\n * app and the system gesture (Control Center, Notification Center, Home\n * indicator) only fires on a second swipe — i.e. a two-swipe-to-exit UX.\n *\n * Pass `[]` to restore default behavior. Android: no-op (Android has no\n * per-app equivalent; system gestures are configured at the OS level).\n */\n setDeferredSystemGestures(edges: Array<\"top\" | \"bottom\" | \"left\" | \"right\" | \"all\">): Promise<void>\n\n // MentraOS Notification Commands\n setNotificationConfig(listenerEnabled: boolean, blocklist: string[]): Promise<void>\n getInstalledApps(): Promise<InstalledApp[]>\n getInstalledAppsForNotifications(): Promise<InstalledApp[]>\n hasNotificationListenerPermission(): Promise<boolean>\n refreshNotificationListener(): Promise<boolean>\n openNotificationListenerSettings(): Promise<boolean>\n isBetaBuild(): Promise<boolean>\n // location services commands\n showLocationServicesDialog(): Promise<boolean>\n isLocationServicesEnabled(): Promise<boolean>\n openLocationSettings(): Promise<boolean>\n openAppSettings(): Promise<boolean>\n openBluetoothSettings(): Promise<boolean>\n\n // Image Processing Commands\n processGalleryImage(\n inputPath: string,\n outputPath: string,\n options: {\n lensCorrection?: boolean\n colorCorrection?: boolean\n },\n ): Promise<{\n success: boolean\n outputPath?: string\n processingTimeMs?: number\n error?: string\n }>\n\n mergeHdrBrackets(\n underPath: string,\n normalPath: string,\n overPath: string,\n outputPath: string,\n ): Promise<{\n success: boolean\n outputPath?: string\n processingTimeMs?: number\n error?: string\n }>\n\n stabilizeVideo(\n inputPath: string,\n imuPath: string,\n outputPath: string,\n ): Promise<{\n success: boolean\n outputPath?: string\n processingTimeMs?: number\n error?: string\n }>\n\n // Media Library Commands\n saveToGalleryWithDate(\n filePath: string,\n captureTimeMillis?: number,\n displayName?: string,\n ): Promise<{\n success: boolean\n uri?: string\n identifier?: string\n existing?: boolean\n error?: string\n }>\n\n // Navigation (Android only — iOS stubs return error)\n startNavigation(\n lat: number,\n lng: number,\n options?: {\n simulate?: boolean\n speedMultiplier?: number\n /** Optional multi-stop list. When present takes precedence over lat/lng. Last entry is the final destination. */\n stops?: Array<{lat: number; lng: number}>\n /** \"walking\" | \"driving\" | \"cycling\" | \"two_wheeler\". Defaults driving. */\n mode?: string\n avoid?: {highways?: boolean; tolls?: boolean; ferries?: boolean}\n /** Force a reroute when the user is more than N meters past a pivot they didn't take. */\n missedTurnRerouteMeters?: number\n },\n ): Promise<{ok: boolean; error?: string}>\n stopNavigation(): Promise<{ok: boolean; error?: string}>\n\n /**\n * Show the Google Nav SDK Terms & Conditions dialog if not already\n * accepted. Idempotent — resolves immediately with `{accepted: true}`\n * when the user has already accepted (cached in-process / on-disk /\n * inside the SDK).\n */\n requestNavigationPermission(): Promise<{ok: boolean; accepted: boolean; error?: string}>\n\n /**\n * Dev-only: clear cached T&C acceptance (SDK flag + on-disk pref +\n * in-process flag) so the next requestNavigationPermission() re-shows\n * the dialog. Android only; iOS returns {ok: false, error: \"not\n * supported on iOS\"}.\n */\n resetNavigationPermission(): Promise<{ok: boolean; error?: string}>\n\n /**\n * Dev-only: nudge the simulated user position ~offsetMeters perpendicular\n * to the route so the Nav SDK reroutes. Default 20m. Android only.\n */\n simulateDeviation(offsetMeters?: number): Promise<{ok: boolean; error?: string}>\n\n /**\n * Dev toggle. When enabled, the native NavigationManager shifts every\n * reported location ~8m perpendicular to the route bearing, simulating\n * a pedestrian walking on the wrong sidewalk. Only meaningful in\n * simulate mode; lets us verify the SDK's along-path pivot trigger\n * fires even when the user never crosses the 7m pivot point radius.\n * Android-only today; iOS is a no-op stub.\n */\n setWrongSidewalkOffset(enabled: boolean): Promise<{ok: boolean; error?: string}>\n\n /**\n * Dev toggle. When enabled, the native NavigationManager takes over\n * from the Google simulator and walks the user along a modified\n * polyline that omits crossing micro-steps — reproducing the\n * wrong-sidewalk-then-missed-the-turn scenario. Android-only today;\n * iOS is a no-op stub.\n */\n setSkipCrossings(enabled: boolean): Promise<{ok: boolean; error?: string}>\n\n // Heading / compass (Android only)\n startHeading(): Promise<{ok: boolean; error?: string}>\n stopHeading(): Promise<{ok: boolean; error?: string}>\n\n // MentraJS Runtime — per-miniapp JSContext lifecycle.\n /**\n * Spawn a per-miniapp JS context. Re-spawn is allowed: a live context\n * with the same packageName is killed first. Returns true if the\n * polyfill bundle + miniapp source evaluated without throwing.\n *\n * The polyfill bundle is `mobile/modules/mentrajs-runtime/dist/startup.js`\n * (shipped inside the host binary). It installs window-style globals\n * (console, timers, fetch, localStorage, crypto) atop the JSC runtime.\n */\n mentraJsSpawn(packageName: string, polyfillBundle: string, miniappJs: string): Promise<boolean>\n mentraJsEvaluate(packageName: string, source: string): Promise<unknown>\n mentraJsKill(packageName: string): Promise<void>\n /**\n * Push a `{kind: \"event\"|\"response\", …}` envelope into the named\n * context's globalThis.__deliver. Returns when the underlying\n * evaluateScript completes (the JS handler runs synchronously on the\n * context's queue).\n */\n mentraJsDispatchToJs(packageName: string, envelope: Record<string, unknown>): Promise<void>\n mentraJsSetManifest(packageName: string, permissions: string[]): Promise<void>\n /** Diagnostic — returns the packageNames of every live JSContext. */\n mentraJsAlivePackages(): string[]\n /** Diagnostic — force a GC cycle on the named context. */\n mentraJsDebugForceGC(packageName: string): Promise<boolean>\n /**\n * Read the bundled MentraJS polyfill (startup.js) shipped inside the\n * host binary. Synchronous — host RN code calls this once on app boot\n * and caches the string, then passes it to every mentraJsSpawn so\n * every JSContext starts with the same polyfill ABI.\n */\n mentraJsLoadPolyfillBundle(): string\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<CrustModule>(\"Crust\")\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/crust",
3
- "version": "3.3.0-dev.388",
3
+ "version": "3.3.0-dev.391",
4
4
  "description": "Mentra Native Module",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "license": "Apache-2.0",
36
36
  "homepage": "https://github.com/Mentra-Community/MentraOS/tree/dev/mobile/modules/crust#readme",
37
37
  "dependencies": {
38
- "@mentra/jspolyfill": "3.3.0-dev.388"
38
+ "@mentra/jspolyfill": "3.3.0-dev.391"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@expo/config-plugins": ">=8.0.0",
@@ -13,6 +13,8 @@ declare class CrustModule extends NativeModule<CrustModuleEvents> {
13
13
  body?: string | null,
14
14
  ): Promise<{status: number; statusText: string; headers: Record<string, string>; body: string}>
15
15
  showAVRoutePicker(tintColor?: string | null): void
16
+ /** Android: whether the JS incident report service is subscribed to submit_incident_report. */
17
+ setIncidentReportServiceReady(ready: boolean): void
16
18
 
17
19
  /**
18
20
  * iOS: configure `preferredScreenEdgesDeferringSystemGestures`. When an