@capgo/capacitor-updater 7.50.2 → 7.51.16

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 (32) hide show
  1. package/CapgoCapacitorUpdater.podspec +0 -2
  2. package/Package.swift +4 -5
  3. package/README.md +53 -48
  4. package/android/build.gradle +6 -6
  5. package/android/src/main/java/ee/forgr/capacitor_updater/AppLifecycleObserver.java +29 -2
  6. package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +7 -3
  7. package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +1 -0
  8. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +427 -116
  9. package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +1108 -182
  10. package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +102 -31
  11. package/android/src/main/java/ee/forgr/capacitor_updater/DataManager.java +23 -7
  12. package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +2 -2
  13. package/android/src/main/java/ee/forgr/capacitor_updater/DelayUpdateUtils.java +11 -0
  14. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +513 -201
  15. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +103 -3
  16. package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +1 -1
  17. package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +115 -133
  18. package/dist/docs.json +32 -8
  19. package/dist/esm/definitions.d.ts +41 -17
  20. package/dist/esm/definitions.js.map +1 -1
  21. package/ios/Sources/CapacitorUpdaterPlugin/AES.swift +124 -0
  22. package/ios/Sources/CapacitorUpdaterPlugin/BundleInfo.swift +9 -1
  23. package/ios/Sources/CapacitorUpdaterPlugin/BundleStatus.swift +3 -0
  24. package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +806 -92
  25. package/ios/Sources/CapacitorUpdaterPlugin/CapgoRawRsa.swift +36 -0
  26. package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +1020 -270
  27. package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +49 -31
  28. package/ios/Sources/CapacitorUpdaterPlugin/RSA.swift +73 -251
  29. package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +44 -20
  30. package/ios/Sources/CapacitorUpdaterPlugin/WebViewStatsReporter.swift +28 -0
  31. package/package.json +13 -8
  32. package/ios/Sources/CapacitorUpdaterPlugin/BigInt.swift +0 -39
@@ -15,7 +15,10 @@ declare module '@capacitor/cli' {
15
15
  */
16
16
  appReadyTimeout?: number;
17
17
  /**
18
- * Configure the number of seconds the native plugin should wait before considering API timeout.
18
+ * Configure the number of seconds the native plugin should wait before considering an HTTP timeout.
19
+ * Applies to update checks and file downloads. On Android these are idle connect/read/write
20
+ * timeouts and do not cap total download time; on iOS the request timeout also bounds the
21
+ * total download duration.
19
22
  *
20
23
  * Only available for Android and iOS.
21
24
  *
@@ -44,8 +47,9 @@ declare module '@capacitor/cli' {
44
47
  /**
45
48
  * Configure how the plugin checks for, downloads, and applies live updates.
46
49
  *
47
- * The plugin checks for updates when the app moves to the foreground and, if
48
- * {@link periodCheckDelay} is set, on a repeating timer while the app stays open.
50
+ * The plugin checks for updates when the app moves to the foreground. When
51
+ * {@link periodCheckDelay} is greater than 0, it also checks on a repeating timer
52
+ * while the app stays open.
49
53
  *
50
54
  * Boolean values keep their existing behavior:
51
55
  * - `true`: Same as `"atBackground"`.
@@ -99,7 +103,8 @@ declare module '@capacitor/cli' {
99
103
  * Native stats include update lifecycle events, app health signals such as crashes,
100
104
  * Android ANRs, low-memory exits, iOS memory warnings, and WebView health signals
101
105
  * such as JavaScript errors, unhandled promise rejections, resource load failures,
102
- * WebView renderer exits, and unclean WebView restarts when available.
106
+ * WebView renderer exits, unclean WebView restarts, app launch readiness timing,
107
+ * and WebView load milestones when available.
103
108
  *
104
109
  * @default https://plugin.capgo.app/stats
105
110
  * @example https://example.com/api/stats
@@ -130,10 +135,10 @@ declare module '@capacitor/cli' {
130
135
  * @deprecated Use {@link PluginsConfig.CapacitorUpdater.autoUpdate} string modes instead.
131
136
  * Works well for apps less than 10MB and with uploads done using --delta flag.
132
137
  * Zip or apps more than 10MB will be relatively slow for users to update.
133
- * - false: Never do direct updates (use default behavior: download on foreground check, apply when backgrounded)
134
- * - atInstall: Direct update only after app install or native app store update, otherwise act as directUpdate = false
135
- * - onLaunch: Direct update only when the app is brought to the foreground from a killed state, otherwise act as directUpdate = false
136
- * - always: Direct update on every foreground check whenever an update is available, never act as directUpdate = false
138
+ * - false: Never do direct updates
139
+ * - atInstall: Same as `"atInstall"` for {@link autoUpdate}
140
+ * - onLaunch: Same as `"onLaunch"` for {@link autoUpdate}
141
+ * - always: Same as `"always"` for {@link autoUpdate}
137
142
  * - true: (deprecated) Same as "always" for backward compatibility
138
143
  *
139
144
  * Activate this flag will automatically make the CLI upload delta in CICD envs and will ask for confirmation in local uploads.
@@ -181,7 +186,8 @@ declare module '@capacitor/cli' {
181
186
  */
182
187
  autoSplashscreenTimeout?: number;
183
188
  /**
184
- * Configure the delay period for period update check. the unit is in seconds.
189
+ * Configure the interval in seconds for repeating update checks while the app stays open.
190
+ * Foreground checks still run when this is 0. Values below 600 are normalized to 600.
185
191
  *
186
192
  * Only available for Android and iOS.
187
193
  * Cannot be less than 600 seconds (10 minutes).
@@ -308,6 +314,22 @@ declare module '@capacitor/cli' {
308
314
  * @since 7.34.0
309
315
  */
310
316
  allowSetDefaultChannel?: boolean;
317
+ /**
318
+ * Keep the default channel stored by {@link CapacitorUpdaterPlugin.setChannel} or refreshed by
319
+ * {@link CapacitorUpdaterPlugin.getChannel} when app data is restored into a new app install.
320
+ *
321
+ * `setChannel()` and a successful `getChannel()` still persist the selected channel across app
322
+ * restarts. When this option is `false`, native startup clears that persisted channel when it
323
+ * detects app data restored into a new installation. Native build cleanup clears the persisted
324
+ * channel only when `persistDefaultChannelOnReinstall` is `false`, `resetWhenUpdate` is `true`,
325
+ * and the native build version has changed.
326
+ *
327
+ * Only available for Android and iOS.
328
+ *
329
+ * @default true
330
+ * @since 8.51.0
331
+ */
332
+ persistDefaultChannelOnReinstall?: boolean;
311
333
  /**
312
334
  * Set the default channel for the app in the config. Case sensitive.
313
335
  * This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud.
@@ -485,7 +507,9 @@ export interface CapacitorUpdaterPlugin {
485
507
  * **Android Background Runner note:** `@capacitor/background-runner` loads its
486
508
  * configured runner script from native APK assets. Live updates cannot replace
487
509
  * that runner script. Keep it stable across OTA updates and ship a native app
488
- * update when the runner code changes.
510
+ * update when the runner code changes. When a bundle switch happens, Capacitor
511
+ * Updater cancels and reschedules configured Background Runner WorkManager jobs
512
+ * and syncs the bundled runner script into native `public/` storage when present.
489
513
  *
490
514
  * @example
491
515
  * const bundle = await CapacitorUpdater.download({
@@ -942,9 +966,9 @@ export interface CapacitorUpdaterPlugin {
942
966
  * (e.g., "production", "beta", "staging"). This method switches the device to a new channel.
943
967
  *
944
968
  * **Device Override UI:** `setChannel()` validates the channel with the backend, then stores the
945
- * selected channel locally on the device. It does not create or update a backend Device Override,
946
- * so the device will not appear as overridden in the Capgo dashboard. Only assignments created
947
- * from the dashboard or the Public API are shown in the Device Override UI.
969
+ * selected channel locally on the device for future app restarts. It does not create or update
970
+ * a backend Device Override, so the device will not appear as overridden in the Capgo dashboard.
971
+ * Only assignments created from the dashboard or the Public API are shown in the Device Override UI.
948
972
  *
949
973
  * **Requirements:**
950
974
  * - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)
@@ -973,7 +997,7 @@ export interface CapacitorUpdaterPlugin {
973
997
  * ```
974
998
  *
975
999
  * This sends a request to the Capgo backend to validate the specified channel, then stores the
976
- * channel locally on the device.
1000
+ * channel locally on the device for future app restarts.
977
1001
  *
978
1002
  * @param options The {@link SetChannelOptions} containing the channel name and optional auto-update trigger.
979
1003
  * @returns {Promise<ChannelRes>} Channel operation result with status and optional error/message.
@@ -1014,8 +1038,8 @@ export interface CapacitorUpdaterPlugin {
1014
1038
  * - Check if a device is on a specific channel before showing features
1015
1039
  * - Verify channel assignment after calling {@link setChannel}
1016
1040
  *
1017
- * On native platforms, a successful response also refreshes the locally persisted
1018
- * default channel used by update checks.
1041
+ * On native platforms, a successful response also refreshes the default channel used by update checks.
1042
+ * This refresh is persisted across app restarts.
1019
1043
  *
1020
1044
  * @returns {Promise<GetChannelRes>} The current channel information.
1021
1045
  * @throws {Error} If the operation fails.
@@ -1599,7 +1623,7 @@ export interface CapacitorUpdaterPlugin {
1599
1623
  * success: The bundle has been downloaded and is ready to be **SET** as the next bundle.
1600
1624
  * error: The bundle has failed to download.
1601
1625
  */
1602
- export type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';
1626
+ export type BundleStatus = 'success' | 'error' | 'pending' | 'downloading' | 'deleted' | 'deleting';
1603
1627
  export type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';
1604
1628
  /**
1605
1629
  * Classification for update-check responses that do not provide a downloadable bundle.