@blotch/angular-lynx-native 22.3.1 → 22.3.2

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 (100) hide show
  1. package/README.md +41 -15
  2. package/dist/android/project.d.ts +90 -1
  3. package/dist/android/project.d.ts.map +1 -1
  4. package/dist/android/project.js +369 -5
  5. package/dist/eject.d.ts +15 -1
  6. package/dist/eject.d.ts.map +1 -1
  7. package/dist/eject.js +13 -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/generate.d.ts +17 -1
  12. package/dist/generate.d.ts.map +1 -1
  13. package/dist/generate.js +12 -4
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +8 -1
  17. package/dist/ios/build.d.ts.map +1 -1
  18. package/dist/ios/build.js +8 -2
  19. package/dist/ios/frameworks.d.ts +6 -5
  20. package/dist/ios/frameworks.d.ts.map +1 -1
  21. package/dist/ios/frameworks.js +46 -15
  22. package/dist/ios/project.d.ts +173 -11
  23. package/dist/ios/project.d.ts.map +1 -1
  24. package/dist/ios/project.js +767 -33
  25. package/dist/options.d.ts +140 -1
  26. package/dist/options.d.ts.map +1 -1
  27. package/dist/options.js +127 -0
  28. package/dist/permissions.d.ts +18 -1
  29. package/dist/permissions.d.ts.map +1 -1
  30. package/dist/permissions.js +63 -3
  31. package/package.json +1 -1
  32. package/templates/android/README.md +35 -2
  33. package/templates/android/angular-lynx.properties +2 -0
  34. package/templates/android/app/build.gradle.kts +51 -2
  35. package/templates/android/app/src/main/AndroidManifest.xml +14 -3
  36. package/templates/android/app/src/main/java/dev/angularlynx/shell/BarcodeScannerModule.kt +144 -0
  37. package/templates/android/app/src/main/java/dev/angularlynx/shell/BiometricsModule.kt +433 -0
  38. package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapPresenter.kt +98 -0
  39. package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapRendererContext.kt +175 -0
  40. package/templates/android/app/src/main/java/dev/angularlynx/shell/BluetoothModule.kt +1288 -0
  41. package/templates/android/app/src/main/java/dev/angularlynx/shell/CalendarModule.kt +127 -0
  42. package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DContext.kt +1557 -0
  43. package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DOps.kt +63 -0
  44. package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasFilter.kt +357 -0
  45. package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasUI.kt +4 -3
  46. package/templates/android/app/src/main/java/dev/angularlynx/shell/FilePickerModule.kt +263 -0
  47. package/templates/android/app/src/main/java/dev/angularlynx/shell/HapticsModule.kt +82 -0
  48. package/templates/android/app/src/main/java/dev/angularlynx/shell/MainActivity.kt +376 -6
  49. package/templates/android/app/src/main/java/dev/angularlynx/shell/ModuleBytes.kt +58 -0
  50. package/templates/android/app/src/main/java/dev/angularlynx/shell/MotionModule.kt +332 -0
  51. package/templates/android/app/src/main/java/dev/angularlynx/shell/NfcModule.kt +274 -0
  52. package/templates/android/app/src/main/java/dev/angularlynx/shell/PermissionRequests.kt +25 -0
  53. package/templates/android/app/src/main/java/dev/angularlynx/shell/PhotoLibraryModule.kt +168 -0
  54. package/templates/android/app/src/main/java/dev/angularlynx/shell/ShareTargetModule.kt +234 -0
  55. package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellApplication.kt +6 -0
  56. package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellModule.kt +47 -3
  57. package/templates/android/app/src/main/java/dev/angularlynx/shell/StoreReviewModule.kt +66 -0
  58. package/templates/android/app/src/main/java/dev/angularlynx/shell/SystemFontFamilies.kt +68 -0
  59. package/templates/android/app/src/main/java/dev/angularlynx/shell/TrackingModule.kt +74 -0
  60. package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoFrameTarget.kt +429 -0
  61. package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoUI.kt +676 -0
  62. package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLContext.kt +128 -13
  63. package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLModule.kt +493 -65
  64. package/templates/android/app/src/main/java/dev/angularlynx/shell/WifiModule.kt +429 -0
  65. package/templates/android/app/src/main/res/values/biometrics.xml +9 -0
  66. package/templates/android/app/src/main/res/values/share_target.xml +11 -0
  67. package/templates/android/app/src/main/res/xml/backup_rules.xml +5 -3
  68. package/templates/android/app/src/main/res/xml/data_extraction_rules.xml +6 -3
  69. package/templates/android/build.gradle.kts +1 -1
  70. package/templates/android/gradle/wrapper/gradle-wrapper.properties +2 -2
  71. package/templates/ios/App/AngularLynxBitmapRendererContext.m +188 -0
  72. package/templates/ios/App/AngularLynxCanvas2DContext.m +2467 -0
  73. package/templates/ios/App/AngularLynxCanvas2DOps.h +61 -0
  74. package/templates/ios/App/AngularLynxVideo.h +37 -0
  75. package/templates/ios/App/AngularLynxVideo.m +435 -0
  76. package/templates/ios/App/AngularLynxWebGL.h +69 -7
  77. package/templates/ios/App/AngularLynxWebGL.m +538 -29
  78. package/templates/ios/App/AngularLynxWebGLContext.m +148 -46
  79. package/templates/ios/App/AppDelegate.swift +34 -2
  80. package/templates/ios/App/AppleSignInButton.swift +106 -0
  81. package/templates/ios/App/AppleSignInModule.swift +222 -0
  82. package/templates/ios/App/BarcodeScannerModule.swift +284 -0
  83. package/templates/ios/App/BiometricsModule.swift +256 -0
  84. package/templates/ios/App/BluetoothModule.swift +1086 -0
  85. package/templates/ios/App/CalendarModule.swift +158 -0
  86. package/templates/ios/App/FilePickerModule.swift +240 -0
  87. package/templates/ios/App/HapticsModule.swift +90 -0
  88. package/templates/ios/App/Info.plist +2 -0
  89. package/templates/ios/App/LynxViewController.swift +210 -6
  90. package/templates/ios/App/MotionModule.swift +430 -0
  91. package/templates/ios/App/NfcModule.swift +346 -0
  92. package/templates/ios/App/PhotoLibraryModule.swift +169 -0
  93. package/templates/ios/App/ShareTargetModule.swift +150 -0
  94. package/templates/ios/App/ShellModule.swift +17 -0
  95. package/templates/ios/App/StoreReviewModule.swift +61 -0
  96. package/templates/ios/App/TrackingModule.swift +121 -0
  97. package/templates/ios/App/WifiModule.swift +237 -0
  98. package/templates/ios/App/XElementRegistry.swift +13 -3
  99. package/templates/ios/ShareExtension/Info.plist +42 -0
  100. package/templates/ios/ShareExtension/ShareViewController.swift +387 -0
package/dist/options.d.ts CHANGED
@@ -26,8 +26,85 @@ export type NativeAppOptions = {
26
26
  * lays the page out inside the safe area, with `env()` at 0.
27
27
  */
28
28
  readonly edgeToEdge?: boolean;
29
+ /**
30
+ * Whether the app's text follows the phone's text size: iOS's Dynamic Type
31
+ * and Android's font size. The page's root font size grows by the user's
32
+ * scale, so every size in `rem` grows with it (a size in `px` doesn't), and
33
+ * `LynxAccessibilitySettings.textScale()` reads it. On by default; `false`
34
+ * keeps the text at its default size, and `{ "max": 1.6 }` stops it
35
+ * growing past 1.6 times that, for a layout that can't take more.
36
+ */
37
+ readonly textScaling?: boolean | TextScaling;
29
38
  /** Each permission the app uses, with the reason shown to the user. */
30
39
  readonly permissions?: Partial<Record<Permission, string>>;
40
+ /**
41
+ * Whether the app lets the person pick documents and save files with the
42
+ * runtime's `LynxFilePicker`: `UIDocumentPickerViewController` on iOS, and
43
+ * the system's document picker and save screen on Android. Neither needs a
44
+ * permission. Off by default, which leaves the native module out of both
45
+ * apps.
46
+ */
47
+ readonly filePicker?: boolean;
48
+ /**
49
+ * Whether the iOS Files app lists the app's Documents folder, under On My
50
+ * iPhone (Info.plist's `UIFileSharingEnabled` and
51
+ * `LSSupportsOpeningDocumentsInPlace`), so the person can save a file
52
+ * there with `LynxFilePicker.save()` and pick it again later. Off by
53
+ * default. Android has no equivalent: its document picker already shows
54
+ * Downloads.
55
+ */
56
+ readonly fileSharing?: boolean;
57
+ /**
58
+ * Whether the app asks for a rating in the app with the runtime's
59
+ * `LynxStoreReview`: StoreKit's review prompt on iOS, and Google Play's
60
+ * In-App Review API on Android. Off by default, which leaves the native
61
+ * module out of both apps, and Play's review library out of the Android
62
+ * one.
63
+ */
64
+ readonly storeReview?: boolean;
65
+ /**
66
+ * Whether the app adds events to the person's calendar with the runtime's
67
+ * `LynxCalendar`, through the system's own event editor: EventKitUI's on
68
+ * iOS 17 and later, and the calendar app's on Android. Neither needs a
69
+ * calendar permission. Off by default, which leaves the native module out
70
+ * of both apps.
71
+ */
72
+ readonly calendar?: boolean;
73
+ /**
74
+ * Whether the app offers Sign in with Apple's native sheet with the
75
+ * runtime's `LynxAppleSignIn` (`ASAuthorizationAppleIDProvider`). iOS only:
76
+ * Android has no native sheet, and signs in with Apple's web flow through
77
+ * `LynxWebAuthSession`. Off by default, which leaves the native module and
78
+ * the `com.apple.developer.applesignin` entitlement out of the app: a free
79
+ * Personal Team can't sign that entitlement.
80
+ */
81
+ readonly signInWithApple?: boolean;
82
+ /**
83
+ * Puts the app in other apps' share sheets for the types it lists, e.g.
84
+ * `{ "mimeTypes": ["text/plain", "text/uri-list", "image/*"] }`, so the
85
+ * runtime's `LynxShareTarget` receives what the person shares to it: an
86
+ * `ACTION_SEND` intent filter on Android, and a Share Extension on iOS,
87
+ * which hands the share to the app through an App Group. Off by default,
88
+ * which leaves the native module, the extension and the App Groups
89
+ * entitlement out of both apps: a free Personal Team can't sign App
90
+ * Groups.
91
+ */
92
+ readonly shareTarget?: ShareTargetOptions | false;
93
+ /**
94
+ * Whether the app reads the phone's Wi-Fi network and joins others with
95
+ * the runtime's `LynxWifi` (see {@link WifiOptions}). Off by default, which
96
+ * leaves the native module, its entitlements and its manifest permissions
97
+ * out of both apps.
98
+ */
99
+ readonly wifi?: WifiOptions;
100
+ /**
101
+ * Whether the app reads the phone's motion sensors and compass, and hears
102
+ * it shaken, with the runtime's `LynxMotion`: Core Motion and
103
+ * `CLLocationManager`'s heading on iOS, and `SensorManager` on Android.
104
+ * None of them needs a permission. Off by default, which leaves the native
105
+ * module out of both apps.
106
+ */
107
+ readonly motion?: boolean;
31
108
  /** Custom URL schemes that open the app, e.g. `["myapp"]`. */
32
109
  readonly deepLinkSchemes?: readonly string[];
33
110
  /**
@@ -169,7 +246,7 @@ export type ResolvedShortcut = {
169
246
  };
170
247
  /** Where a shortcut's phrase names the app. */
171
248
  export declare const APP_NAME_PLACEHOLDER = "{appName}";
172
- export type Permission = 'camera' | 'microphone' | 'location' | 'photos' | 'savePhotos' | 'contacts' | 'notifications' | 'localNetwork';
249
+ export type Permission = 'camera' | 'microphone' | 'location' | 'photos' | 'savePhotos' | 'contacts' | 'notifications' | 'localNetwork' | 'biometrics' | 'bluetooth' | 'tracking' | 'nfc';
173
250
  /**
174
251
  * How the `.ipa` is signed, as Xcode's export methods name it:
175
252
  * `app-store-connect` for App Store Connect and TestFlight, and
@@ -233,6 +310,58 @@ export type AdaptiveIcon = {
233
310
  /** A color (`#RRGGBB` or `#RGB`), or a 1024×1024 PNG like `foreground`. */
234
311
  readonly background?: string;
235
312
  };
313
+ /**
314
+ * {@link NativeAppOptions.wifi}: which of `LynxWifi`'s parts the app uses.
315
+ * Each adds an iOS capability, which a free Personal Team can't sign, so the
316
+ * app asks only for the parts it calls.
317
+ */
318
+ export type WifiOptions = {
319
+ /**
320
+ * `join()` and `leave()`: the Hotspot Configuration entitlement
321
+ * (`NEHotspotConfigurationManager`) on iOS, and `CHANGE_WIFI_STATE` and
322
+ * `CHANGE_NETWORK_STATE` on Android.
323
+ */
324
+ readonly join?: boolean;
325
+ /**
326
+ * `currentNetwork()`: the Access Wi-Fi Information entitlement
327
+ * (`NEHotspotNetwork`) on iOS, and `ACCESS_WIFI_STATE` on Android. Both
328
+ * platforms also need the person's location to give the network's name,
329
+ * so it needs `permissions.location`, whose reason iOS shows.
330
+ */
331
+ readonly readCurrentNetwork?: boolean;
332
+ };
333
+ /** {@link NativeAppOptions.wifi} with its defaults applied. */
334
+ export type ResolvedWifi = {
335
+ readonly join: boolean;
336
+ readonly readCurrentNetwork: boolean;
337
+ };
338
+ /** {@link NativeAppOptions.textScaling} as an object. */
339
+ export type TextScaling = {
340
+ /**
341
+ * The largest scale the app's text takes, such as 1.6: at a larger text
342
+ * size it stays 1.6 times its default size. At least 1. Without it, the
343
+ * text follows the phone's largest sizes (about 3.1 on iOS, 2 on Android).
344
+ */
345
+ readonly max?: number;
346
+ };
347
+ /** {@link NativeAppOptions.textScaling} with its default applied. */
348
+ export type ResolvedTextScaling = {
349
+ readonly enabled: boolean;
350
+ /** The cap, or undefined for none. */
351
+ readonly max?: number;
352
+ };
353
+ /** angular.json's `shareTarget`. */
354
+ export type ShareTargetOptions = {
355
+ /**
356
+ * The MIME types the app receives, such as `text/plain` for text,
357
+ * `text/uri-list` for links, `image/*` for photos or `application/pdf`.
358
+ */
359
+ readonly mimeTypes: readonly string[];
360
+ };
361
+ /** {@link ShareTargetOptions}, checked, with each type in lowercase once. */
362
+ export type ResolvedShareTarget = {
363
+ readonly mimeTypes: readonly string[];
364
+ };
236
365
  /** {@link NativeAppOptions} with every default applied and every value checked. */
237
366
  export type ResolvedApp = {
238
367
  readonly name: string;
@@ -241,7 +370,17 @@ export type ResolvedApp = {
241
370
  readonly buildNumber: number;
242
371
  readonly orientation: Orientation;
243
372
  readonly edgeToEdge: boolean;
373
+ readonly textScaling: ResolvedTextScaling;
244
374
  readonly permissions: Partial<Record<Permission, string>>;
375
+ readonly filePicker: boolean;
376
+ readonly fileSharing: boolean;
377
+ readonly storeReview: boolean;
378
+ readonly calendar: boolean;
379
+ readonly signInWithApple: boolean;
380
+ /** {@link NativeAppOptions.shareTarget}, or undefined when it's off. */
381
+ readonly shareTarget: ResolvedShareTarget | undefined;
382
+ readonly wifi: ResolvedWifi;
383
+ readonly motion: boolean;
245
384
  readonly deepLinkSchemes: readonly string[];
246
385
  /** {@link NativeAppOptions.appLinkDomains} in lowercase, each once. */
247
386
  readonly appLinkDomains: readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"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AAO,EAAE,cAAc,CAAC;CAClC,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAmB/C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAuC,CAAC;AAG1E;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAMnD,CAAC;AAqCF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,gBAAgB,EAC5B,UAAU;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,KAC3E,WAgOF,CAAC;AAgIF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,MAAM,KAAG,MAA+B,CAAC;AA6KhF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,OAWxC,CAAC"}
package/dist/options.js CHANGED
@@ -70,6 +70,10 @@ const PERMISSIONS = [
70
70
  'contacts',
71
71
  'notifications',
72
72
  'localNetwork',
73
+ 'biometrics',
74
+ 'bluetooth',
75
+ 'tracking',
76
+ 'nfc',
73
77
  ];
74
78
  /**
75
79
  * Applies defaults and validates the options, so the generators never see a
@@ -110,6 +114,29 @@ export const resolveAppOptions = (rawOptions, defaults) => {
110
114
  throw new NativeConfigError(`permissions.${permission} needs the reason shown to the user, e.g. "Scan receipts".`);
111
115
  }
112
116
  }
117
+ // Checked here because the generators keep the module, or the Info.plist
118
+ // keys, for any truthy value, so a string such as "false" would quietly
119
+ // ship them.
120
+ // The switches are read from the options as given: compact() drops an
121
+ // empty object, which would then pass as false rather than be rejected.
122
+ const filePicker = resolveSwitch('filePicker', rawOptions.filePicker, 'to let the person pick and save files with LynxFilePicker');
123
+ const fileSharing = resolveSwitch('fileSharing', rawOptions.fileSharing, "to list the app's Documents folder in the iOS Files app");
124
+ // Checked here because the generators keep the module for any truthy
125
+ // value, so a string such as "false" would quietly ship it. Read from the
126
+ // options as given: compact() drops an empty object, which would then
127
+ // pass as false rather than be rejected.
128
+ const storeReview = rawOptions.storeReview ?? false;
129
+ if (typeof storeReview !== 'boolean') {
130
+ throw new NativeConfigError(`storeReview ${JSON.stringify(storeReview)} is not valid. Use true to ask for ratings in the app with LynxStoreReview, or false.`);
131
+ }
132
+ // Checked for the same reason as filePicker.
133
+ const calendar = resolveSwitch('calendar', rawOptions.calendar, 'to add events to the calendar with LynxCalendar');
134
+ // An entitlement too, so a string such as "false" would also make a
135
+ // Personal Team's signing fail.
136
+ const signInWithApple = resolveSwitch('signInWithApple', rawOptions.signInWithApple, "to offer Sign in with Apple's native sheet with LynxAppleSignIn");
137
+ const wifi = resolveWifi(options.wifi, permissions);
138
+ // As for calendar.
139
+ const motion = resolveSwitch('motion', rawOptions.motion, 'to read the motion sensors and compass with LynxMotion');
113
140
  const deepLinkSchemes = options.deepLinkSchemes ?? [];
114
141
  for (const scheme of deepLinkSchemes) {
115
142
  if (!SCHEME.test(scheme)) {
@@ -139,6 +166,7 @@ export const resolveAppOptions = (rawOptions, defaults) => {
139
166
  if (canOpenURLSchemes.length > MAX_QUERIED_SCHEMES) {
140
167
  throw new NativeConfigError(`canOpenURLSchemes lists ${canOpenURLSchemes.length} schemes with the ${ALWAYS_QUERIED_SCHEMES.length} always there (${ALWAYS_QUERIED_SCHEMES.join(', ')}). iOS reads no more than ${MAX_QUERIED_SCHEMES}.`);
141
168
  }
169
+ const textScaling = resolveTextScaling(options.textScaling);
142
170
  const shortcuts = resolveShortcuts(options.shortcuts ?? []);
143
171
  const splash = resolveSplash(options.splash ?? {});
144
172
  const android = options.android ?? {};
@@ -174,7 +202,16 @@ export const resolveAppOptions = (rawOptions, defaults) => {
174
202
  buildNumber,
175
203
  orientation: options.orientation ?? 'portrait',
176
204
  edgeToEdge: options.edgeToEdge ?? true,
205
+ textScaling,
177
206
  permissions,
207
+ filePicker,
208
+ fileSharing,
209
+ storeReview,
210
+ calendar,
211
+ signInWithApple,
212
+ shareTarget: resolveShareTarget(options.shareTarget),
213
+ wifi,
214
+ motion,
178
215
  deepLinkSchemes,
179
216
  appLinkDomains,
180
217
  canOpenURLSchemes,
@@ -187,6 +224,96 @@ export const resolveAppOptions = (rawOptions, defaults) => {
187
224
  android,
188
225
  };
189
226
  };
227
+ /**
228
+ * A MIME type, or a wildcard for its subtype (`image/*`) or for everything
229
+ * (`*\/*`), as Android's intent filters take them.
230
+ */
231
+ const SHARE_MIME_TYPE = /^(?:\*\/\*|[a-z0-9][a-z0-9!#$&^_.+-]*\/(?:\*|[a-z0-9][a-z0-9!#$&^_.+-]*))$/;
232
+ /**
233
+ * Checks `shareTarget`: an object with at least one MIME type, each in
234
+ * lowercase once (MIME types are case-insensitive, and Android's intent
235
+ * filters match them case-sensitively in lowercase).
236
+ */
237
+ const resolveShareTarget = (value) => {
238
+ if (value === undefined || value === false)
239
+ return undefined;
240
+ const mimeTypes = value?.mimeTypes;
241
+ if (typeof value !== 'object' ||
242
+ value === null ||
243
+ !Array.isArray(mimeTypes) ||
244
+ mimeTypes.length === 0 ||
245
+ mimeTypes.some((type) => typeof type !== 'string')) {
246
+ throw new NativeConfigError(`shareTarget ${JSON.stringify(value)} is not valid. Give the types the app receives, e.g. { "mimeTypes": ["text/plain", "image/*"] }, or false.`);
247
+ }
248
+ const types = [
249
+ ...new Set(mimeTypes.map((type) => type.toLowerCase())),
250
+ ];
251
+ for (const type of types) {
252
+ if (!SHARE_MIME_TYPE.test(type)) {
253
+ throw new NativeConfigError(`shareTarget.mimeTypes entry "${type}" is not a MIME type. Give a type and subtype, such as "text/plain", "image/*" or "application/pdf".`);
254
+ }
255
+ }
256
+ return { mimeTypes: types };
257
+ };
258
+ /**
259
+ * A boolean option that's off by default, checked so that anything but
260
+ * `true` or `false`, such as the string "false", is an error naming it.
261
+ */
262
+ const resolveSwitch = (name, value, purpose) => {
263
+ if (value === undefined)
264
+ return false;
265
+ if (typeof value !== 'boolean') {
266
+ throw new NativeConfigError(`${name} ${JSON.stringify(value)} is not valid. Use true ${purpose}, or false.`);
267
+ }
268
+ return value;
269
+ };
270
+ /**
271
+ * Checks `wifi`: an object of the two switches, each a boolean, since the
272
+ * generators keep the module, the entitlements and the permissions for any
273
+ * truthy value. Reading the network's name needs the person's location on
274
+ * both platforms, so `readCurrentNetwork` needs `permissions.location`, whose
275
+ * reason iOS shows: without it, iOS shows no prompt and the name stays hidden.
276
+ */
277
+ const resolveWifi = (wifi, permissions) => {
278
+ if (wifi === undefined)
279
+ return { join: false, readCurrentNetwork: false };
280
+ if (typeof wifi !== 'object' || wifi === null || Array.isArray(wifi)) {
281
+ throw new NativeConfigError(`wifi ${JSON.stringify(wifi)} is not valid. Use an object of the parts of LynxWifi the app uses, e.g. { "join": true, "readCurrentNetwork": true }.`);
282
+ }
283
+ for (const key of Object.keys(wifi)) {
284
+ if (key !== 'join' && key !== 'readCurrentNetwork') {
285
+ throw new NativeConfigError(`Unknown wifi option "${key}". Supported: join, readCurrentNetwork.`);
286
+ }
287
+ }
288
+ const { join, readCurrentNetwork } = wifi;
289
+ const resolved = {
290
+ join: resolveSwitch('wifi.join', join, 'to join Wi-Fi networks with LynxWifi'),
291
+ readCurrentNetwork: resolveSwitch('wifi.readCurrentNetwork', readCurrentNetwork, "to read the phone's Wi-Fi network with LynxWifi"),
292
+ };
293
+ if (resolved.readCurrentNetwork && !permissions.location) {
294
+ throw new NativeConfigError('wifi.readCurrentNetwork needs permissions.location too: iOS and Android give the network\'s name only to an app with the person\'s location. Add the reason iOS shows, e.g. "permissions": { "location": "Find your Wi-Fi network to set up the device" }.');
295
+ }
296
+ return resolved;
297
+ };
298
+ /**
299
+ * Checks `textScaling` and gives it its default, on. A cap below 1 would make
300
+ * the default text smaller than the app was designed at, so it's caught here,
301
+ * where the message can name the option.
302
+ */
303
+ const resolveTextScaling = (textScaling) => {
304
+ if (textScaling === undefined || textScaling === true) {
305
+ return { enabled: true };
306
+ }
307
+ if (textScaling === false)
308
+ return { enabled: false };
309
+ const max = textScaling.max;
310
+ if (max === undefined)
311
+ return { enabled: true };
312
+ if (typeof max !== 'number' || !Number.isFinite(max) || max < 1) {
313
+ throw new NativeConfigError(`textScaling.max ${String(max)} is not valid. Use a number of at least 1, such as 1.6, or "textScaling": false to keep the text at its default size.`);
314
+ }
315
+ return { enabled: true, max };
316
+ };
190
317
  /**
191
318
  * A shortcut's ID as part of a Swift type name or an Android resource name,
192
319
  * neither of which takes a hyphen: `show-photos` → `show_photos`.
@@ -1,4 +1,21 @@
1
1
  import type { Permission } from './options.ts';
2
+ /**
3
+ * A manifest permission: its name alone, or with the attributes that narrow
4
+ * it.
5
+ */
6
+ export type AndroidPermission = string | {
7
+ readonly name: string;
8
+ /**
9
+ * The newest API level that gets the permission, for one a later
10
+ * Android version replaced with another.
11
+ */
12
+ readonly maxSdkVersion?: number;
13
+ /**
14
+ * `|`-separated promises about how the app uses it, such as
15
+ * `neverForLocation`.
16
+ */
17
+ readonly usesPermissionFlags?: string;
18
+ };
2
19
  /**
3
20
  * What each cross-platform permission becomes on each OS. iOS asks the user
4
21
  * with the app's own reason string (an Info.plist usage description); Android
@@ -6,7 +23,7 @@ import type { Permission } from './options.ts';
6
23
  */
7
24
  export declare const PERMISSION_MAP: Record<Permission, {
8
25
  readonly ios: readonly string[];
9
- readonly android: readonly string[];
26
+ readonly android: readonly AndroidPermission[];
10
27
  /**
11
28
  * Hardware the Android permission implies. Declared as not required, or
12
29
  * Google Play hides the app from devices without it (a tablet without a
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,UAAU,EACV;IACE,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C,CA8CF,CAAC"}
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAEN;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,UAAU,EACV;IACE,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C,CA0GF,CAAC"}
@@ -22,12 +22,19 @@ export const PERMISSION_MAP = {
22
22
  ],
23
23
  androidFeatures: ['android.hardware.location'],
24
24
  },
25
+ // Reading the photo library, on iOS only. Nothing in the shells reads it:
26
+ // LynxImagePicker uses PHPicker and Android's Photo Picker, which need no
27
+ // permission. Android declares nothing for it, since Google Play rejects
28
+ // an app that declares READ_MEDIA_IMAGES without a core need for the
29
+ // whole library (its Photo and Video Permissions policy).
25
30
  photos: {
26
31
  ios: ['NSPhotoLibraryUsageDescription'],
27
- android: ['android.permission.READ_MEDIA_IMAGES'],
32
+ android: [],
28
33
  },
29
- // Adding to the photo library only, as the share sheet's Save Image does
30
- // (LynxShare). Android needs no permission for it.
34
+ // Adding to the photo library only, as the share sheet's Save Image and
35
+ // LynxPhotoLibrary do. The shells' photo library module is only in apps
36
+ // that ask for this. Android 10 and later need no permission for it, and
37
+ // LynxPhotoLibrary saves nothing before that.
31
38
  savePhotos: {
32
39
  ios: ['NSPhotoLibraryAddUsageDescription'],
33
40
  android: [],
@@ -43,6 +50,59 @@ export const PERMISSION_MAP = {
43
50
  ios: ['NSLocalNetworkUsageDescription'],
44
51
  android: [],
45
52
  },
53
+ // Face ID, Touch ID or a fingerprint, for LynxBiometrics and the values
54
+ // LynxSecureStorage keeps behind them. iOS shows the reason the first time
55
+ // the app uses Face ID (Touch ID needs none), and ends nothing without it:
56
+ // Face ID just fails. Android's USE_BIOMETRIC is granted at install. The
57
+ // shells' biometrics module is only in apps that ask for this.
58
+ biometrics: {
59
+ ios: ['NSFaceIDUsageDescription'],
60
+ android: ['android.permission.USE_BIOMETRIC'],
61
+ },
62
+ // Bluetooth LE devices, through LynxBluetooth. iOS asks with this reason the
63
+ // first time the app uses Bluetooth. Android 12 replaced BLUETOOTH and
64
+ // BLUETOOTH_ADMIN with the nearby devices permissions it asks for at
65
+ // runtime, so the old ones stop where it starts; before it, a scan also
66
+ // needs location. neverForLocation promises the app doesn't work out where
67
+ // the phone is from what a scan finds, so scanning needs no location from
68
+ // Android 12, which leaves some beacons out of the results in return.
69
+ bluetooth: {
70
+ ios: ['NSBluetoothAlwaysUsageDescription'],
71
+ android: [
72
+ { name: 'android.permission.BLUETOOTH', maxSdkVersion: 30 },
73
+ { name: 'android.permission.BLUETOOTH_ADMIN', maxSdkVersion: 30 },
74
+ { name: 'android.permission.ACCESS_FINE_LOCATION', maxSdkVersion: 30 },
75
+ {
76
+ name: 'android.permission.BLUETOOTH_SCAN',
77
+ usesPermissionFlags: 'neverForLocation',
78
+ },
79
+ 'android.permission.BLUETOOTH_CONNECT',
80
+ ],
81
+ androidFeatures: ['android.hardware.bluetooth_le'],
82
+ },
83
+ // Tracking the person across other companies' apps and websites, as an ad
84
+ // or install-attribution SDK does with the advertising ID: iOS (14.5 and
85
+ // later) won't hand over the advertising ID until the person allows it in App
86
+ // Tracking Transparency's prompt, which shows this reason, and ends an app
87
+ // that asks without one. Android 13 and later give an app that doesn't
88
+ // declare AD_ID a zeroed advertising ID. The shells' tracking module, and
89
+ // Google Play's advertising ID library on Android, are only in apps that
90
+ // ask for this (LynxTracking).
91
+ tracking: {
92
+ ios: ['NSUserTrackingUsageDescription'],
93
+ android: ['com.google.android.gms.permission.AD_ID'],
94
+ },
95
+ // Reading and writing NFC tags, for LynxNfc. iOS ends an app that opens a
96
+ // reader session without the reason, and refuses one signed without the
97
+ // NFC Tag Reading entitlement, which this adds too (IOS_ENTITLEMENTS in
98
+ // ios/project.ts). Android's NFC permission is granted at install. The feature isn't required, so Google Play still
99
+ // offers the app to phones without NFC, where LynxNfc says unsupported.
100
+ // The shells' NFC module is only in apps that ask for this.
101
+ nfc: {
102
+ ios: ['NFCReaderUsageDescription'],
103
+ android: ['android.permission.NFC'],
104
+ androidFeatures: ['android.hardware.nfc'],
105
+ },
46
106
  // iOS asks for notification permission at runtime without a usage string.
47
107
  notifications: {
48
108
  ios: [],
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.2",
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": {
@@ -38,7 +38,7 @@ A release build signed with the upload key holds only `arm64-v8a` and `armeabi-v
38
38
 
39
39
  ## Back button
40
40
 
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.
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 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
42
 
43
43
  ## Splash screen
44
44
 
@@ -83,23 +83,53 @@ iOS's shell does the same with App Intents: the generator writes `App/AppShortcu
83
83
 
84
84
  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
85
 
86
+ `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.
87
+
86
88
  ## Clipboard
87
89
 
88
90
  `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
91
 
92
+ ## Haptics
93
+
94
+ `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.
95
+
96
+ `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.
97
+
98
+ ## Bluetooth
99
+
100
+ `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.
101
+
90
102
  ## Photo picker
91
103
 
92
104
  `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
105
 
94
106
  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
107
 
108
+ `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`.
109
+
96
110
  ## Share sheet
97
111
 
112
+ `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`.
113
+
98
114
  `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
115
 
116
+ `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:)`.
117
+
118
+ `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.
119
+
120
+ `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`.
121
+
122
+ `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.
123
+
124
+ `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.
125
+
126
+ ## Photo library
127
+
128
+ `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, so the manifest declares none. Before Android 10 it would need `WRITE_EXTERNAL_STORAGE`, asked for while the app runs, which `MainActivity` has no way to ask for yet, so both methods answer `unavailable`/`unsupported` there. The module and its line in `MainActivity` (between `// angular-lynx:photo-library` markers) are only in an app with `permissions.savePhotos`.
129
+
100
130
  ## Canvas and WebGL
101
131
 
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.
132
+ `<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
133
 
104
134
  Android's GLES has no 2D uploads from a `PIXEL_UNPACK_BUFFER` and no `glGetVertexAttribPointerv`, so those log a warning and answer 0.
105
135
 
@@ -118,6 +148,9 @@ Pinned in `app/build.gradle.kts`, `build.gradle.kts` and `gradle/wrapper/gradle-
118
148
  - 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
149
  - `androidx.browser` 1.10.0, for the Custom Tabs `WebAuthModule` opens sign-in pages in and `LinkingModule` opens `openInApp()`'s pages in.
120
150
  - `androidx.exifinterface` 1.4.2, for the orientation `ImagePickerModule` turns a re-encoded photo by.
151
+ - `androidx.biometric` 1.1.0, for `BiometricsModule`'s prompt, only in an app with `permissions.biometrics`.
152
+ - `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).
153
+ - `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
154
  - 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
155
  - AGP 9.4.1 with its built-in Kotlin, Gradle 9.6.1 (AGP 9.4's minimum), JDK 17 or newer.
123
156
  - `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