@blotch/angular-lynx-native 22.3.1 → 22.3.3

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.
Files changed (123) hide show
  1. package/README.md +47 -15
  2. package/dist/android/project.d.ts +114 -1
  3. package/dist/android/project.d.ts.map +1 -1
  4. package/dist/android/project.js +440 -5
  5. package/dist/eject.d.ts +15 -1
  6. package/dist/eject.d.ts.map +1 -1
  7. package/dist/eject.js +14 -2
  8. package/dist/features.d.ts +70 -0
  9. package/dist/features.d.ts.map +1 -0
  10. package/dist/features.js +115 -0
  11. package/dist/files.d.ts +24 -0
  12. package/dist/files.d.ts.map +1 -0
  13. package/dist/files.js +41 -0
  14. package/dist/generate.d.ts +34 -3
  15. package/dist/generate.d.ts.map +1 -1
  16. package/dist/generate.js +78 -19
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +16 -2
  20. package/dist/ios/build.d.ts.map +1 -1
  21. package/dist/ios/build.js +8 -2
  22. package/dist/ios/frameworks.d.ts +6 -5
  23. package/dist/ios/frameworks.d.ts.map +1 -1
  24. package/dist/ios/frameworks.js +46 -15
  25. package/dist/ios/project.d.ts +192 -11
  26. package/dist/ios/project.d.ts.map +1 -1
  27. package/dist/ios/project.js +823 -33
  28. package/dist/options.d.ts +208 -1
  29. package/dist/options.d.ts.map +1 -1
  30. package/dist/options.js +154 -0
  31. package/dist/permissions.d.ts +18 -1
  32. package/dist/permissions.d.ts.map +1 -1
  33. package/dist/permissions.js +79 -4
  34. package/dist/plugins.d.ts +245 -0
  35. package/dist/plugins.d.ts.map +1 -0
  36. package/dist/plugins.js +1244 -0
  37. package/package.json +1 -1
  38. package/templates/android/README.md +46 -5
  39. package/templates/android/angular-lynx.properties +2 -0
  40. package/templates/android/app/build.gradle.kts +78 -11
  41. package/templates/android/app/src/main/AndroidManifest.xml +19 -3
  42. package/templates/android/app/src/main/java/dev/angularlynx/shell/AngularLynxPlugins.kt +13 -0
  43. package/templates/android/app/src/main/java/dev/angularlynx/shell/AudioRecorderModule.kt +520 -0
  44. package/templates/android/app/src/main/java/dev/angularlynx/shell/BarcodeScannerModule.kt +144 -0
  45. package/templates/android/app/src/main/java/dev/angularlynx/shell/BiometricsModule.kt +433 -0
  46. package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapPresenter.kt +98 -0
  47. package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapRendererContext.kt +175 -0
  48. package/templates/android/app/src/main/java/dev/angularlynx/shell/BluetoothModule.kt +1288 -0
  49. package/templates/android/app/src/main/java/dev/angularlynx/shell/CalendarModule.kt +127 -0
  50. package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DContext.kt +1557 -0
  51. package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DOps.kt +63 -0
  52. package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasFilter.kt +357 -0
  53. package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasUI.kt +4 -3
  54. package/templates/android/app/src/main/java/dev/angularlynx/shell/EdgeToEdgeOverlay.kt +24 -0
  55. package/templates/android/app/src/main/java/dev/angularlynx/shell/EngineThreadHint.kt +156 -0
  56. package/templates/android/app/src/main/java/dev/angularlynx/shell/FilePickerModule.kt +263 -0
  57. package/templates/android/app/src/main/java/dev/angularlynx/shell/GeolocationModule.kt +557 -0
  58. package/templates/android/app/src/main/java/dev/angularlynx/shell/HapticsModule.kt +82 -0
  59. package/templates/android/app/src/main/java/dev/angularlynx/shell/HostElementUI.kt +331 -0
  60. package/templates/android/app/src/main/java/dev/angularlynx/shell/ImagePickerModule.kt +143 -0
  61. package/templates/android/app/src/main/java/dev/angularlynx/shell/ImagePipeline.kt +83 -0
  62. package/templates/android/app/src/main/java/dev/angularlynx/shell/MainActivity.kt +523 -9
  63. package/templates/android/app/src/main/java/dev/angularlynx/shell/ModuleBytes.kt +58 -0
  64. package/templates/android/app/src/main/java/dev/angularlynx/shell/MotionModule.kt +332 -0
  65. package/templates/android/app/src/main/java/dev/angularlynx/shell/NetworkStatus.kt +121 -0
  66. package/templates/android/app/src/main/java/dev/angularlynx/shell/NfcModule.kt +274 -0
  67. package/templates/android/app/src/main/java/dev/angularlynx/shell/PermissionRequests.kt +35 -0
  68. package/templates/android/app/src/main/java/dev/angularlynx/shell/PhotoLibraryModule.kt +355 -0
  69. package/templates/android/app/src/main/java/dev/angularlynx/shell/ShareTargetModule.kt +234 -0
  70. package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellApplication.kt +7 -8
  71. package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellModule.kt +58 -4
  72. package/templates/android/app/src/main/java/dev/angularlynx/shell/StoreReviewModule.kt +66 -0
  73. package/templates/android/app/src/main/java/dev/angularlynx/shell/SystemFontFamilies.kt +68 -0
  74. package/templates/android/app/src/main/java/dev/angularlynx/shell/TrackingModule.kt +74 -0
  75. package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoFrameTarget.kt +429 -0
  76. package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoUI.kt +676 -0
  77. package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLContext.kt +128 -13
  78. package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLModule.kt +493 -65
  79. package/templates/android/app/src/main/java/dev/angularlynx/shell/WifiModule.kt +429 -0
  80. package/templates/android/app/src/main/res/values/biometrics.xml +9 -0
  81. package/templates/android/app/src/main/res/values/share_target.xml +11 -0
  82. package/templates/android/app/src/main/res/xml/backup_rules.xml +5 -3
  83. package/templates/android/app/src/main/res/xml/data_extraction_rules.xml +6 -3
  84. package/templates/android/app/src/main/res/xml/share_paths.xml +7 -2
  85. package/templates/android/build.gradle.kts +1 -1
  86. package/templates/android/gradle/wrapper/gradle-wrapper.properties +2 -2
  87. package/templates/ios/App/AngularLynxBitmapRendererContext.m +188 -0
  88. package/templates/ios/App/AngularLynxCanvas2DContext.m +2467 -0
  89. package/templates/ios/App/AngularLynxCanvas2DOps.h +61 -0
  90. package/templates/ios/App/AngularLynxPlugins.swift +22 -0
  91. package/templates/ios/App/AngularLynxVideo.h +37 -0
  92. package/templates/ios/App/AngularLynxVideo.m +435 -0
  93. package/templates/ios/App/AngularLynxWebGL.h +69 -7
  94. package/templates/ios/App/AngularLynxWebGL.m +538 -29
  95. package/templates/ios/App/AngularLynxWebGLContext.m +148 -46
  96. package/templates/ios/App/AnimationFrameRate.swift +66 -0
  97. package/templates/ios/App/AppDelegate.swift +37 -3
  98. package/templates/ios/App/AppleSignInButton.swift +106 -0
  99. package/templates/ios/App/AppleSignInModule.swift +222 -0
  100. package/templates/ios/App/AudioRecorderModule.swift +433 -0
  101. package/templates/ios/App/BarcodeScannerModule.swift +284 -0
  102. package/templates/ios/App/BiometricsModule.swift +256 -0
  103. package/templates/ios/App/BluetoothModule.swift +1086 -0
  104. package/templates/ios/App/CalendarModule.swift +158 -0
  105. package/templates/ios/App/FilePickerModule.swift +240 -0
  106. package/templates/ios/App/GeolocationModule.swift +455 -0
  107. package/templates/ios/App/HapticsModule.swift +90 -0
  108. package/templates/ios/App/HostElementUI.swift +270 -0
  109. package/templates/ios/App/ImagePickerModule.swift +160 -1
  110. package/templates/ios/App/Info.plist +2 -0
  111. package/templates/ios/App/LynxViewController.swift +274 -9
  112. package/templates/ios/App/MotionModule.swift +430 -0
  113. package/templates/ios/App/NetworkStatus.swift +41 -0
  114. package/templates/ios/App/NfcModule.swift +346 -0
  115. package/templates/ios/App/PhotoLibraryModule.swift +169 -0
  116. package/templates/ios/App/ShareTargetModule.swift +150 -0
  117. package/templates/ios/App/ShellModule.swift +17 -0
  118. package/templates/ios/App/StoreReviewModule.swift +61 -0
  119. package/templates/ios/App/TrackingModule.swift +121 -0
  120. package/templates/ios/App/WifiModule.swift +237 -0
  121. package/templates/ios/App/XElementRegistry.swift +13 -3
  122. package/templates/ios/ShareExtension/Info.plist +42 -0
  123. package/templates/ios/ShareExtension/ShareViewController.swift +387 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotch/angular-lynx-native",
3
- "version": "22.3.1",
3
+ "version": "22.3.3",
4
4
  "description": "Builds AngularLynx apps into iOS and Android binaries",
5
5
  "homepage": "https://github.com/Blotch-Smart-Frames/AngularLynx#readme",
6
6
  "bugs": {
@@ -10,7 +10,7 @@ The app is one activity holding one full-screen `LynxView` that runs `main.lynx.
10
10
  | --------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
11
  | The bundle | `app/src/main/assets/` | The whole `dist/` folder (`main.lynx.bundle`, `static/…`), copied after emptying the folder. Bundled files are read from here. |
12
12
  | App identity | `angular-lynx.properties` | Keys: `applicationId`, `versionName`, `versionCode`, `appName`, `screenOrientation` (`portrait`, `sensorLandscape` or `unspecified`). Read by `app/build.gradle.kts`. The committed file holds defaults. |
13
- | Permissions | `AndroidManifest.xml`, at `<!-- angular-lynx:permissions -->` | `<uses-permission>` lines. `INTERNET` is always declared. |
13
+ | Permissions | `AndroidManifest.xml`, at `<!-- angular-lynx:permissions -->` | `<uses-permission>` lines. `INTERNET` and `ACCESS_NETWORK_STATE` are always declared. |
14
14
  | Deep links | `AndroidManifest.xml`, at `<!-- angular-lynx:deep-links -->` | `<intent-filter>`s inside the main activity. |
15
15
  | Shortcuts | `res/xml/shortcuts.xml`, `res/values/shortcuts.xml` | One `<shortcut>` per entry of angular.json's `shortcuts`, and a string for its title. The committed `shortcuts.xml` is an empty list. |
16
16
  | Splash screen | `res/values*/colors.xml`, `res/drawable-*/splash_icon.png` | angular.json's `splash`: its colors as `window_background` (`values/`, `values-night/`), and its image drawn on a transparent 288 dp canvas at each density, in place of `res/values/splash.xml`'s alias to the launcher icon. |
@@ -27,23 +27,27 @@ Build commands and outputs (no flavors, so the names are fixed):
27
27
 
28
28
  The release build runs R8 and the resource shrinker (`isMinifyEnabled`, `isShrinkResources`), and writes the mapping that turns the renamed classes back to `app/build/outputs/mapping/release/mapping.txt`, which also goes in the `.aab` for Google Play. Lynx's AAR ships keep rules for its own classes; `app/proguard-rules.pro` adds the ones they miss, each with what broke without it (the app aborting on launch, for one). Any class Lynx or the shell reaches only by name needs a rule there. How they were found, and the sizes, are in `investigations/native-app-builds.md` ("R8 in the Android release build").
29
29
 
30
- A release build signed with the upload key holds only `arm64-v8a` and `armeabi-v7a` (`ndk.abiFilters`). Google Play rejects an app whose 64-bit native libraries aren't aligned for 16 KB memory pages, and Fresco's `x86_64` libraries, at the version Lynx's image service is written against, are aligned for 4 KB only; its `arm64-v8a` ones, and all of Lynx's, are fine. So Play doesn't offer the app to x86 devices (emulators and a few Chromebooks). A release build signed with the debug key keeps all four ABIs, so its APK still installs on an `x86_64` emulator. Drop the filter once the image service moves to a Fresco whose `x86_64` libraries are 16 KB aligned.
30
+ A release build signed with the upload key holds only `arm64-v8a` and `armeabi-v7a` (`ndk.abiFilters`). Google Play rejects an app whose 64-bit native libraries' LOAD segments aren't aligned for 16 KB memory pages, and Fresco's `x86_64` libraries, at the version Lynx's image service is written against, are aligned for 4 KB only; its `arm64-v8a` ones, and all of Lynx's, pass. So Play doesn't offer the app to x86 devices (emulators and a few Chromebooks). A release build signed with the debug key keeps all four ABIs, so its APK still installs on an `x86_64` emulator. Drop the filter once the image service moves to a Fresco whose `x86_64` libraries are 16 KB aligned.
31
+
32
+ Passing Play's check isn't the same as loading with 16 KB pages. Fresco 2.3's `arm64-v8a` libraries have a 64 KB `p_align`, but `libimagepipeline.so`, `libgifimage.so`, `libnative-filters.so` and `libstatic-webp.so` each put their RELRO and their writable data in one segment, with the RELRO ending on a 4 or 8 KB boundary. Android 17's linker refuses them on a phone with 16 KB pages (`program alignment (8192) cannot be smaller than system page size (16384)`), and with Fresco's defaults the `UnsatisfiedLinkError` ends the app at its first `<image>`. Fresco 3.4 and later are 16 KB safe, but Fresco 3 isn't binary compatible with Lynx's image service: `CloseableImage` and `CloseableBitmap` became interfaces, so the service fails verification at its first bitmap. So `ImagePipeline.kt` configures Fresco 2.3 for a phone with pages larger than 4 KB: encoded images in Java memory rather than `libimagepipeline.so`'s, no native transcoder, and GIF and animated WebP decoded as their first frame by Android's `BitmapFactory`, which also means no `bindstartplay` or loop events there. Lynx's `blur-radius` copies the bitmap with `libimagepipeline.so` itself, so an image with it still ends the app on those phones. Phones with 4 KB pages get Fresco's defaults.
31
33
 
32
34
  ## How the shell loads the app
33
35
 
34
36
  - **Bundles** come from `assets/` (`ResourceFetchers.kt`, `BundleAssets.kt`). A URL without a scheme (`/static/…`, `static/…`), `asset:///…` and `file:///android_asset/…` all mean "the file at that path in `assets/`", so the bundle works with Rspeedy's default asset prefix (`/`) and doesn't need a platform-specific one. Absolute `http(s)` URLs are fetched with OkHttp.
35
37
  - **`fetch()` and `XMLHttpRequest`** go through Lynx's HTTP service (`LynxHttpService`, registered in `ShellApplication.kt`), which uses OkHttp. Plain HTTP is allowed to `localhost` and `127.0.0.1` only (`res/xml/network_security_config.xml`), for a server on the device or one on your machine through `adb reverse`; every other host needs HTTPS, Android's default.
36
- - **Images** are loaded by Fresco. The media fetcher rewrites bundled image URLs to `asset:///…`, which Fresco reads from the APK.
38
+ - **Images** are loaded by Fresco, configured in `ImagePipeline.kt` (see above for phones with 16 KB pages). The media fetcher rewrites bundled image URLs to `asset:///…`, which Fresco reads from the APK.
37
39
  - **Lazy routes** need nothing extra: the build plugin keeps each lazy chunk inside `main.lynx.bundle` (see `split-chunks.ts` in the build plugin). Bundles requested by URL at runtime still go through the template resource fetcher.
38
40
 
39
41
  ## Back button
40
42
 
41
- Back is off by default, so it leaves the app like any root screen. The runtime turns it on while the Router has history by calling `NativeModules.AngularLynxShell.setBackHandlerEnabled(true)`, and off again on the first screen (`LynxBackButton` in `packages/runtime/src/lib/router/lynx-back-button.ts`, which `provideRouter()` starts; the call goes through the background thread, where `NativeModules` lives). While it's on, a back press sends the global event `angularLynxBack` instead, which the runtime turns into `Location.back()`. The app has to say beforehand because Android decides synchronously, at the start of the gesture, whether an app handles back (predictive back animates differently). Layer 6's `native/back-button.yaml` checks both ends.
43
+ Back is off by default, so it leaves the app like any root screen. The runtime turns it on while the Router has history or something open on top takes back (a handler registered with `LynxBackButton.on()`, such as a popover's) by calling `NativeModules.AngularLynxShell.setBackHandlerEnabled(true)`, and off again otherwise (`LynxBackButton` in `packages/runtime/src/lib/back-button/back-button.ts`, which `provideRouter()` starts; the call goes through the background thread, where `NativeModules` lives). While it's on, a back press sends the global event `angularLynxBack` instead, which the runtime gives to the handler registered last, or turns into `Location.back()`. The app has to say beforehand because Android decides synchronously, at the start of the gesture, whether an app handles back (predictive back animates differently). While it's on, Android's predictive back gesture (Android 14 and later) also reaches the app as it goes: `handleOnBackStarted`, `handleOnBackProgressed` and `handleOnBackCancelled` send the global event `angularLynxBackGesture` with `{ phase: 'started' | 'progressed', progress, edge }`, or `{ phase: 'canceled' }` alone (`handleOnBackCancelled` has no `BackEventCompat`), and a `<lynx-stack-outlet>` moves its top page with it. The manifest's `android:enableOnBackInvokedCallback="true"` opts Android 14 and 15 in to that; Android 16 does it for an app that targets API 36. A gesture that ends in back sends `angularLynxBack`, as a press does. Layer 6's `native/back-button.yaml` checks both ends.
42
44
 
43
45
  ## Splash screen
44
46
 
45
47
  `MainActivity` starts with the theme `Theme.AngularLynxShell.Starting` (`res/values/themes.xml`), a child of AndroidX `core-splashscreen`'s `Theme.SplashScreen`, which draws Android 12's splash screen on every version from 7: `window_background` with `splash_icon` in the middle, the launcher icon unless angular.json's `splash` has an image. `installSplashScreen()`, before `super.onCreate`, switches it to the app's theme. Android would take the splash down at the first frame, the empty LynxView, so `setKeepOnScreenCondition` holds it until the runtime calls `NativeModules.AngularLynxShell.hideSplashScreen()` (`LynxSplashScreen` in `packages/runtime`, once the app's first screen is drawn), a development build's message shows, or five seconds pass. The exit animation fades it out over 250 ms, as the iOS shell does.
46
48
 
49
+ `ShellModule.hideSplashScreen` posts to the UI thread as an asynchronous message (`HandlerCompat.createAsync`). While the splash is up, its check cancels each frame and schedules the next, which puts a sync barrier in the UI thread's queue, and an ordinary message waited behind it for one more canceled frame.
50
+
47
51
  Android shows a splash icon without an icon background in a 288 dp square, cut to the circle 192 dp across in its middle. The generator draws the image at `splash.imageWidth` dp on a 288 dp canvas, smaller if its corners would reach past the circle (the build warns then), so a logo is never cropped.
48
52
 
49
53
  ## Memory
@@ -83,23 +87,57 @@ iOS's shell does the same with App Intents: the generator writes `App/AppShortcu
83
87
 
84
88
  iOS's `LocalStorageModule.swift` uses a `UserDefaults` suite and `SecureStorageModule.swift` the Keychain, readable after the first unlock and never moved to another device.
85
89
 
90
+ `NativeModules.AngularLynxBiometrics` (`BiometricsModule.kt`, behind the runtime's `LynxBiometrics` and `LynxSecureStorage`'s `requireBiometrics`) shows AndroidX's `BiometricPrompt` over `MainActivity`, which is a `FragmentActivity` for it, with strong (Class 3) biometrics only, and the device credential beside them with `allowDeviceCredential` (beside weak ones on Android 9 and 10, which take no other pair). Its values are in a `SharedPreferences` file of their own, `angular_lynx_biometric_storage`, which Auto Backup leaves out too: each is sealed with AES-GCM under a fresh key, which RSA-OAEP wraps under a Keystore key pair whose private key needs a strong biometric for each use. Storing uses the public key, outside the Keystore, so it doesn't prompt; reading unwraps the key through the prompt's `CryptoObject`. A new fingerprint or face invalidates the pair (`KeyPermanentlyInvalidatedException`), and the module then forgets every value. Only an app with angular.json's `permissions.biometrics` has the module, its `res/values/biometrics.xml` (the prompt's default reason) and the lines between the `// angular-lynx:biometrics` markers of `MainActivity.kt` and `app/build.gradle.kts`; the generator deletes them from the others.
91
+
86
92
  ## Clipboard
87
93
 
88
94
  `NativeModules.AngularLynxClipboard` (`ClipboardModule.kt`, behind the runtime's `LynxClipboard`) copies text to `ClipboardManager` as a plain-text clip and reads the first item back as text, both on the main thread. `setString` calls back once with `{}` or `{ error }`, `getString` with `{ value }`, `""` when the clipboard holds no text. Android 13 and later show the copied text in a panel of their own and have TalkBack say "Text copied", so the runtime's `LynxClipboard.confirmsCopies` tells the app not to confirm it again. Android 10 and later let only the app in front read the clipboard, and Android 12 and later tell the person when it does. iOS's `ClipboardModule.swift` uses `UIPasteboard.general`.
89
95
 
96
+ ## Haptics
97
+
98
+ `NativeModules.AngularLynxHaptics` (`HapticsModule.kt`, behind the runtime's `LynxHaptics`) plays feedback with `View.performHapticFeedback()` on the activity's window, which `MainActivity` passes as the module's param. Unlike `Vibrator`, it needs no `VIBRATE` permission and plays nothing when the person has turned touch feedback off. `impact` plays `KEYBOARD_TAP` for `light` and `soft`, `VIRTUAL_KEY` for `medium` and `rigid` and `LONG_PRESS` for `heavy`; `selection` plays `CLOCK_TICK`; `notification` plays `CONFIRM` for `success` and `REJECT` for `warning` and `error` from Android 11, and `VIRTUAL_KEY` and `LONG_PRESS` before. Each calls back once with `{}`. iOS's `HapticsModule.swift` uses UIKit's feedback generators.
99
+
100
+ `NativeModules.AngularLynxMotion` (`MotionModule.kt`, behind the runtime's `LynxMotion`) is a `LynxContextModule` on a `HandlerThread` of its own, where `SensorManager` calls it back: `start(sensor, interval)` registers the accelerometer (`acceleration`, and `shake`, at 50 Hz), the gyroscope (`rotation`), the game rotation vector (`orientation`, sent as `getRotationMatrixFromVector()`'s matrix) or the rotation vector (`heading`, its azimuth) at the shortest interval asked for, and `stop(sensor)` unregisters it. Samples go to the runtime in the `angularLynxMotion` global event at most every 16 ms. The runtime asks for no more than 200 Hz, so the app needs no `HIGH_SAMPLING_RATE_SENSORS`. `MainActivity` registers it with itself as the param, and the sensors stop while it's paused. Only an app whose angular.json sets `motion` has the module: otherwise the generator deletes it and the lines between `MainActivity.kt`'s `// angular-lynx:motion` markers. iOS's `MotionModule.swift` uses Core Motion and `CLLocationManager`'s heading.
101
+
102
+ ## Bluetooth
103
+
104
+ `NativeModules.AngularLynxBluetooth` (`BluetoothModule.kt`, behind the runtime's `LynxBluetooth`) is a `LynxContextModule` on a `HandlerThread` of its own, where the scan callback, every `BluetoothGattCallback` and the adapter's `ACTION_STATE_CHANGED` receiver post their work, so its state needs no lock. Each connection runs its GATT operations one after another, the MTU request (517) and service discovery included, since a `BluetoothGatt` takes one at a time and drops a second, each with a watchdog longer than ATT's own timeout. It asks for `BLUETOOTH_SCAN` and `BLUETOOTH_CONNECT` from Android 12, and `ACCESS_FINE_LOCATION` before, through `MainActivity`'s `PermissionHost` (`PermissionRequests.kt`, a `RequestMultiplePermissions` launcher registered as the activity is created, like the image picker's). Before Android 12 a scan also needs Location turned on: Android returns no results without it and says nothing, so the module fails the scan instead. The file exists only in an app whose angular.json sets `permissions.bluetooth`, so `MainActivity` finds the class with `Class.forName`; Lynx's keep rules keep every `LynxModule` subclass's name under R8.
105
+
90
106
  ## Photo picker
91
107
 
92
108
  `NativeModules.AngularLynxImagePicker.pick(options, callback)` (`ImagePickerModule.kt`, behind the runtime's `LynxImagePicker`) has the activity open the Photo Picker (`ActivityResultContracts.PickVisualMedia`, images only), which needs no permission. `MainActivity` registers the launcher as a property, so it's registered as the activity is created, before it starts, as `ActivityResult` launchers must be; the module gets the activity's `ImagePickerModule.Host` as its param. A manifest entry (`com.google.android.gms.metadata.ModuleDependencies`) lets Google Play services install the picker on Android 10 and older, which otherwise open the document picker.
93
109
 
94
110
  The module reads the picked photo on a background thread and calls back once with `{ base64, name, type }`, `{ canceled: true }` or `{ error, message }`. A JPEG, PNG, GIF or WebP goes back as it is unless the app passed `maxDimension` or `quality`; otherwise it's decoded with `BitmapFactory` at the smallest power-of-two reduction that covers the target, scaled, turned upright by its EXIF orientation (AndroidX `ExifInterface`, since `BitmapFactory` ignores it), drawn over white if it has transparency and compressed as a JPEG. iOS's `ImagePickerModule.swift` does the same with `PHPickerViewController` and ImageIO.
95
111
 
112
+ `NativeModules.AngularLynxBarcodeScanner.scan({ formats }, callback)` (`BarcodeScannerModule.kt`, behind the runtime's `LynxBarcodeScanner`) opens Google's code scanner (`GmsBarcodeScanning`) over the activity, which it gets as its param. The scanner runs in Google Play services, which shows the camera and hands back only the code, so the app declares no camera permission for it. It calls back once with `{ format, value }` or `{ error, message }`: `canceled`, `unavailable` on a phone without Play services or before Play services has downloaded the scanner, `denied` when the person refused Play services the camera, or `failed`. Only an app whose angular.json sets `permissions.camera` has the file and its library: the generator deletes both from every other app, and `MainActivity` looks the class up by name (`Class.forName`), so it builds either way. iOS's `BarcodeScannerModule.swift` reports the same results through VisionKit's `DataScannerViewController`.
113
+
96
114
  ## Share sheet
97
115
 
116
+ `NativeModules.AngularLynxFilePicker` (`FilePickerModule.kt`, behind the runtime's `LynxFilePicker`) has `pick(options, callback)`, which opens `ACTION_OPEN_DOCUMENT` (`CATEGORY_OPENABLE`, the MIME types as `EXTRA_MIME_TYPES`, extensions looked up in `MimeTypeMap`, `EXTRA_ALLOW_MULTIPLE`), checks the documents' `OpenableColumns.SIZE` against `maxBytes` and reads them on a background thread, and `save(file, callback)`, which opens `ACTION_CREATE_DOCUMENT` with the file's type and name and writes it to the URI chosen. `MainActivity` launches both through one `StartActivityForResult` launcher it registers as it's created, passed to the module as its `Host`. Neither needs a permission. Only an app whose angular.json sets `filePicker` has the module: otherwise the generator deletes it and the lines between `MainActivity.kt`'s `// angular-lynx:file-picker` markers. iOS's `FilePickerModule.swift` uses `UIDocumentPickerViewController`.
117
+
98
118
  `NativeModules.AngularLynxShare.share(request, callback)` (`ShareModule.kt`, behind the runtime's `LynxShare`) writes the request's files (base64) under the cache's `angular-lynx-share/` folder, on a background thread, and opens an `ACTION_SEND` or `ACTION_SEND_MULTIPLE` chooser with their content:// URIs. They come from the manifest's `androidx.core.content.FileProvider` (authority `<applicationId>.angularlynx.share`, paths in `res/xml/share_paths.xml`), and the intent's `ClipData` and `FLAG_GRANT_READ_URI_PERMISSION` let the app picked read them. `MainActivity` registers it with itself as the param, since the module starts the chooser from it and watches its lifecycle. Android doesn't say whether sharing finished, so the module calls back `{ shared: true }` when the chooser's `IntentSender` reports the app picked, and `{ shared: false }` when the activity resumes without a pick. The last share's files stay until the next one, since the app picked may read them after the chooser closes. iOS's `ShareModule.swift` opens `UIActivityViewController` with the files as temporary files of their names, and leaves out Save Image when Info.plist has no `NSPhotoLibraryAddUsageDescription`.
99
119
 
120
+ `NativeModules.AngularLynxStoreReview.request(callback)` (`StoreReviewModule.kt`, behind the runtime's `LynxStoreReview`) creates a `ReviewManager` with Google Play's In-App Review API (`com.google.android.play:review`), asks it for a review flow and launches the flow over the activity, which `MainActivity` passes as the module's param, then calls back `{}`. Play shows the prompt only once the account has installed the app from Play (an internal test track or internal app sharing will do), within a quota, and fails without a Play Store, so a failed request is logged and calls back `{}` too. Only an app whose angular.json sets `storeReview` has the module: otherwise the generator deletes it and the lines between the `// angular-lynx:store-review` markers in `MainActivity.kt` and `app/build.gradle.kts`. iOS's `StoreReviewModule.swift` uses StoreKit's `requestReview(in:)`.
121
+
122
+ `NativeModules.AngularLynxTracking.status(callback)` and `.request(callback)` (`TrackingModule.kt`, behind the runtime's `LynxTracking`) read `AdvertisingIdClient.getAdvertisingIdInfo()` from Google Play services' advertising ID library on a worker thread of their own, since it blocks on a binder call, and call back `{ status: "denied" }` when `isLimitAdTrackingEnabled` (the person opted out of personalized ads, or deleted the ID), `{ status: "authorized" }` otherwise, and `{ status: "unsupported" }` when Play services are missing or fail. Android has no tracking prompt, so `request` answers what `status` does. Only an app whose angular.json has `permissions.tracking` has the module, and the `com.google.android.gms.permission.AD_ID` permission it declares: otherwise the generator deletes it and the lines between the `// angular-lynx:tracking` markers in `MainActivity.kt` and `app/build.gradle.kts`. iOS's `TrackingModule.swift` uses App Tracking Transparency.
123
+
124
+ `NativeModules.AngularLynxCalendar.addEvent(event, callback)` (`CalendarModule.kt`, behind the runtime's `LynxCalendar`) starts `ACTION_INSERT` on `CalendarContract.Events` with the event's title, times (an all-day event's as the UTC midnights of its first day and of the day after its last, as the calendar provider stores them), all-day flag, location and notes as extras, so the calendar app opens its own editor and saves the event: the app needs no calendar permission. `MainActivity` registers a `StartActivityForResult` launcher as it's created and passes the module a `CalendarModule.Host` that launches it. The module calls back `{ result: "saved" }` when the calendar app answers `RESULT_OK`, `{ result: "unknown" }` for anything else (Google Calendar answers `RESULT_CANCELED` whether or not the event was saved), and `{ error: "unavailable" }` when no app takes the intent. Only an app whose angular.json sets `calendar` has the module: otherwise the generator deletes it and the lines between the `// angular-lynx:calendar` markers in `MainActivity.kt`.
125
+
126
+ `NativeModules.AngularLynxAudioRecorder` (`AudioRecorderModule.kt`, behind the runtime's `LynxAudioRecorder`) records AAC into an `.m4a` in the cache folder with `MediaRecorder`, on a thread of its own. It asks for `RECORD_AUDIO` through MainActivity's `PermissionHost`, sends the `angularLynxAudioRecorder` event's `level` from `getMaxAmplitude()` ten times a second, and pauses the recording when an activity stops (not when it pauses, which Android's own permission prompt does), since an app in the background records only silence. Only an app with angular.json's `permissions.microphone` has the module, the `RECORD_AUDIO` permission and the lines between `MainActivity.kt`'s `// angular-lynx:audio-recorder` markers; the generator deletes them from the others.
127
+
128
+ `NativeModules.AngularLynxNfc` (`NfcModule.kt`, behind the runtime's `LynxNfc`) runs `NfcAdapter.enableReaderMode` over `MainActivity`, which Android pauses with the activity and starts again when it's back: `start` turns it on (or answers `unsupported` without an adapter, `disabled` when NFC is off), `next` calls back with the next tag it read (through `Ndef`, or an empty, writable tag for one `NdefFormatable` reports) or wrote to, and `stop` turns it off. Records cross with their bytes in base64, and the runtime builds and reads them. Only an app with angular.json's `permissions.nfc` has the module, the `NFC` permission and the not-required `android.hardware.nfc` feature, and the lines between `MainActivity.kt`'s `// angular-lynx:nfc` markers; the generator deletes them from the others.
129
+
130
+ `NativeModules.AngularLynxWifi.currentNetwork(callback)`, `.join(options, callback)` and `.leave(ssid, callback)` (`WifiModule.kt`, behind the runtime's `LynxWifi`) read and join Wi-Fi networks. `currentNetwork` reads `WifiManager.getConnectionInfo()`, deprecated from Android 12 but still answering an app with `ACCESS_FINE_LOCATION` while Location is on, and calls back `{ ssid, bssid }`, `{ none: true }` off Wi-Fi, or `{ error: "denied" }` once the person refuses it: without the permission, it first asks for `ACCESS_FINE_LOCATION` and `ACCESS_COARSE_LOCATION` through the `PermissionHost` (#990). `join` with `joinOnce` asks `ConnectivityManager.requestNetwork` for a `WifiNetworkSpecifier` network without `NET_CAPABILITY_INTERNET`, which Android shows its picker dialog for, and calls `bindProcessToNetwork` once it's up, so the app's traffic reaches the device; without `joinOnce` it adds a `WifiNetworkSuggestion`. Both need Android 10 and answer `unavailable` before. `leave` unregisters the request's callback, unbinds the process and removes the suggestion. MainActivity registers the module with its `PermissionHost` as the param; only an app whose angular.json sets `wifi` has it.
131
+
132
+ `NativeModules.AngularLynxGeolocation` (`GeolocationModule.kt`, behind the runtime's `LynxGeolocation`) finds the phone with `LocationManager` through AndroidX's `LocationManagerCompat`, without Google Play services: `requestLocationUpdates` until the first fix no older than `maximumAge` for `getCurrentPosition` (the newest last known position that's young enough answers at once, and the runtime's timeout ends the wait). Not `getCurrentLocation`, which takes a fix from the last few seconds even with a `maximumAge` of 0, and `requestLocationUpdates` for each watch, with its distance filter, about once a second for a precise one and every 10 seconds for an approximate one. It uses the fused provider from Android 12, GPS (with the fine permission) or the network before it. It asks for `ACCESS_FINE_LOCATION` and `ACCESS_COARSE_LOCATION` together through `MainActivity`'s `PermissionHost`, so Android 12 and later let the person choose approximate, which it reports as `approximate`. Whether the person refused is kept in its shared preferences, since Android can't tell an app whether it ever asked. Location turning off for the whole phone (`MODE_CHANGED_ACTION`) sends a `state` event and ends every watch with `off`. Only an app whose angular.json has `permissions.location` has the module: otherwise the generator deletes it and the lines between the `// angular-lynx:geolocation` markers in `MainActivity.kt`, and the manifest declares no location permission (except `permissions.bluetooth`'s `ACCESS_FINE_LOCATION` up to Android 11, which Bluetooth scans need there). iOS's `GeolocationModule.swift` uses Core Location.
133
+
134
+ ## Photo library
135
+
136
+ `NativeModules.AngularLynxPhotoLibrary` (`PhotoLibraryModule.kt`, behind the runtime's `LynxPhotoLibrary`) has `save(request, callback)`, which decodes the request's file (base64) on a thread of its own and inserts it into MediaStore: `MediaStore.Images` under `Pictures/<app name>`, or `MediaStore.Video` under `Movies/<app name>`, marked `IS_PENDING` until every byte is written so the gallery never shows half a file, and deleted again if writing fails. It calls back with `{ id, permission }`, `id` the new entry's `content://` URI, or `{ error, message, permission }`. `permission(callback)` answers `granted`. From Android 10 an app may add its own media there without a permission. Android 7 to 9 need `WRITE_EXTERNAL_STORAGE`, and `READ_EXTERNAL_STORAGE` with it (Android 8 and 9 mount storage writable only for an app holding both), which the manifest declares up to API 28 only: `save` asks for them through `MainActivity`'s `PermissionHost` (the module's param) when the app doesn't hold it, then writes the file into the public `Pictures`/`Movies` folder (in `<app name>`, as `name (2).jpg` beside a file of the same name) and adds it to MediaStore by its path, since those versions have no `RELATIVE_PATH` or `IS_PENDING`. There `permission` answers `granted`, `undetermined` (never asked, or refused without "Don't ask again", from `PermissionHost.canAskAgain`) or `denied`. The module and its line in `MainActivity` (between `// angular-lynx:photo-library` markers) are only in an app with `permissions.savePhotos`.
137
+
100
138
  ## Canvas and WebGL
101
139
 
102
- `<canvas>` (issue #211) is the shell's: `CanvasUI.kt`, a `TextureView` registered as the `canvas` element (`addBehavior(CanvasUI.behavior())`), and `WebGLModule.kt`, the `AngularLynxWebGL` module the runtime's WebGL2 context sends its calls to. `MainActivity` turns on main-thread modules (`setEnableMTSModule(true)`), so the runtime, which runs on Lynx's main thread, calls the module synchronously with `lynx.module(name)`, on Lynx's engine thread, which `MainActivity` runs off the UI thread (`setThreadStrategyForRendering(ThreadStrategyForRendering.MOST_ON_TASM)`). The canvas's `TextureView` reports its surface on the UI thread, so `WebGLContext` and `CanvasRegistry` are locked: each call makes the EGL context current and puts back what was current before, so either thread can make the next one, and a surface callback waits for a batch to end. Each context (`WebGLContext.kt`) is an EGL context with OpenGL ES 3.0 and an offscreen default framebuffer, which `present` copies into the canvas's surface; `WebGLOps.kt` is generated from the runtime's opcodes (`npm run generate:webgl-ops -w packages/native`). `encodeImage`, behind `canvas.toBlob()` and `toDataURL()`, reads the default framebuffer and compresses it with `Bitmap.compress`, returning the file as base64. `AssetsModule.kt` (`AngularLynxAssets`) reads a file the app bundles for the main thread's `fetch`, which has no page URL to resolve `/static/...` against.
140
+ `<canvas>` (issue #211) is the shell's: `CanvasUI.kt`, a `TextureView` registered as the `canvas` element (`addBehavior(CanvasUI.behavior())`), and `WebGLModule.kt`, the `AngularLynxWebGL` module the runtime's WebGL2 context sends its calls to. `MainActivity` turns on main-thread modules (`setEnableMTSModule(true)`), so the runtime, which runs on Lynx's main thread, calls the module synchronously with `lynx.module(name)`, on Lynx's engine thread, which `MainActivity` runs off the UI thread (`setThreadStrategyForRendering(ThreadStrategyForRendering.MOST_ON_TASM)`). The canvas's `TextureView` reports its surface on the UI thread, so `WebGLContext` and `CanvasRegistry` are locked: each call makes the EGL context current and puts back what was current before, so either thread can make the next one, and a surface callback waits for a batch to end. Each context (`WebGLContext.kt`) is an EGL context with OpenGL ES 3.0 and an offscreen default framebuffer, which `present` copies into the canvas's surface; `WebGLOps.kt` is generated from the runtime's opcodes (`npm run generate:webgl-ops -w packages/native`). `encodeImage`, behind `canvas.toBlob()` and `toDataURL()`, reads the default framebuffer and compresses it with `Bitmap.compress`, returning the file as base64. The module also has the runtime's 2D context (`create2D`, `run2D`, `destroy2D`, `encode2D`): `Canvas2DContext.kt` draws into an `ARGB_8888` bitmap with `android.graphics.Canvas` and shows it in the canvas's surface with `lockHardwareCanvas()`; `Canvas2DOps.kt` is generated with the WebGL opcodes. `AssetsModule.kt` (`AngularLynxAssets`) reads a file the app bundles for the main thread's `fetch`, which has no page URL to resolve `/static/...` against.
103
141
 
104
142
  Android's GLES has no 2D uploads from a `PIXEL_UNPACK_BUFFER` and no `glGetVertexAttribPointerv`, so those log a warning and answer 0.
105
143
 
@@ -118,6 +156,9 @@ Pinned in `app/build.gradle.kts`, `build.gradle.kts` and `gradle/wrapper/gradle-
118
156
  - Lynx 4.1.0 and PrimJS 4.1.1 (Maven Central), Fresco 2.3.0 (the version Lynx's image service is built against), OkHttp 4.12.
119
157
  - `androidx.browser` 1.10.0, for the Custom Tabs `WebAuthModule` opens sign-in pages in and `LinkingModule` opens `openInApp()`'s pages in.
120
158
  - `androidx.exifinterface` 1.4.2, for the orientation `ImagePickerModule` turns a re-encoded photo by.
159
+ - `androidx.biometric` 1.1.0, for `BiometricsModule`'s prompt, only in an app with `permissions.biometrics`.
160
+ - `play-services-code-scanner` 16.1.0, Google's code scanner, which `BarcodeScannerModule` opens. Only an app with `permissions.camera` keeps it (the `// angular-lynx:barcode-scanner` lines).
161
+ - `play-services-ads-identifier` 18.3.0, for the advertising ID's opt-out `TrackingModule` reads. Only an app with `permissions.tracking` keeps it (the `// angular-lynx:tracking` lines). It declares `AD_ID` too.
121
162
  - Lynx's XElement 4.1.0 (`<input>`, `<textarea>`, `<overlay>`, `<svg>`, `<blur-view>`, `<viewpager>`, `<refresh>`, the `<scroll-coordinator>` family, `<webview>`, `<video>`), without its AnimaX and Markdown modules, which the runtime doesn't support. `MainActivity` registers the elements with `XElementBehaviors`. XElement depends on appcompat and material 1.0.0, whose vectordrawable libraries share a namespace that AGP 9 rejects, so appcompat 1.8.0 and material 1.14.0 are pinned.
122
163
  - AGP 9.4.1 with its built-in Kotlin, Gradle 9.6.1 (AGP 9.4's minimum), JDK 17 or newer.
123
164
  - `compileSdk` 37 (androidx.core 1.19's minimum), `targetSdk` 36, `minSdk` 24. Google Play raises its target API requirement every August; bump `targetSdk` with it.
@@ -6,3 +6,5 @@ versionCode=1
6
6
  appName=AngularLynx
7
7
  screenOrientation=portrait
8
8
  edgeToEdge=true
9
+ textScaling=true
10
+ maxTextScale=0
@@ -30,7 +30,10 @@ val hasReleaseSigning = releaseSigning.values.all { !it.isNullOrEmpty() }
30
30
  val lynxVersion = "4.1.0"
31
31
  val primjsVersion = "4.2.1"
32
32
  // Lynx's image service is written against Fresco 2.3, and Lynx Explorer ships
33
- // the same version, so stay on it until Lynx moves.
33
+ // the same version, so stay on it until Lynx moves. Fresco 3 isn't binary
34
+ // compatible with the service (CloseableImage and CloseableBitmap became
35
+ // interfaces), and Fresco's native libraries before 3.4 don't load with 16 KB
36
+ // memory pages: ImagePipeline.kt says what the shell does about that.
34
37
  val frescoVersion = "2.3.0"
35
38
 
36
39
  android {
@@ -60,6 +63,11 @@ android {
60
63
  // its insets listener). A properties file written before the option
61
64
  // existed has no line for it, and gets the default.
62
65
  resValue("bool", "edge_to_edge", appConfig.getProperty("edgeToEdge") ?: "true")
66
+ // Whether MainActivity sets the LynxView's font scale from the
67
+ // system's font size, and the largest it takes (0 for no cap). Read
68
+ // with the same default for a properties file written before them.
69
+ resValue("bool", "text_scaling", appConfig.getProperty("textScaling") ?: "true")
70
+ resValue("string", "max_text_scale", appConfig.getProperty("maxTextScale") ?: "0")
63
71
  }
64
72
 
65
73
  signingConfigs {
@@ -96,14 +104,16 @@ android {
96
104
  signingConfigs.getByName("debug")
97
105
  }
98
106
  // A build signed with the upload key is for Google Play, which
99
- // rejects an app whose 64-bit native libraries can't load on a
100
- // device with 16 KB memory pages. Fresco's x86_64 libraries, at
101
- // the version Lynx's image service is written against, are
102
- // aligned for 4 KB pages only (its arm64 ones are fine), so the
103
- // Play build ships the ARM ABIs alone. That leaves out only x86
104
- // devices (emulators and a few Chromebooks); 32-bit x86 goes
105
- // too, as no phone needs it. Builds signed with the debug key
106
- // keep every ABI, so their APK still runs on an x86_64 emulator.
107
+ // rejects an app whose 64-bit native libraries' LOAD segments
108
+ // aren't aligned for 16 KB memory pages. Fresco's x86_64
109
+ // libraries, at the version Lynx's image service is written
110
+ // against, are aligned for 4 KB pages, so the Play build ships
111
+ // the ARM ABIs alone. Fresco's arm64 libraries pass Play's check
112
+ // but still don't load on a phone with 16 KB pages (see
113
+ // ImagePipeline.kt). The filter leaves out only x86 devices
114
+ // (emulators and a few Chromebooks); 32-bit x86 goes too, as no
115
+ // phone needs it. Builds signed with the debug key keep every
116
+ // ABI, so their APK still runs on an x86_64 emulator.
107
117
  if (hasReleaseSigning) {
108
118
  ndk {
109
119
  abiFilters += listOf("arm64-v8a", "armeabi-v7a")
@@ -117,6 +127,19 @@ android {
117
127
  targetCompatibility = JavaVersion.VERSION_17
118
128
  }
119
129
 
130
+ // The app's native plugins' resources (angular.json's nativePlugins),
131
+ // which the generator copies into src/main/plugin-res, a folder each.
132
+ // Each is a resource folder of the module beside src/main/res, so a
133
+ // plugin's values/colors.xml doesn't replace the shell's file of that
134
+ // name, and its resources are in the app's R (dev.angularlynx.shell.R).
135
+ // The generator has already refused a resource the shell or another
136
+ // plugin defines.
137
+ sourceSets.getByName("main").res.directories +=
138
+ file("src/main/plugin-res").listFiles { file -> file.isDirectory }
139
+ .orEmpty()
140
+ .map { "src/main/plugin-res/${it.name}" }
141
+ .sorted()
142
+
120
143
  buildFeatures {
121
144
  resValues = true
122
145
  }
@@ -157,6 +180,33 @@ dependencies {
157
180
  // from every format the Photo Picker hands back, the same way on every
158
181
  // Android version.
159
182
  implementation("androidx.exifinterface:exifinterface:1.4.2")
183
+ // BiometricPrompt, which BiometricsModule shows: the same prompt from
184
+ // Android 7 up, with the fingerprint dialog on versions before Android 9's
185
+ // own. Only an app with permissions.biometrics keeps it, with the module.
186
+ // angular-lynx:biometrics
187
+ implementation("androidx.biometric:biometric:1.1.0")
188
+ // /angular-lynx:biometrics
189
+ // Google's code scanner, which BarcodeScannerModule opens: it runs in
190
+ // Google Play services, which shows the camera, so the app needs no
191
+ // CAMERA permission and ships no ML Kit model. Only an app whose
192
+ // angular.json sets permissions.camera keeps these lines and the module
193
+ // (@blotch/angular-lynx-native's android/project.ts).
194
+ // angular-lynx:barcode-scanner
195
+ implementation("com.google.android.gms:play-services-code-scanner:16.1.0")
196
+ // /angular-lynx:barcode-scanner
197
+ // Google Play's In-App Review API, which StoreReviewModule asks for the
198
+ // rating prompt. Only an app whose angular.json sets storeReview keeps
199
+ // these lines (@blotch/angular-lynx-native's android/project.ts).
200
+ // angular-lynx:store-review
201
+ implementation("com.google.android.play:review:2.0.2")
202
+ // /angular-lynx:store-review
203
+ // Google Play's advertising ID library, which TrackingModule asks whether
204
+ // the person has opted out of personalized ads or deleted their ID. It
205
+ // also declares AD_ID, which the manifest does too. Only an app whose
206
+ // angular.json sets permissions.tracking keeps these lines.
207
+ // angular-lynx:tracking
208
+ implementation("com.google.android.gms:play-services-ads-identifier:18.3.0")
209
+ // /angular-lynx:tracking
160
210
 
161
211
  // The Lynx engine, its JavaScript runtime (PrimJS) and its JS SDK.
162
212
  implementation("org.lynxsdk.lynx:lynx:$lynxVersion")
@@ -180,7 +230,7 @@ dependencies {
180
230
  // an app that ships it. 0.10.5 fixes that and keeps the API Fresco 2.x
181
231
  // calls (React Native ships the two together), so Gradle's conflict
182
232
  // resolution moves Fresco onto it.
183
- implementation("com.facebook.soloader:soloader:0.10.5")
233
+ implementation("com.facebook.soloader:soloader:0.13.0")
184
234
  implementation("com.squareup.okhttp3:okhttp:4.12.1")
185
235
 
186
236
  // XElement: <input>, <textarea>, <overlay>, <svg>, <blur-view>,
@@ -195,8 +245,25 @@ dependencies {
195
245
  exclude(group = "org.lynxsdk.lynx", module = "xelement-markdown")
196
246
  }
197
247
  // The umbrella declares its modules for runtime only. EdgeToEdgeOverlay
198
- // extends <overlay>'s classes, so that module is compiled against too.
248
+ // extends <overlay>'s classes, so that module is compiled against too,
249
+ // as is <video>'s.
199
250
  implementation("org.lynxsdk.lynx:xelement-overlay:$lynxVersion")
251
+ // VideoUI extends <video>'s classes and reads its media3 PlayerView, at
252
+ // the media3 version xelement-video depends on.
253
+ implementation("org.lynxsdk.lynx:xelement-video:$lynxVersion")
254
+ implementation("androidx.media3:media3-ui:1.0.2")
255
+ implementation("androidx.media3:media3-common:1.0.2")
256
+ // cspell:words servalsvg libserval
257
+ // ServalSVG, the engine <svg> draws with. xelement-svg asks for 0.0.2,
258
+ // whose AAR has libserval_svg.so for arm64-v8a, armeabi-v7a and x86 but
259
+ // not x86_64, so on an x86_64 emulator every <svg> is blank and Lynx's
260
+ // SVG thread throws UnsatisfiedLinkError. 0.2.4 ships all four ABIs,
261
+ // 16 KB-aligned on 64-bit, and keeps the Java API xelement-svg calls;
262
+ // Gradle's conflict resolution moves xelement-svg onto it. It's also the
263
+ // version the iOS frameworks link (build-lynx-ios-frameworks.sh), so
264
+ // both platforms draw with the same engine. Drop this once xelement-svg
265
+ // depends on a release with x86_64.
266
+ implementation("org.lynxsdk.lynx:servalsvg:0.2.4")
200
267
  // XElement's modules depend on appcompat and material 1.0.0, which bring
201
268
  // vectordrawable 1.0.0 and vectordrawable-animated 1.0.0. Those two share
202
269
  // the namespace androidx.vectordrawable, and AGP 9's manifest merger
@@ -4,6 +4,11 @@
4
4
 
5
5
  <!-- fetch() and XMLHttpRequest go through Lynx's HTTP service. -->
6
6
  <uses-permission android:name="android.permission.INTERNET" />
7
+ <!--
8
+ Whether the phone is online (LynxNetwork, NetworkStatus.kt). Granted at
9
+ install, without a prompt.
10
+ -->
11
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
7
12
 
8
13
  <!--
9
14
  A fixed screenOrientation makes Android imply that the device needs a
@@ -25,11 +30,17 @@
25
30
  <!--
26
31
  Auto Backup leaves out LynxSecureStorage's file (SecureStorageModule):
27
32
  dataExtractionRules from Android 12, fullBackupContent before.
33
+
34
+ enableOnBackInvokedCallback opts in to predictive back on Android 13
35
+ to 15, which Android 16 turns on for an app that targets API 36:
36
+ without it, Android 14 sends MainActivity's back handler only the
37
+ finished gesture, so a stack can't move its page with the finger.
28
38
  -->
29
39
  <application
30
40
  android:name=".ShellApplication"
31
41
  android:allowBackup="true"
32
42
  android:dataExtractionRules="@xml/data_extraction_rules"
43
+ android:enableOnBackInvokedCallback="true"
33
44
  android:fullBackupContent="@xml/backup_rules"
34
45
  android:icon="@mipmap/ic_launcher"
35
46
  android:roundIcon="@mipmap/ic_launcher_round"
@@ -41,13 +52,13 @@
41
52
  <!--
42
53
  One activity holding one LynxView; Angular Router does all navigation
43
54
  inside it. configChanges keeps the activity (and the running Angular
44
- app) alive on rotation, resizing and dark-mode switches instead of
45
- restarting it; the LynxView re-lays itself out. It starts with the
55
+ app) alive on rotation, resizing, dark-mode switches and a new font
56
+ size instead of restarting it; the LynxView re-lays itself out. It starts with the
46
57
  splash screen's theme, which installSplashScreen() replaces.
47
58
  -->
48
59
  <activity
49
60
  android:name=".MainActivity"
50
- android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode"
61
+ android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|fontScale"
51
62
  android:exported="true"
52
63
  android:launchMode="singleTask"
53
64
  android:screenOrientation="${screenOrientation}"
@@ -58,6 +69,11 @@
58
69
  <category android:name="android.intent.category.LAUNCHER" />
59
70
  </intent-filter>
60
71
  <!-- angular-lynx:deep-links -->
72
+ <!--
73
+ angular.json's shareTarget: the app in other apps' share
74
+ sheets, for its MIME types (ShareTargetModule.kt).
75
+ -->
76
+ <!-- angular-lynx:share-target -->
61
77
  <!--
62
78
  angular.json's shortcuts, in the menu a long press on the
63
79
  app's icon opens. Android reads them from the launcher
@@ -0,0 +1,13 @@
1
+ // Written by @blotch/angular-lynx-native from the plugins angular.json's
2
+ // `nativePlugins` lists: a generated project gets a new copy on every
3
+ // build, so change the plugins rather than this file. In an ejected
4
+ // project it is yours, and `nativePlugins` no longer applies.
5
+ package dev.angularlynx.shell
6
+
7
+ import androidx.activity.ComponentActivity
8
+ import com.lynx.tasm.LynxViewBuilder
9
+
10
+ /** The app's native plugins' modules and elements. */
11
+ internal object AngularLynxPlugins {
12
+ fun register(builder: LynxViewBuilder, activity: ComponentActivity) {}
13
+ }