@quiesco/native 0.4.2 → 0.5.0
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.
|
@@ -43,6 +43,8 @@ class QuiescoNativeModule : Module() {
|
|
|
43
43
|
override fun definition() = ModuleDefinition {
|
|
44
44
|
Name("QuiescoNative")
|
|
45
45
|
|
|
46
|
+
OnCreate { deliverLaunchUrl() }
|
|
47
|
+
|
|
46
48
|
// docs/spikes/05: `am start ... --es quiescoPort <p> --es quiescoSession <id>`. The current intent may
|
|
47
49
|
// have lost the extras (dev client relaunch), so fall back to what QuiescoNativePackage captured.
|
|
48
50
|
Function("getLaunchParams") {
|
|
@@ -409,6 +411,33 @@ class QuiescoNativeModule : Module() {
|
|
|
409
411
|
private fun clipboard(): ClipboardManager? =
|
|
410
412
|
appContext.reactContext?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
|
|
411
413
|
|
|
414
|
+
/**
|
|
415
|
+
* `app.device.relaunch({ url })` with a dev client: `--es quiescoUrl <url>` becomes the URL the app was
|
|
416
|
+
* opened with. The dev client is started with its own `expo-development-client/?url=<metro>` link
|
|
417
|
+
* (expo-dev-launcher before 58 cannot take a deep link plus the bundle URL in one), so when this module is
|
|
418
|
+
* created — after the activity's listeners, before the bundle runs — the link replaces the activity
|
|
419
|
+
* intent's data, which React Native's `Linking.getInitialURL()` reads (and expo-router on Android
|
|
420
|
+
* through it), and is set as expo-linking's initial URL (`getLinkingURL()`). expo-linking is looked up at
|
|
421
|
+
* runtime: no build dependency on it.
|
|
422
|
+
*/
|
|
423
|
+
private fun deliverLaunchUrl() {
|
|
424
|
+
val activity = appContext.currentActivity
|
|
425
|
+
LaunchParamsStore.capture(activity?.intent)
|
|
426
|
+
val raw = LaunchParamsStore.url ?: return
|
|
427
|
+
val uri = android.net.Uri.parse(raw)
|
|
428
|
+
activity?.intent?.let {
|
|
429
|
+
it.action = Intent.ACTION_VIEW
|
|
430
|
+
it.data = uri
|
|
431
|
+
}
|
|
432
|
+
try {
|
|
433
|
+
val companion = Class.forName("expo.modules.linking.ExpoLinkingModule").getField("Companion").get(null)
|
|
434
|
+
companion.javaClass.getMethod("setInitialURL", android.net.Uri::class.java).invoke(companion, uri)
|
|
435
|
+
} catch (_: ReflectiveOperationException) {
|
|
436
|
+
// no expo-linking: React Native's Linking has the link
|
|
437
|
+
}
|
|
438
|
+
android.util.Log.i("Quiesco", "launch URL delivered${if (activity == null) " to expo-linking only (no activity)" else ""}: $raw")
|
|
439
|
+
}
|
|
440
|
+
|
|
412
441
|
private fun density(): Float = appContext.reactContext?.resources?.displayMetrics?.density ?: 1f
|
|
413
442
|
|
|
414
443
|
private fun findView(tag: Int): View? {
|
|
@@ -21,6 +21,9 @@ object LaunchParamsStore {
|
|
|
21
21
|
/** Base64 of the test's launch arguments as JSON (`--es quiescoArgs`, Phase 6.5). */
|
|
22
22
|
@Volatile var args: String? = null
|
|
23
23
|
private set
|
|
24
|
+
/** The deep link to start with (`--es quiescoUrl`, `app.device.relaunch({ url })` with a dev client). */
|
|
25
|
+
@Volatile var url: String? = null
|
|
26
|
+
private set
|
|
24
27
|
|
|
25
28
|
/** Remember the parameters of `intent` when it has them (a newer launch replaces older ones). */
|
|
26
29
|
fun capture(intent: Intent?) {
|
|
@@ -28,6 +31,7 @@ object LaunchParamsStore {
|
|
|
28
31
|
port = p
|
|
29
32
|
session = intent.getStringExtra("quiescoSession")
|
|
30
33
|
args = intent.getStringExtra("quiescoArgs")
|
|
34
|
+
url = intent.getStringExtra("quiescoUrl")
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -10,7 +10,9 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
s.author = 'Quiesco'
|
|
12
12
|
s.homepage = 'https://github.com/quiesco/quiesco'
|
|
13
|
-
|
|
13
|
+
# 15.1: the oldest default deployment target of the supported Expo SDKs (55); autolinking skips a pod
|
|
14
|
+
# whose platform is newer than the app's, silently (.planning/2026-11-16-expo-sdk-55-57).
|
|
15
|
+
s.platforms = { :ios => '15.1' }
|
|
14
16
|
s.source = { git: '' }
|
|
15
17
|
s.static_framework = true
|
|
16
18
|
|
|
@@ -449,7 +449,7 @@ public class QuiescoNativeModule: Module {
|
|
|
449
449
|
* `decrement` through UIAccessibilityAction (the adjustable swipe), `magicTap` / `escape` through
|
|
450
450
|
* their perform methods, any other through the view's accessibilityCustomActions (the VoiceOver
|
|
451
451
|
* "Actions" rotor) at `index` — React Native lists every declared action there, named by its label
|
|
452
|
-
* (`label`, or the name when it has none).
|
|
452
|
+
* (`label`, or the name when it has none; React Native before 0.88, Expo SDK 55–57: by its name).
|
|
453
453
|
*/
|
|
454
454
|
AsyncFunction("accessibilityAction") { (tag: Int, name: String, label: String, index: Int, _customIndex: Int, promise: Promise) in
|
|
455
455
|
guard let view = QSTouchInjector.view(withReactTag: tag) else {
|
|
@@ -469,8 +469,9 @@ public class QuiescoNativeModule: Module {
|
|
|
469
469
|
promise.resolve(["performed": view.accessibilityPerformEscape(), "via": "accessibilityPerformEscape"])
|
|
470
470
|
default:
|
|
471
471
|
let actions = view.accessibilityCustomActions ?? []
|
|
472
|
-
let
|
|
473
|
-
|
|
472
|
+
let named = { (a: UIAccessibilityCustomAction) in a.name == label || a.name == name }
|
|
473
|
+
let byIndex = index >= 0 && index < actions.count && named(actions[index]) ? actions[index] : nil
|
|
474
|
+
guard let action = byIndex ?? actions.first(where: { $0.name == label }) ?? actions.first(where: { $0.name == name }) else {
|
|
474
475
|
promise.reject("E_NO_ACTION", "view \(tag) has no accessibility custom action \"\(label)\" (has: \(actions.map { $0.name }))")
|
|
475
476
|
return
|
|
476
477
|
}
|