@glassly/crust 0.4.4 → 0.4.5-beta.1391
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/src/main/AndroidManifest.xml +7 -0
- package/android/src/main/java/com/glassly/crust/CrustModule.kt +44 -1
- package/android/src/main/java/com/glassly/crust/services/NotificationListener.kt +18 -0
- package/android/src/main/java/com/glassly/crust/services/NotificationProcessBridge.kt +60 -0
- package/android/src/main/java/com/glassly/crust/services/NotificationReply.kt +73 -0
- package/build/Crust.types.d.ts +2 -0
- package/build/Crust.types.d.ts.map +1 -1
- package/build/Crust.types.js.map +1 -1
- package/build/CrustModule.d.ts +3 -0
- package/build/CrustModule.d.ts.map +1 -1
- package/build/CrustModule.js.map +1 -1
- package/build/CrustModule.web.d.ts +3 -0
- package/build/CrustModule.web.d.ts.map +1 -1
- package/build/CrustModule.web.js +9 -0
- package/build/CrustModule.web.js.map +1 -1
- package/ios/CrustModule.swift +39 -16
- package/package.json +2 -2
- package/src/Crust.types.ts +2 -0
- package/src/CrustModule.ts +3 -0
- package/src/CrustModule.web.ts +9 -0
|
@@ -26,6 +26,13 @@
|
|
|
26
26
|
android:permission="${applicationId}.permission.CRUST_NOTIFICATION_BRIDGE"
|
|
27
27
|
android:process=":notif" />
|
|
28
28
|
|
|
29
|
+
<receiver
|
|
30
|
+
android:name="com.glassly.crust.services.NotificationReplyReceiver"
|
|
31
|
+
android:enabled="true"
|
|
32
|
+
android:exported="false"
|
|
33
|
+
android:permission="${applicationId}.permission.CRUST_NOTIFICATION_BRIDGE"
|
|
34
|
+
android:process=":notif" />
|
|
35
|
+
|
|
29
36
|
<!-- Nothing to register for nav: the Mapbox Navigation SDK delivers
|
|
30
37
|
turn-by-turn steps inline via RouteProgress, with no IPC service. -->
|
|
31
38
|
</application>
|
|
@@ -37,6 +37,7 @@ class CrustModule : Module() {
|
|
|
37
37
|
text: String,
|
|
38
38
|
timestamp: Long,
|
|
39
39
|
priority: Int,
|
|
40
|
+
canReply: Boolean,
|
|
40
41
|
) {
|
|
41
42
|
NotificationProcessBridge.emitPosted(
|
|
42
43
|
context,
|
|
@@ -47,9 +48,18 @@ class CrustModule : Module() {
|
|
|
47
48
|
text,
|
|
48
49
|
timestamp,
|
|
49
50
|
priority,
|
|
51
|
+
canReply,
|
|
50
52
|
)
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
private const val REPLY_TIMEOUT_MS = 5_000L
|
|
56
|
+
private val pendingReplies = java.util.concurrent.ConcurrentHashMap<String, (String?) -> Unit>()
|
|
57
|
+
private val replyTimeouts = android.os.Handler(android.os.Looper.getMainLooper())
|
|
58
|
+
|
|
59
|
+
private fun settleReply(requestId: String, error: String?) {
|
|
60
|
+
pendingReplies.remove(requestId)?.invoke(error)
|
|
61
|
+
}
|
|
62
|
+
|
|
53
63
|
fun emitPhoneNotificationDismissed(
|
|
54
64
|
context: android.content.Context,
|
|
55
65
|
notificationKey: String,
|
|
@@ -134,7 +144,12 @@ class CrustModule : Module() {
|
|
|
134
144
|
val applicationContext = context.applicationContext
|
|
135
145
|
notificationEventReceiver =
|
|
136
146
|
NotificationProcessBridge.register(applicationContext) { eventName, data ->
|
|
137
|
-
|
|
147
|
+
if (eventName == NotificationProcessBridge.REPLY_RESULT_EVENT) {
|
|
148
|
+
val error = data[NotificationProcessBridge.EXTRA_ERROR] as? String
|
|
149
|
+
settleReply(data[NotificationProcessBridge.EXTRA_REQUEST_ID] as? String ?: "", error?.ifEmpty { null })
|
|
150
|
+
} else {
|
|
151
|
+
emitEvent(eventName, data)
|
|
152
|
+
}
|
|
138
153
|
}
|
|
139
154
|
// Keep the exact long-lived context used to register the receiver. Expo may
|
|
140
155
|
// clear reactContext/currentActivity before OnDestroy, but Android still
|
|
@@ -257,6 +272,30 @@ class CrustModule : Module() {
|
|
|
257
272
|
)
|
|
258
273
|
}
|
|
259
274
|
|
|
275
|
+
AsyncFunction("replyToNotification") {
|
|
276
|
+
notificationKey: String, text: String, promise: expo.modules.kotlin.Promise ->
|
|
277
|
+
val context = appContext.reactContext ?: appContext.currentActivity
|
|
278
|
+
val reply = text.trim()
|
|
279
|
+
if (context == null || !registerNotificationBridgeIfPossible()) {
|
|
280
|
+
promise.resolve(com.glassly.crust.services.NotificationReplyErrors.LISTENER_OFF)
|
|
281
|
+
} else if (notificationKey.isEmpty() || reply.isEmpty()) {
|
|
282
|
+
promise.resolve(com.glassly.crust.services.NotificationReplyErrors.NOT_REPLYABLE)
|
|
283
|
+
} else {
|
|
284
|
+
val requestId = java.util.UUID.randomUUID().toString()
|
|
285
|
+
pendingReplies[requestId] = { error -> promise.resolve(error) }
|
|
286
|
+
replyTimeouts.postDelayed(
|
|
287
|
+
{ settleReply(requestId, com.glassly.crust.services.NotificationReplyErrors.TIMED_OUT) },
|
|
288
|
+
REPLY_TIMEOUT_MS,
|
|
289
|
+
)
|
|
290
|
+
NotificationProcessBridge.sendReply(
|
|
291
|
+
context.applicationContext,
|
|
292
|
+
requestId,
|
|
293
|
+
notificationKey,
|
|
294
|
+
reply.take(com.glassly.crust.services.NotificationReplyErrors.MAX_TEXT_LENGTH),
|
|
295
|
+
)
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
260
299
|
AsyncFunction("getInstalledApps") {
|
|
261
300
|
val context =
|
|
262
301
|
appContext.reactContext
|
|
@@ -398,6 +437,10 @@ class CrustModule : Module() {
|
|
|
398
437
|
// acts on system-wide pressure instead.
|
|
399
438
|
Function("appMemoryLimit") { null as Double? }
|
|
400
439
|
|
|
440
|
+
Function("appMemoryFootprint") { null as Double? }
|
|
441
|
+
|
|
442
|
+
Function("appCpuSeconds") { android.os.Process.getElapsedCpuTime() / 1000.0 }
|
|
443
|
+
|
|
401
444
|
View(CrustView::class) {
|
|
402
445
|
Prop("url") { view: CrustView, url: URL -> view.webView.loadUrl(url.toString()) }
|
|
403
446
|
Events("onLoad")
|
|
@@ -374,6 +374,7 @@ class NotificationListener private constructor(private val context: Context) {
|
|
|
374
374
|
// already understand (LOW/MIN are negative). Fall back to the
|
|
375
375
|
// deprecated field only when no ranking was available.
|
|
376
376
|
priority = importance?.let { it - 3 } ?: notification.priority,
|
|
377
|
+
canReply = NotificationReply.replyAction(notification) != null,
|
|
377
378
|
)
|
|
378
379
|
|
|
379
380
|
val notificationData =
|
|
@@ -452,6 +453,20 @@ class NotificationListener private constructor(private val context: Context) {
|
|
|
452
453
|
|
|
453
454
|
/** The actual NotificationListenerService implementation. */
|
|
454
455
|
class NotificationListenerServiceImpl : NotificationListenerService() {
|
|
456
|
+
companion object {
|
|
457
|
+
@Volatile private var connected: NotificationListenerServiceImpl? = null
|
|
458
|
+
|
|
459
|
+
internal fun reply(context: Context, notificationKey: String, text: String): String? {
|
|
460
|
+
val service = connected ?: return NotificationReply.ERROR_LISTENER_OFF
|
|
461
|
+
val posted =
|
|
462
|
+
runCatching { service.getActiveNotifications(arrayOf(notificationKey)) }
|
|
463
|
+
.getOrNull()
|
|
464
|
+
?.firstOrNull()
|
|
465
|
+
?: return NotificationReply.ERROR_NOT_FOUND
|
|
466
|
+
return NotificationReply.send(context, posted.notification, text)
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
455
470
|
override fun onNotificationPosted(sbn: StatusBarNotification) {
|
|
456
471
|
super.onNotificationPosted(sbn)
|
|
457
472
|
// Channel importance, not Notification.priority: the latter was deprecated
|
|
@@ -479,11 +494,13 @@ class NotificationListenerServiceImpl : NotificationListenerService() {
|
|
|
479
494
|
|
|
480
495
|
override fun onListenerConnected() {
|
|
481
496
|
super.onListenerConnected()
|
|
497
|
+
connected = this
|
|
482
498
|
Log.d("CrustNotificationListener", "NotificationListenerService connected and ready")
|
|
483
499
|
}
|
|
484
500
|
|
|
485
501
|
override fun onListenerDisconnected() {
|
|
486
502
|
super.onListenerDisconnected()
|
|
503
|
+
if (connected === this) connected = null
|
|
487
504
|
Log.d("CrustNotificationListener", "NotificationListenerService disconnected")
|
|
488
505
|
if (NotificationListener.isListenerEnabled(applicationContext)) {
|
|
489
506
|
runCatching {
|
|
@@ -496,6 +513,7 @@ class NotificationListenerServiceImpl : NotificationListenerService() {
|
|
|
496
513
|
|
|
497
514
|
override fun onDestroy() {
|
|
498
515
|
super.onDestroy()
|
|
516
|
+
if (connected === this) connected = null
|
|
499
517
|
Log.d("CrustNotificationListener", "NotificationListenerService being destroyed")
|
|
500
518
|
NotificationListener.destroyInstance()
|
|
501
519
|
}
|
|
@@ -53,6 +53,11 @@ object NotificationProcessBridge {
|
|
|
53
53
|
private const val POSTED_SUFFIX = ".crust.PHONE_NOTIFICATION"
|
|
54
54
|
private const val DISMISSED_SUFFIX = ".crust.PHONE_NOTIFICATION_DISMISSED"
|
|
55
55
|
private const val CONFIG_SUFFIX = ".crust.NOTIFICATION_CONFIG"
|
|
56
|
+
private const val REPLY_SUFFIX = ".crust.PHONE_NOTIFICATION_REPLY"
|
|
57
|
+
private const val REPLY_RESULT_SUFFIX = ".crust.PHONE_NOTIFICATION_REPLY_RESULT"
|
|
58
|
+
const val REPLY_RESULT_EVENT = "phone_notification_reply_result"
|
|
59
|
+
const val EXTRA_REQUEST_ID = "requestId"
|
|
60
|
+
const val EXTRA_ERROR = "error"
|
|
56
61
|
private const val PERMISSION_SUFFIX = ".permission.CRUST_NOTIFICATION_BRIDGE"
|
|
57
62
|
|
|
58
63
|
private const val EXTRA_NOTIFICATION_ID = "notificationId"
|
|
@@ -66,6 +71,8 @@ object NotificationProcessBridge {
|
|
|
66
71
|
private const val EXTRA_LISTENER_ENABLED = "listenerEnabled"
|
|
67
72
|
private const val EXTRA_BLOCKLIST = "blocklist"
|
|
68
73
|
private const val EXTRA_REQUEST_REBIND = "requestRebind"
|
|
74
|
+
private const val EXTRA_CAN_REPLY = "canReply"
|
|
75
|
+
private const val EXTRA_REPLY_TEXT = "replyText"
|
|
69
76
|
|
|
70
77
|
fun register(
|
|
71
78
|
context: Context,
|
|
@@ -87,6 +94,17 @@ object NotificationProcessBridge {
|
|
|
87
94
|
EXTRA_PRIORITY to intent.getIntExtra(EXTRA_PRIORITY, 0),
|
|
88
95
|
EXTRA_TIMESTAMP to intent.getLongExtra(EXTRA_TIMESTAMP, 0L),
|
|
89
96
|
EXTRA_PACKAGE_NAME to intent.getStringExtra(EXTRA_PACKAGE_NAME).orEmpty(),
|
|
97
|
+
EXTRA_NOTIFICATION_KEY to intent.getStringExtra(EXTRA_NOTIFICATION_KEY).orEmpty(),
|
|
98
|
+
EXTRA_CAN_REPLY to intent.getBooleanExtra(EXTRA_CAN_REPLY, false),
|
|
99
|
+
),
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
replyResultAction(receiveContext) -> {
|
|
103
|
+
onEvent(
|
|
104
|
+
REPLY_RESULT_EVENT,
|
|
105
|
+
mapOf(
|
|
106
|
+
EXTRA_REQUEST_ID to intent.getStringExtra(EXTRA_REQUEST_ID).orEmpty(),
|
|
107
|
+
EXTRA_ERROR to intent.getStringExtra(EXTRA_ERROR).orEmpty(),
|
|
90
108
|
),
|
|
91
109
|
)
|
|
92
110
|
}
|
|
@@ -108,6 +126,7 @@ object NotificationProcessBridge {
|
|
|
108
126
|
IntentFilter().apply {
|
|
109
127
|
addAction(postedAction(applicationContext))
|
|
110
128
|
addAction(dismissedAction(applicationContext))
|
|
129
|
+
addAction(replyResultAction(applicationContext))
|
|
111
130
|
}
|
|
112
131
|
val permission = bridgePermission(applicationContext)
|
|
113
132
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
@@ -139,11 +158,14 @@ object NotificationProcessBridge {
|
|
|
139
158
|
text: String,
|
|
140
159
|
timestamp: Long,
|
|
141
160
|
priority: Int,
|
|
161
|
+
canReply: Boolean,
|
|
142
162
|
) {
|
|
143
163
|
val intent =
|
|
144
164
|
Intent(postedAction(context))
|
|
145
165
|
.setPackage(context.packageName)
|
|
146
166
|
.putExtra(EXTRA_NOTIFICATION_ID, "$packageName-$notificationKey")
|
|
167
|
+
.putExtra(EXTRA_NOTIFICATION_KEY, notificationKey)
|
|
168
|
+
.putExtra(EXTRA_CAN_REPLY, canReply)
|
|
147
169
|
.putExtra(EXTRA_APP, appName)
|
|
148
170
|
.putExtra(EXTRA_TITLE, title.ifEmpty { appName })
|
|
149
171
|
.putExtra(EXTRA_CONTENT, text)
|
|
@@ -163,6 +185,34 @@ object NotificationProcessBridge {
|
|
|
163
185
|
context.sendBroadcast(intent, bridgePermission(context))
|
|
164
186
|
}
|
|
165
187
|
|
|
188
|
+
fun sendReply(context: Context, requestId: String, notificationKey: String, text: String) {
|
|
189
|
+
val intent =
|
|
190
|
+
Intent(replyAction(context))
|
|
191
|
+
.setComponent(ComponentName(context, NotificationReplyReceiver::class.java))
|
|
192
|
+
.putExtra(EXTRA_REQUEST_ID, requestId)
|
|
193
|
+
.putExtra(EXTRA_NOTIFICATION_KEY, notificationKey)
|
|
194
|
+
.putExtra(EXTRA_REPLY_TEXT, text)
|
|
195
|
+
context.sendBroadcast(intent, bridgePermission(context))
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
internal fun readReply(context: Context, intent: Intent): NotificationReplyRequest? {
|
|
199
|
+
if (intent.action != replyAction(context)) return null
|
|
200
|
+
val requestId = intent.getStringExtra(EXTRA_REQUEST_ID).orEmpty()
|
|
201
|
+
val notificationKey = intent.getStringExtra(EXTRA_NOTIFICATION_KEY).orEmpty()
|
|
202
|
+
val text = intent.getStringExtra(EXTRA_REPLY_TEXT).orEmpty()
|
|
203
|
+
if (requestId.isEmpty() || notificationKey.isEmpty() || text.isEmpty()) return null
|
|
204
|
+
return NotificationReplyRequest(requestId, notificationKey, text)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
internal fun emitReplyResult(context: Context, requestId: String, error: String?) {
|
|
208
|
+
val intent =
|
|
209
|
+
Intent(replyResultAction(context))
|
|
210
|
+
.setPackage(context.packageName)
|
|
211
|
+
.putExtra(EXTRA_REQUEST_ID, requestId)
|
|
212
|
+
.putExtra(EXTRA_ERROR, error.orEmpty())
|
|
213
|
+
context.sendBroadcast(intent, bridgePermission(context))
|
|
214
|
+
}
|
|
215
|
+
|
|
166
216
|
fun sendConfig(
|
|
167
217
|
context: Context,
|
|
168
218
|
listenerEnabled: Boolean,
|
|
@@ -194,9 +244,19 @@ object NotificationProcessBridge {
|
|
|
194
244
|
|
|
195
245
|
private fun configAction(context: Context) = context.packageName + CONFIG_SUFFIX
|
|
196
246
|
|
|
247
|
+
private fun replyAction(context: Context) = context.packageName + REPLY_SUFFIX
|
|
248
|
+
|
|
249
|
+
private fun replyResultAction(context: Context) = context.packageName + REPLY_RESULT_SUFFIX
|
|
250
|
+
|
|
197
251
|
private fun bridgePermission(context: Context) = context.packageName + PERMISSION_SUFFIX
|
|
198
252
|
}
|
|
199
253
|
|
|
254
|
+
internal data class NotificationReplyRequest(
|
|
255
|
+
val requestId: String,
|
|
256
|
+
val notificationKey: String,
|
|
257
|
+
val text: String,
|
|
258
|
+
)
|
|
259
|
+
|
|
200
260
|
internal data class NotificationConfigUpdate(
|
|
201
261
|
val listenerEnabled: Boolean,
|
|
202
262
|
val blocklist: Set<String>,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
package com.glassly.crust.services
|
|
2
|
+
|
|
3
|
+
import android.app.ActivityOptions
|
|
4
|
+
import android.app.Notification
|
|
5
|
+
import android.app.PendingIntent
|
|
6
|
+
import android.app.RemoteInput
|
|
7
|
+
import android.content.BroadcastReceiver
|
|
8
|
+
import android.content.Context
|
|
9
|
+
import android.content.Intent
|
|
10
|
+
import android.os.Build
|
|
11
|
+
import android.os.Bundle
|
|
12
|
+
import android.util.Log
|
|
13
|
+
|
|
14
|
+
object NotificationReplyErrors {
|
|
15
|
+
const val LISTENER_OFF = "listener_off"
|
|
16
|
+
const val NOT_FOUND = "not_found"
|
|
17
|
+
const val NOT_REPLYABLE = "not_replyable"
|
|
18
|
+
const val SEND_FAILED = "send_failed"
|
|
19
|
+
const val TIMED_OUT = "timed_out"
|
|
20
|
+
const val MAX_TEXT_LENGTH = 2000
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
internal object NotificationReply {
|
|
24
|
+
const val ERROR_LISTENER_OFF = NotificationReplyErrors.LISTENER_OFF
|
|
25
|
+
const val ERROR_NOT_FOUND = NotificationReplyErrors.NOT_FOUND
|
|
26
|
+
const val ERROR_NOT_REPLYABLE = NotificationReplyErrors.NOT_REPLYABLE
|
|
27
|
+
const val ERROR_SEND_FAILED = NotificationReplyErrors.SEND_FAILED
|
|
28
|
+
|
|
29
|
+
fun replyAction(notification: Notification): Notification.Action? {
|
|
30
|
+
val candidates =
|
|
31
|
+
notification.actions.orEmpty().toList() + Notification.WearableExtender(notification).actions
|
|
32
|
+
val replyable = candidates.filter { freeFormInput(it) != null && it.actionIntent != null }
|
|
33
|
+
return replyable.firstOrNull { it.semanticAction == Notification.Action.SEMANTIC_ACTION_REPLY }
|
|
34
|
+
?: replyable.firstOrNull()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
fun send(context: Context, notification: Notification, text: String): String? {
|
|
38
|
+
val action = replyAction(notification) ?: return ERROR_NOT_REPLYABLE
|
|
39
|
+
val input = freeFormInput(action) ?: return ERROR_NOT_REPLYABLE
|
|
40
|
+
val fill = Intent().addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
|
|
41
|
+
val results = Bundle().apply { putCharSequence(input.resultKey, text) }
|
|
42
|
+
RemoteInput.addResultsToIntent(action.remoteInputs, fill, results)
|
|
43
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
44
|
+
RemoteInput.setResultsSource(fill, RemoteInput.SOURCE_FREE_FORM_INPUT)
|
|
45
|
+
}
|
|
46
|
+
return try {
|
|
47
|
+
action.actionIntent.send(context, 0, fill, null, null, null, sendOptions())
|
|
48
|
+
null
|
|
49
|
+
} catch (error: PendingIntent.CanceledException) {
|
|
50
|
+
Log.w("CrustNotificationReply", "Reply intent was cancelled", error)
|
|
51
|
+
ERROR_SEND_FAILED
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private fun freeFormInput(action: Notification.Action): RemoteInput? =
|
|
56
|
+
action.remoteInputs?.firstOrNull { it.allowFreeFormInput }
|
|
57
|
+
|
|
58
|
+
private fun sendOptions(): Bundle? {
|
|
59
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) return null
|
|
60
|
+
return ActivityOptions.makeBasic()
|
|
61
|
+
.setPendingIntentBackgroundActivityStartMode(ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED)
|
|
62
|
+
.toBundle()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
class NotificationReplyReceiver : BroadcastReceiver() {
|
|
67
|
+
override fun onReceive(context: Context, intent: Intent) {
|
|
68
|
+
val request = NotificationProcessBridge.readReply(context, intent) ?: return
|
|
69
|
+
val error =
|
|
70
|
+
NotificationListenerServiceImpl.reply(context.applicationContext, request.notificationKey, request.text)
|
|
71
|
+
NotificationProcessBridge.emitReplyResult(context, request.requestId, error)
|
|
72
|
+
}
|
|
73
|
+
}
|
package/build/Crust.types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Crust.types.d.ts","sourceRoot":"","sources":["../src/Crust.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,cAAc,CAAA;AAEtD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAA;IAC9C,aAAa,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAA;IACnD,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI,CAAA;IACvD,YAAY,EAAE,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AACzE,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,+FAA+F;IAC/F,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA"}
|
package/build/Crust.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Crust.types.js","sourceRoot":"","sources":["../src/Crust.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {StyleProp, ViewStyle} from \"react-native\"\n\nexport type OnLoadEventPayload = {\n url: string\n}\n\nexport type CrustModuleEvents = {\n onChange: (params: ChangeEventPayload) => void\n onNavManeuver: (params: NavManeuverPayload) => void\n onNavRerouting: (params: Record<string, never>) => void\n onNavArrived: (params: Record<string, never>) => void\n onNavError: (params: NavErrorPayload) => void\n onNavLocation: (params: NavLocationPayload) => void\n onNavRoute: (params: NavRoutePayload) => void\n onNavOffRoute: (params: NavOffRoutePayload) => void\n onHeading: (params: HeadingPayload) => void\n phone_lock_state: (params: PhoneLockState) => void\n}\n\n/** A rect the system reserves in the app window, in window points. */\nexport type ReservedRegion = {\n x: number\n y: number\n width: number\n height: number\n}\n\n/**\n * Whether the user can see the phone right now. iOS derives `unlocked` from\n * protected-data availability, Android from screen on + keyguard hidden.\n * Without a passcode iOS never protects data, so `unlocked` is always true\n * there and carries no information; check `passcodeSet` first.\n */\nexport type PhoneLockState = {\n unlocked: boolean\n passcodeSet: boolean\n}\n\nexport type NavOffRoutePayload = {\n /** Approximate perpendicular distance in meters from the route. */\n offRouteDistanceMeters: number\n}\n\nexport type HeadingPayload = {\n /** Compass heading in degrees, 0 = north, 90 = east. */\n degrees: number\n}\n\nexport type NavRoutePayload = {\n points: Array<{lat: number; lng: number}>\n /**\n * Ordered step list along the route, when supplied by the host. Each\n * step is one navigable segment — typically one straight stretch of\n * road ending in a maneuver. Optional for back-compat with older\n * hosts that only ship the polyline. The SDK's pivot module consumes\n * this to enrich pivots with `fromRoad` / `toRoad` metadata.\n */\n steps?: NavRouteStepPayload[]\n}\n\nexport type NavRouteStepPayload = {\n /** Coordinate where this step begins (== end of the previous step). */\n lat: number\n lng: number\n /**\n * Index into `NavRoutePayload.points[]` where this step starts.\n * Lets consumers correlate step boundaries with polyline geometry.\n */\n routeIndex: number\n /** Name of the road traversed during this step. Null when the engine has no name. */\n road?: string | null\n /**\n * Categorical maneuver performed at the END of this step (i.e. how\n * the user exits this step). Same vocabulary as `NavManeuverPayload.maneuverType`.\n */\n maneuver: string\n /** Length of this step in meters. */\n distanceMeters: number\n}\n\nexport type NavLocationPayload = {\n lat: number\n lng: number\n /** Horizontal accuracy in meters, if reported by the platform. */\n accuracy: number | null\n /** Unix ms timestamp of the fix. */\n timestamp: number\n phone_notification: (event: PhoneNotificationEvent) => void\n phone_notification_dismissed: (event: PhoneNotificationDismissedEvent) => void\n captions_tester_incident: (event: CaptionsTesterIncidentEvent) => void\n}\n\nexport type ChangeEventPayload = {\n value: string\n}\n\nexport type NavManeuverPayload = {\n /**\n * Categorical type of the upcoming maneuver. One of: STRAIGHT,\n * SLIGHT_LEFT, SLIGHT_RIGHT, TURN_LEFT, TURN_RIGHT, SHARP_LEFT,\n * SHARP_RIGHT, U_TURN, ARRIVE.\n */\n maneuverType: string\n /** Distance in meters from the user's current position to that maneuver. -1 if unknown. */\n distanceMeters: number\n /** Road the user is currently on, per the Nav SDK. Null if unavailable. */\n fromRoad?: string | null\n /**\n * Legacy \"next road\" field — historically populated from the same\n * source as `fromRoad` (the current step's road, NOT the road\n * after the upcoming turn). Kept for back-compat. New consumers\n * should read `nextStepRoad` instead.\n */\n toRoad?: string | null\n /**\n * Road the user will be on AFTER the upcoming maneuver, sourced\n * from the Nav SDK's `remainingSteps[0]`. This is the value to\n * show as the \"next street\" headline on the maneuver card. Null\n * when the SDK hasn't surfaced a remaining step yet (final leg,\n * pre-first-NavInfo, etc.).\n */\n nextStepRoad?: string | null\n /** Total remaining distance to final destination, meters. -1 if unknown. */\n distanceToDestinationMeters?: number\n /** Total remaining travel time, seconds. -1 if unknown. */\n timeToDestinationSeconds?: number\n /** Current speed in m/s. Null if unavailable. */\n currentSpeedMps?: number | null\n /** Speed limit on the current road segment in m/s. Null if unknown / not regulated. */\n speedLimitMps?: number | null\n /** Bearing along the route at the user's current position, 0–360. Null if unknown. */\n routeHeadingDeg?: number | null\n}\n\nexport type NavErrorPayload = {\n message: string\n}\n\nexport type InstalledApp = {\n packageName: string\n appName: string\n isBlocked: boolean\n icon: string | null\n}\n\nexport type PhoneNotificationEvent = {\n notificationId: string\n app: string\n title: string\n content: string\n /**\n * Android notification priority: PRIORITY_MIN (-2) through PRIORITY_MAX (2).\n * Derived from the channel importance when the ranking is available, since\n * Notification.priority reads 0 for channel-based notifications.\n */\n priority: number\n timestamp: number\n packageName: string\n}\n\nexport type PhoneNotificationDismissedEvent = {\n notificationKey: string\n packageName: string\n notificationId: string\n}\n\nexport type CaptionsTesterIncidentEvent = {\n action?: string\n timestamp?: number\n failure_code?: string\n failure_message?: string\n test_run_id?: string\n scenario_name?: string\n source?: string\n [key: string]: unknown\n}\n\nexport type CrustViewProps = {\n url: string\n onLoad: (event: {nativeEvent: OnLoadEventPayload}) => void\n style?: StyleProp<ViewStyle>\n}\n\n/** A cookie one of the app's WebViews holds; see `getWebViewCookies`. */\nexport type WebViewCookie = {\n name: string\n value: string\n domain: string\n /** iOS reports this; Android's cookie header has no such flag, so it is always false there. */\n httpOnly: boolean\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Crust.types.js","sourceRoot":"","sources":["../src/Crust.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {StyleProp, ViewStyle} from \"react-native\"\n\nexport type OnLoadEventPayload = {\n url: string\n}\n\nexport type CrustModuleEvents = {\n onChange: (params: ChangeEventPayload) => void\n onNavManeuver: (params: NavManeuverPayload) => void\n onNavRerouting: (params: Record<string, never>) => void\n onNavArrived: (params: Record<string, never>) => void\n onNavError: (params: NavErrorPayload) => void\n onNavLocation: (params: NavLocationPayload) => void\n onNavRoute: (params: NavRoutePayload) => void\n onNavOffRoute: (params: NavOffRoutePayload) => void\n onHeading: (params: HeadingPayload) => void\n phone_lock_state: (params: PhoneLockState) => void\n}\n\n/** A rect the system reserves in the app window, in window points. */\nexport type ReservedRegion = {\n x: number\n y: number\n width: number\n height: number\n}\n\n/**\n * Whether the user can see the phone right now. iOS derives `unlocked` from\n * protected-data availability, Android from screen on + keyguard hidden.\n * Without a passcode iOS never protects data, so `unlocked` is always true\n * there and carries no information; check `passcodeSet` first.\n */\nexport type PhoneLockState = {\n unlocked: boolean\n passcodeSet: boolean\n}\n\nexport type NavOffRoutePayload = {\n /** Approximate perpendicular distance in meters from the route. */\n offRouteDistanceMeters: number\n}\n\nexport type HeadingPayload = {\n /** Compass heading in degrees, 0 = north, 90 = east. */\n degrees: number\n}\n\nexport type NavRoutePayload = {\n points: Array<{lat: number; lng: number}>\n /**\n * Ordered step list along the route, when supplied by the host. Each\n * step is one navigable segment — typically one straight stretch of\n * road ending in a maneuver. Optional for back-compat with older\n * hosts that only ship the polyline. The SDK's pivot module consumes\n * this to enrich pivots with `fromRoad` / `toRoad` metadata.\n */\n steps?: NavRouteStepPayload[]\n}\n\nexport type NavRouteStepPayload = {\n /** Coordinate where this step begins (== end of the previous step). */\n lat: number\n lng: number\n /**\n * Index into `NavRoutePayload.points[]` where this step starts.\n * Lets consumers correlate step boundaries with polyline geometry.\n */\n routeIndex: number\n /** Name of the road traversed during this step. Null when the engine has no name. */\n road?: string | null\n /**\n * Categorical maneuver performed at the END of this step (i.e. how\n * the user exits this step). Same vocabulary as `NavManeuverPayload.maneuverType`.\n */\n maneuver: string\n /** Length of this step in meters. */\n distanceMeters: number\n}\n\nexport type NavLocationPayload = {\n lat: number\n lng: number\n /** Horizontal accuracy in meters, if reported by the platform. */\n accuracy: number | null\n /** Unix ms timestamp of the fix. */\n timestamp: number\n phone_notification: (event: PhoneNotificationEvent) => void\n phone_notification_dismissed: (event: PhoneNotificationDismissedEvent) => void\n captions_tester_incident: (event: CaptionsTesterIncidentEvent) => void\n}\n\nexport type ChangeEventPayload = {\n value: string\n}\n\nexport type NavManeuverPayload = {\n /**\n * Categorical type of the upcoming maneuver. One of: STRAIGHT,\n * SLIGHT_LEFT, SLIGHT_RIGHT, TURN_LEFT, TURN_RIGHT, SHARP_LEFT,\n * SHARP_RIGHT, U_TURN, ARRIVE.\n */\n maneuverType: string\n /** Distance in meters from the user's current position to that maneuver. -1 if unknown. */\n distanceMeters: number\n /** Road the user is currently on, per the Nav SDK. Null if unavailable. */\n fromRoad?: string | null\n /**\n * Legacy \"next road\" field — historically populated from the same\n * source as `fromRoad` (the current step's road, NOT the road\n * after the upcoming turn). Kept for back-compat. New consumers\n * should read `nextStepRoad` instead.\n */\n toRoad?: string | null\n /**\n * Road the user will be on AFTER the upcoming maneuver, sourced\n * from the Nav SDK's `remainingSteps[0]`. This is the value to\n * show as the \"next street\" headline on the maneuver card. Null\n * when the SDK hasn't surfaced a remaining step yet (final leg,\n * pre-first-NavInfo, etc.).\n */\n nextStepRoad?: string | null\n /** Total remaining distance to final destination, meters. -1 if unknown. */\n distanceToDestinationMeters?: number\n /** Total remaining travel time, seconds. -1 if unknown. */\n timeToDestinationSeconds?: number\n /** Current speed in m/s. Null if unavailable. */\n currentSpeedMps?: number | null\n /** Speed limit on the current road segment in m/s. Null if unknown / not regulated. */\n speedLimitMps?: number | null\n /** Bearing along the route at the user's current position, 0–360. Null if unknown. */\n routeHeadingDeg?: number | null\n}\n\nexport type NavErrorPayload = {\n message: string\n}\n\nexport type InstalledApp = {\n packageName: string\n appName: string\n isBlocked: boolean\n icon: string | null\n}\n\nexport type PhoneNotificationEvent = {\n notificationId: string\n app: string\n title: string\n content: string\n /**\n * Android notification priority: PRIORITY_MIN (-2) through PRIORITY_MAX (2).\n * Derived from the channel importance when the ranking is available, since\n * Notification.priority reads 0 for channel-based notifications.\n */\n priority: number\n timestamp: number\n packageName: string\n notificationKey?: string\n canReply?: boolean\n}\n\nexport type PhoneNotificationDismissedEvent = {\n notificationKey: string\n packageName: string\n notificationId: string\n}\n\nexport type CaptionsTesterIncidentEvent = {\n action?: string\n timestamp?: number\n failure_code?: string\n failure_message?: string\n test_run_id?: string\n scenario_name?: string\n source?: string\n [key: string]: unknown\n}\n\nexport type CrustViewProps = {\n url: string\n onLoad: (event: {nativeEvent: OnLoadEventPayload}) => void\n style?: StyleProp<ViewStyle>\n}\n\n/** A cookie one of the app's WebViews holds; see `getWebViewCookies`. */\nexport type WebViewCookie = {\n name: string\n value: string\n domain: string\n /** iOS reports this; Android's cookie header has no such flag, so it is always false there. */\n httpOnly: boolean\n}\n"]}
|
package/build/CrustModule.d.ts
CHANGED
|
@@ -34,10 +34,13 @@ declare class CrustModule extends NativeModule<CrustModuleEvents> {
|
|
|
34
34
|
hasNotificationListenerPermission(): Promise<boolean>;
|
|
35
35
|
refreshNotificationListener(): Promise<boolean>;
|
|
36
36
|
openNotificationListenerSettings(): Promise<boolean>;
|
|
37
|
+
replyToNotification?(notificationKey: string, text: string): Promise<string | null>;
|
|
37
38
|
/** Current lock state; changes arrive as `phone_lock_state` events. */
|
|
38
39
|
getPhoneLockState(): Promise<PhoneLockState>;
|
|
39
40
|
isBetaBuild(): Promise<boolean>;
|
|
40
41
|
appMemoryLimit?(): number | null;
|
|
42
|
+
appMemoryFootprint?(): number | null;
|
|
43
|
+
appCpuSeconds?(): number | null;
|
|
41
44
|
showLocationServicesDialog(): Promise<boolean>;
|
|
42
45
|
isLocationServicesEnabled(): Promise<boolean>;
|
|
43
46
|
openLocationSettings(): Promise<boolean>;
|
|
@@ -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,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAA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,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAG1E,YAAY,IAAI,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IACtD,WAAW,IAAI,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAGrD;;;;;;;;OAQG;IACH,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IACzF,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IACjE,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1C;;;;;OAKG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IACrF,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IACxE,qEAAqE;IACrE,eAAe,IAAI,MAAM,EAAE;IAC3B,0DAA0D;IAC1D,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IACrD;;;;;OAKG;IACH,oBAAoB,IAAI,MAAM;CAC/B;;AAGD,wBAAwD"}
|
package/build/CrustModule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrustModule.js","sourceRoot":"","sources":["../src/CrustModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"CrustModule.js","sourceRoot":"","sources":["../src/CrustModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,MAAM,CAAA;AAqNtD,yDAAyD;AACzD,eAAe,mBAAmB,CAAc,OAAO,CAAC,CAAA","sourcesContent":["import {NativeModule, requireNativeModule} from \"expo\"\n\nimport type {CrustModuleEvents, InstalledApp, PhoneLockState, ReservedRegion, WebViewCookie} from \"./Crust.types\"\n\ndeclare class CrustModule extends NativeModule<CrustModuleEvents> {\n PI: number\n arrangementViewAvailable?: boolean\n hello(): string\n /**\n * iOS 27.1+: the regions the system currently occludes in the app window (the\n * Dynamic Island; on an iPhone Duo the status column down its rail, which grows\n * while the island holds a Live Activity). Empty elsewhere.\n */\n reservedRegions(): Promise<ReservedRegion[]>\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 // Glassly 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 replyToNotification?(notificationKey: string, text: string): Promise<string | null>\n /** Current lock state; changes arrive as `phone_lock_state` events. */\n getPhoneLockState(): Promise<PhoneLockState>\n isBetaBuild(): Promise<boolean>\n appMemoryLimit?(): number | null\n appMemoryFootprint?(): number | null\n appCpuSeconds?(): number | null\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 /**\n * Cookies the app's WebViews hold for `url`'s host, HttpOnly ones included\n * (a page's own JS cannot read those). Backs `session.system.webLogin`.\n */\n getWebViewCookies(url: string): Promise<WebViewCookie[]>\n /** Deletes those cookies, best effort; resolves with how many it removed. */\n clearWebViewCookies(url: string): Promise<number>\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 (both platforms via Mapbox; the dev toggles below are Android-only)\n /**\n * Override the Mapbox access token the native Navigation SDK\n * authenticates with. A non-empty token wins over the one baked at build\n * time (AndroidManifest `com.mapbox.token` / Info.plist `MBXAccessToken`);\n * \"\" clears the override and restores the baked token. Call before\n * `startNavigation` — the engine pushes the user's Settings > Keys token\n * here per trip start.\n */\n setMapboxAccessToken(token: string): Promise<{ok: boolean; error?: string}>\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 walking. */\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 * Kept for API parity with the Google-era contract. Mapbox has no\n * Terms & Conditions dialog, so no dialog is shown; resolves with\n * `{accepted: true}` once permission handling completes. Idempotent —\n * still safe (and intended) to call eagerly.\n */\n requestNavigationPermission(): Promise<{ok: boolean; accepted: boolean; error?: string}>\n\n /**\n * Dev-only: push the simulated user position off-route so the Nav SDK\n * reroutes. Only meaningful in simulate mode. Both platforms;\n * `offsetMeters` tunes the jump on Android and is ignored on iOS.\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 Mapbox 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 (both platforms)\n startHeading(): Promise<{ok: boolean; error?: string}>\n stopHeading(): Promise<{ok: boolean; error?: string}>\n\n // JS 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/jspolyfill/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 jsSpawn(packageName: string, polyfillBundle: string, miniappJs: string): Promise<boolean>\n jsEvaluate(packageName: string, source: string): Promise<unknown>\n jsKill(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 jsDispatchToJs(packageName: string, envelope: Record<string, unknown>): Promise<void>\n jsSetManifest(packageName: string, permissions: string[]): Promise<void>\n /** Diagnostic — returns the packageNames of every live JSContext. */\n jsAlivePackages(): string[]\n /** Diagnostic — force a GC cycle on the named context. */\n jsDebugForceGC(packageName: string): Promise<boolean>\n /**\n * Read the bundled JSRuntime 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 jsSpawn so\n * every JSContext starts with the same polyfill ABI.\n */\n jsLoadPolyfillBundle(): string\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<CrustModule>(\"Crust\")\n"]}
|
|
@@ -21,12 +21,15 @@ declare class CrustModule extends NativeModule<CrustModuleEvents> {
|
|
|
21
21
|
hasNotificationListenerPermission(): Promise<boolean>;
|
|
22
22
|
refreshNotificationListener(): Promise<boolean>;
|
|
23
23
|
openNotificationListenerSettings(): Promise<boolean>;
|
|
24
|
+
replyToNotification(): Promise<string>;
|
|
24
25
|
getPhoneLockState(): Promise<{
|
|
25
26
|
unlocked: boolean;
|
|
26
27
|
passcodeSet: boolean;
|
|
27
28
|
}>;
|
|
28
29
|
isBetaBuild(): Promise<boolean>;
|
|
29
30
|
appMemoryLimit(): null;
|
|
31
|
+
appMemoryFootprint(): null;
|
|
32
|
+
appCpuSeconds(): null;
|
|
30
33
|
getWebViewCookies(_url: string): Promise<never[]>;
|
|
31
34
|
clearWebViewCookies(_url: string): Promise<number>;
|
|
32
35
|
setMapboxAccessToken(_token: string): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrustModule.web.d.ts","sourceRoot":"","sources":["../src/CrustModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAC,MAAM,MAAM,CAAA;AAEpD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAEpD,cAAM,WAAY,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IACvD,EAAE,SAAU;IACN,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAG3C,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;;;;;;;;IAS1G,KAAK;IAGC,eAAe;IAGrB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IACtC,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1D,qBAAqB,CAAC,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IACrF,gBAAgB;IAGhB,gCAAgC;IAGhC,iCAAiC;IAGjC,2BAA2B;IAG3B,gCAAgC;IAGhC,iBAAiB;;;;IAGjB,WAAW;IAGjB,cAAc;
|
|
1
|
+
{"version":3,"file":"CrustModule.web.d.ts","sourceRoot":"","sources":["../src/CrustModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,YAAY,EAAC,MAAM,MAAM,CAAA;AAEpD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAEpD,cAAM,WAAY,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IACvD,EAAE,SAAU;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CHANGED
|
@@ -37,6 +37,9 @@ class CrustModule extends NativeModule {
|
|
|
37
37
|
async openNotificationListenerSettings() {
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
|
+
async replyToNotification() {
|
|
41
|
+
return "not_supported";
|
|
42
|
+
}
|
|
40
43
|
async getPhoneLockState() {
|
|
41
44
|
return { unlocked: true, passcodeSet: false };
|
|
42
45
|
}
|
|
@@ -46,6 +49,12 @@ class CrustModule extends NativeModule {
|
|
|
46
49
|
appMemoryLimit() {
|
|
47
50
|
return null;
|
|
48
51
|
}
|
|
52
|
+
appMemoryFootprint() {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
appCpuSeconds() {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
49
58
|
async getWebViewCookies(_url) {
|
|
50
59
|
return [];
|
|
51
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrustModule.web.js","sourceRoot":"","sources":["../src/CrustModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,MAAM,CAAA;AAIpD,MAAM,WAAY,SAAQ,YAA+B;IACvD,EAAE,GAAG,IAAI,CAAC,EAAE,CAAA;IACZ,KAAK,CAAC,aAAa,CAAC,KAAa;QAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAC,KAAK,EAAC,CAAC,CAAA;IAChC,CAAC;IACD,KAAK,CAAC,iBAAiB,CAAC,MAAc,EAAE,GAAW,EAAE,OAA+B,EAAE,IAAoB;QACxG,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAA;QAC1D,OAAO;YACL,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAA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CAAC;IACD,KAAK,CAAC,UAAU,CAAC,IAAY,EAAE,IAAY;QACzC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,OAAM;IACR,CAAC;IACD,KAAK,CAAC,cAAc,CAAC,IAAY,EAAE,IAA6B;QAC9D,OAAM;IACR,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,IAAY,EAAE,MAAgB;QAChD,OAAM;IACR,CAAC;IACD,eAAe;QACb,OAAO,EAAE,CAAA;IACX,CAAC;IACD,KAAK,CAAC,cAAc,CAAC,IAAY;QAC/B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,oBAAoB;QAClB,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAED,eAAe,iBAAiB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA","sourcesContent":["import {registerWebModule, NativeModule} from \"expo\"\n\nimport type {CrustModuleEvents} from \"./Crust.types\"\n\nclass CrustModule extends NativeModule<CrustModuleEvents> {\n PI = Math.PI\n async setValueAsync(value: string): Promise<void> {\n this.emit(\"onChange\", {value})\n }\n async nativeHttpRequest(method: string, url: string, headers: Record<string, string>, body?: string | null) {\n const response = await fetch(url, {method, headers, body})\n return {\n status: response.status,\n statusText: response.statusText,\n headers: Object.fromEntries(response.headers.entries()),\n body: await response.text(),\n }\n }\n hello() {\n return \"Hello world! 👋\"\n }\n async reservedRegions() {\n return []\n }\n showAVRoutePicker(_tintColor?: string | null) {}\n async setDeferredSystemGestures(_edges: string[]): Promise<void> {}\n async setNotificationConfig(_listenerEnabled: boolean, _blocklist: string[]): Promise<void> {}\n async getInstalledApps() {\n return []\n }\n async getInstalledAppsForNotifications() {\n return []\n }\n async hasNotificationListenerPermission() {\n return false\n }\n async refreshNotificationListener() {\n return false\n }\n async openNotificationListenerSettings() {\n return false\n }\n async getPhoneLockState() {\n return {unlocked: true, passcodeSet: false}\n }\n async isBetaBuild() {\n return false\n }\n appMemoryLimit() {\n return null\n }\n async getWebViewCookies(_url: string) {\n return []\n }\n async clearWebViewCookies(_url: string) {\n return 0\n }\n async setMapboxAccessToken(_token: string) {\n return {ok: false, error: \"Not supported on web\"}\n }\n async jsSpawn(_pkg: string, _polyfill: string, _miniappJs: string) {\n return false\n }\n async jsEvaluate(_pkg: string, _src: string) {\n return null\n }\n async jsKill(_pkg: string) {\n return\n }\n async jsDispatchToJs(_pkg: string, _env: Record<string, unknown>) {\n return\n }\n async jsSetManifest(_pkg: string, _perms: string[]) {\n return\n }\n jsAlivePackages() {\n return []\n }\n async jsDebugForceGC(_pkg: string) {\n return false\n }\n jsLoadPolyfillBundle() {\n return \"\"\n }\n}\n\nexport default registerWebModule(CrustModule, \"CrustModule\")\n"]}
|
|
1
|
+
{"version":3,"file":"CrustModule.web.js","sourceRoot":"","sources":["../src/CrustModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,MAAM,CAAA;AAIpD,MAAM,WAAY,SAAQ,YAA+B;IACvD,EAAE,GAAG,IAAI,CAAC,EAAE,CAAA;IACZ,KAAK,CAAC,aAAa,CAAC,KAAa;QAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAC,KAAK,EAAC,CAAC,CAAA;IAChC,CAAC;IACD,KAAK,CAAC,iBAAiB,CAAC,MAAc,EAAE,GAAW,EAAE,OAA+B,EAAE,IAAoB;QACxG,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAA;QAC1D,OAAO;YACL,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACvD,IAAI,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;SAC5B,CAAA;IACH,CAAC;IACD,KAAK;QAC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E,SAAiB,EAAE,UAAkB;QAC/D,OAAO,KAAK,CAAA;IACd,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,IAAY,EAAE,IAAY;QACzC,OAAO,IAAI,CAAA;IACb,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,OAAM;IACR,CAAC;IACD,KAAK,CAAC,cAAc,CAAC,IAAY,EAAE,IAA6B;QAC9D,OAAM;IACR,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,IAAY,EAAE,MAAgB;QAChD,OAAM;IACR,CAAC;IACD,eAAe;QACb,OAAO,EAAE,CAAA;IACX,CAAC;IACD,KAAK,CAAC,cAAc,CAAC,IAAY;QAC/B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,oBAAoB;QAClB,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAED,eAAe,iBAAiB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA","sourcesContent":["import {registerWebModule, NativeModule} from \"expo\"\n\nimport type {CrustModuleEvents} from \"./Crust.types\"\n\nclass CrustModule extends NativeModule<CrustModuleEvents> {\n PI = Math.PI\n async setValueAsync(value: string): Promise<void> {\n this.emit(\"onChange\", {value})\n }\n async nativeHttpRequest(method: string, url: string, headers: Record<string, string>, body?: string | null) {\n const response = await fetch(url, {method, headers, body})\n return {\n status: response.status,\n statusText: response.statusText,\n headers: Object.fromEntries(response.headers.entries()),\n body: await response.text(),\n }\n }\n hello() {\n return \"Hello world! 👋\"\n }\n async reservedRegions() {\n return []\n }\n showAVRoutePicker(_tintColor?: string | null) {}\n async setDeferredSystemGestures(_edges: string[]): Promise<void> {}\n async setNotificationConfig(_listenerEnabled: boolean, _blocklist: string[]): Promise<void> {}\n async getInstalledApps() {\n return []\n }\n async getInstalledAppsForNotifications() {\n return []\n }\n async hasNotificationListenerPermission() {\n return false\n }\n async refreshNotificationListener() {\n return false\n }\n async openNotificationListenerSettings() {\n return false\n }\n async replyToNotification() {\n return \"not_supported\"\n }\n async getPhoneLockState() {\n return {unlocked: true, passcodeSet: false}\n }\n async isBetaBuild() {\n return false\n }\n appMemoryLimit() {\n return null\n }\n appMemoryFootprint() {\n return null\n }\n appCpuSeconds() {\n return null\n }\n async getWebViewCookies(_url: string) {\n return []\n }\n async clearWebViewCookies(_url: string) {\n return 0\n }\n async setMapboxAccessToken(_token: string) {\n return {ok: false, error: \"Not supported on web\"}\n }\n async jsSpawn(_pkg: string, _polyfill: string, _miniappJs: string) {\n return false\n }\n async jsEvaluate(_pkg: string, _src: string) {\n return null\n }\n async jsKill(_pkg: string) {\n return\n }\n async jsDispatchToJs(_pkg: string, _env: Record<string, unknown>) {\n return\n }\n async jsSetManifest(_pkg: string, _perms: string[]) {\n return\n }\n jsAlivePackages() {\n return []\n }\n async jsDebugForceGC(_pkg: string) {\n return false\n }\n jsLoadPolyfillBundle() {\n return \"\"\n }\n}\n\nexport default registerWebModule(CrustModule, \"CrustModule\")\n"]}
|
package/ios/CrustModule.swift
CHANGED
|
@@ -66,6 +66,9 @@ private struct PhotoLibrarySaveResult {
|
|
|
66
66
|
|
|
67
67
|
public class CrustModule: Module {
|
|
68
68
|
private var protectedDataObservers: [NSObjectProtocol] = []
|
|
69
|
+
private static let jsRuntimeQueue = DispatchQueue(
|
|
70
|
+
label: "com.tetramo.glassly.jsruntime.host-calls", qos: .userInitiated
|
|
71
|
+
)
|
|
69
72
|
|
|
70
73
|
/// Phone lock state as seen by the app. Protected data (complete-protection
|
|
71
74
|
/// files) is only readable/writable while the phone is unlocked, which makes
|
|
@@ -405,7 +408,7 @@ public class CrustModule: Module {
|
|
|
405
408
|
polyfillBundle: polyfillBundle,
|
|
406
409
|
miniappJs: miniappJs
|
|
407
410
|
)
|
|
408
|
-
}
|
|
411
|
+
}.runOnQueue(Self.jsRuntimeQueue)
|
|
409
412
|
|
|
410
413
|
/// Evaluate an arbitrary script inside the named context. Returns
|
|
411
414
|
/// the JS return value bridged to a JSON-friendly Swift type, or
|
|
@@ -413,19 +416,19 @@ public class CrustModule: Module {
|
|
|
413
416
|
/// + tests; production code paths use jsDispatchToJs.
|
|
414
417
|
AsyncFunction("jsEvaluate") { (packageName: String, source: String) -> Any? in
|
|
415
418
|
return JSCRuntime.shared.evaluate(packageName: packageName, source: source)
|
|
416
|
-
}
|
|
419
|
+
}.runOnQueue(Self.jsRuntimeQueue)
|
|
417
420
|
|
|
418
421
|
/// Tear down a JS context. Cancels timers, drops refs, forces GC.
|
|
419
422
|
AsyncFunction("jsKill") { (packageName: String) -> Void in
|
|
420
423
|
JSCRuntime.shared.kill(packageName: packageName)
|
|
421
|
-
}
|
|
424
|
+
}.runOnQueue(Self.jsRuntimeQueue)
|
|
422
425
|
|
|
423
426
|
/// Push an event / response envelope into the named context's
|
|
424
427
|
/// globalThis.__deliver. Used by JSRouter for
|
|
425
428
|
/// glasses-status broadcasts and request/response correlation.
|
|
426
429
|
AsyncFunction("jsDispatchToJs") { (packageName: String, envelope: [String: Any]) -> Void in
|
|
427
430
|
JSCRuntime.shared.dispatchToJs(packageName: packageName, envelope: envelope)
|
|
428
|
-
}
|
|
431
|
+
}.runOnQueue(Self.jsRuntimeQueue)
|
|
429
432
|
|
|
430
433
|
/// Set the installed manifest for a miniapp so the dispatcher's
|
|
431
434
|
/// permission gate can authorize sensitive `__dispatch` calls.
|
|
@@ -434,7 +437,7 @@ public class CrustModule: Module {
|
|
|
434
437
|
packageName: packageName,
|
|
435
438
|
manifest: InstalledMiniappManifest(permissions: Set(permissions))
|
|
436
439
|
)
|
|
437
|
-
}
|
|
440
|
+
}.runOnQueue(Self.jsRuntimeQueue)
|
|
438
441
|
|
|
439
442
|
/// Diagnostic: list all live packageNames.
|
|
440
443
|
Function("jsAlivePackages") { () -> [String] in
|
|
@@ -446,7 +449,7 @@ public class CrustModule: Module {
|
|
|
446
449
|
/// the context is dead.
|
|
447
450
|
AsyncFunction("jsDebugForceGC") { (packageName: String) -> Bool in
|
|
448
451
|
return JSCRuntime.shared.debugForceGC(packageName: packageName)
|
|
449
|
-
}
|
|
452
|
+
}.runOnQueue(Self.jsRuntimeQueue)
|
|
450
453
|
|
|
451
454
|
/// Read the bundled JSRuntime polyfill (startup.js) from the iOS
|
|
452
455
|
/// pod's resource bundle. The host calls this once on app boot,
|
|
@@ -462,16 +465,16 @@ public class CrustModule: Module {
|
|
|
462
465
|
// plus os_proc_available_memory. nil on the simulator, which reports 0.
|
|
463
466
|
Function("appMemoryLimit") { () -> Double? in
|
|
464
467
|
let available = os_proc_available_memory()
|
|
465
|
-
guard available > 0 else { return nil }
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
468
|
+
guard available > 0, let footprint = appMemoryFootprintBytes() else { return nil }
|
|
469
|
+
return Double(available) + footprint
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
Function("appMemoryFootprint") { () -> Double? in
|
|
473
|
+
appMemoryFootprintBytes()
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
Function("appCpuSeconds") { () -> Double? in
|
|
477
|
+
appCpuSeconds()
|
|
475
478
|
}
|
|
476
479
|
|
|
477
480
|
// MARK: - Build Environment
|
|
@@ -939,3 +942,23 @@ enum WebViewCookies {
|
|
|
939
942
|
return host == domain || host.hasSuffix("." + domain)
|
|
940
943
|
}
|
|
941
944
|
}
|
|
945
|
+
|
|
946
|
+
private func appCpuSeconds() -> Double? {
|
|
947
|
+
var usage = rusage()
|
|
948
|
+
guard getrusage(RUSAGE_SELF, &usage) == 0 else { return nil }
|
|
949
|
+
let seconds = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec
|
|
950
|
+
let microseconds = Int(usage.ru_utime.tv_usec) + Int(usage.ru_stime.tv_usec)
|
|
951
|
+
return Double(seconds) + Double(microseconds) / 1_000_000
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
private func appMemoryFootprintBytes() -> Double? {
|
|
955
|
+
var info = task_vm_info_data_t()
|
|
956
|
+
var count = mach_msg_type_number_t(MemoryLayout<task_vm_info_data_t>.size / MemoryLayout<integer_t>.size)
|
|
957
|
+
let result = withUnsafeMutablePointer(to: &info) { pointer in
|
|
958
|
+
pointer.withMemoryRebound(to: integer_t.self, capacity: Int(count)) {
|
|
959
|
+
task_info(mach_task_self_, task_flavor_t(TASK_VM_INFO), $0, &count)
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
guard result == KERN_SUCCESS else { return nil }
|
|
963
|
+
return Double(info.phys_footprint)
|
|
964
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glassly/crust",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5-beta.1391",
|
|
4
4
|
"description": "Glassly Native Module",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"homepage": "https://github.com/fossephate/crust#readme",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@glassly/jspolyfill": "0.4.
|
|
37
|
+
"@glassly/jspolyfill": "0.4.5-beta.1391"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@expo/config-plugins": ">=8.0.0",
|
package/src/Crust.types.ts
CHANGED
package/src/CrustModule.ts
CHANGED
|
@@ -39,10 +39,13 @@ declare class CrustModule extends NativeModule<CrustModuleEvents> {
|
|
|
39
39
|
hasNotificationListenerPermission(): Promise<boolean>
|
|
40
40
|
refreshNotificationListener(): Promise<boolean>
|
|
41
41
|
openNotificationListenerSettings(): Promise<boolean>
|
|
42
|
+
replyToNotification?(notificationKey: string, text: string): Promise<string | null>
|
|
42
43
|
/** Current lock state; changes arrive as `phone_lock_state` events. */
|
|
43
44
|
getPhoneLockState(): Promise<PhoneLockState>
|
|
44
45
|
isBetaBuild(): Promise<boolean>
|
|
45
46
|
appMemoryLimit?(): number | null
|
|
47
|
+
appMemoryFootprint?(): number | null
|
|
48
|
+
appCpuSeconds?(): number | null
|
|
46
49
|
// location services commands
|
|
47
50
|
showLocationServicesDialog(): Promise<boolean>
|
|
48
51
|
isLocationServicesEnabled(): Promise<boolean>
|
package/src/CrustModule.web.ts
CHANGED
|
@@ -40,6 +40,9 @@ class CrustModule extends NativeModule<CrustModuleEvents> {
|
|
|
40
40
|
async openNotificationListenerSettings() {
|
|
41
41
|
return false
|
|
42
42
|
}
|
|
43
|
+
async replyToNotification() {
|
|
44
|
+
return "not_supported"
|
|
45
|
+
}
|
|
43
46
|
async getPhoneLockState() {
|
|
44
47
|
return {unlocked: true, passcodeSet: false}
|
|
45
48
|
}
|
|
@@ -49,6 +52,12 @@ class CrustModule extends NativeModule<CrustModuleEvents> {
|
|
|
49
52
|
appMemoryLimit() {
|
|
50
53
|
return null
|
|
51
54
|
}
|
|
55
|
+
appMemoryFootprint() {
|
|
56
|
+
return null
|
|
57
|
+
}
|
|
58
|
+
appCpuSeconds() {
|
|
59
|
+
return null
|
|
60
|
+
}
|
|
52
61
|
async getWebViewCookies(_url: string) {
|
|
53
62
|
return []
|
|
54
63
|
}
|