@capgo/capacitor-updater 5.51.17 → 5.51.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -42
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +44 -30
- package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +437 -351
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +51 -18
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +330 -92
- package/android/src/main/java/ee/forgr/capacitor_updater/Logger.java +12 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +12 -16
- package/dist/docs.json +4 -4
- package/dist/esm/definitions.d.ts +12 -9
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/history.js +7 -7
- package/dist/esm/history.js.map +1 -1
- package/dist/plugin.cjs.js +7 -7
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +7 -7
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +245 -95
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +190 -35
- package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +39 -31
- package/ios/Sources/CapacitorUpdaterPlugin/DelayUpdateUtils.swift +16 -41
- package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +6 -3
- package/package.json +6 -8
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ Perfect for fixing bugs immediately, A/B testing features, and maintaining contr
|
|
|
46
46
|
- 🔄 Auto Update: Automatically download and set the latest bundle for the app.
|
|
47
47
|
- 🛟 Rollback: Reset the app to last working bundle if an incompatible bundle has been set.
|
|
48
48
|
- 🔁 **Delta Updates**: Make instant updates by only downloading changed files.
|
|
49
|
-
- 🔒
|
|
49
|
+
- 🔒 Security: checksum on every update; encryption optional for high-security apps.
|
|
50
50
|
- ⚔️ **Battle-Tested**: Used in more than 3000 projects.
|
|
51
51
|
- 📊 View your deployment statistics
|
|
52
52
|
- 🔋 Supports Android and iOS
|
|
@@ -185,6 +185,15 @@ And follow the steps by step to setup your app.
|
|
|
185
185
|
|
|
186
186
|
For detailed instructions on the auto-update setup, refer to the [Auto update documentation](https://capgo.app/docs/plugin/cloud-mode/getting-started/).
|
|
187
187
|
|
|
188
|
+
### Instant apply (`always`, `atInstall`, `onLaunch`)
|
|
189
|
+
|
|
190
|
+
These modes apply the update while the user is waiting. Upload with `--delta` so only changed files download:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
npx @capgo/cli@latest bundle upload --delta
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
They also require `@capacitor/splash-screen` and `autoSplashscreen: true` with `SplashScreen.launchAutoHide: false`. See [Update Behavior](https://capgo.app/docs/live-updates/update-behavior/).
|
|
188
197
|
|
|
189
198
|
## No Cloud setup
|
|
190
199
|
|
|
@@ -300,47 +309,47 @@ Downgrading to a previous version of the updater plugin is not supported.
|
|
|
300
309
|
|
|
301
310
|
CapacitorUpdater can be configured with these options:
|
|
302
311
|
|
|
303
|
-
| Prop | Type | Description
|
|
304
|
-
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
305
|
-
| **`appReadyTimeout`** | <code>number</code> | Configure the number of milliseconds the native plugin should wait before considering an update 'failed'. Only available for Android and iOS.
|
|
306
|
-
| **`responseTimeout`** | <code>number</code> | Configure the number of seconds the native plugin should wait before considering an HTTP timeout. Applies to update checks and file downloads. On Android these are idle connect/read/write timeouts and do not cap total download time; on iOS the request timeout also bounds the total download duration. Only available for Android and iOS.
|
|
307
|
-
| **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS.
|
|
308
|
-
| **`autoDeletePrevious`** | <code>boolean</code> | Configure whether the plugin should use automatically delete previous bundles after a successful update. Only available for Android and iOS.
|
|
309
|
-
| **`autoUpdate`** | <code>boolean \| 'always' \| 'off' \| 'atBackground' \| 'atInstall' \| 'onLaunch' \| 'onlyDownload'</code> | Configure how the plugin checks for, downloads, and applies live updates. The plugin checks for updates when the app moves to the foreground. When {@link periodCheckDelay} is greater than 0, it also checks on a repeating timer while the app stays open. Boolean values keep their existing behavior: - `true`: Same as `"atBackground"`. - `false`: Same as `"off"`. String values merge the previous Auto Update and Direct Update configuration: - `"off"`: Disable automatic update checks. - `"atBackground"`: Check and download automatically on each foreground check, then apply the update the next time the app moves to background. - `"atInstall"`: Apply immediately only after a fresh install or native app store update; otherwise use `"atBackground"` behavior. - `"onLaunch"`: Apply immediately only when the app is brought to the foreground from a killed state (cold start). After that first check, fall back to `"atBackground"` behavior. - `"always"`: Check on every foreground transition and apply immediately whenever an update is available. - `"onlyDownload"`: Check and download automatically, emit `updateAvailable`, and never set the next bundle or apply an update automatically. Only available for Android and iOS. | <code>true</code> | |
|
|
310
|
-
| **`resetWhenUpdate`** | <code>boolean</code> | Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device. Setting this to false can broke the auto update flow if the user download from the store a native app bundle that is older than the current downloaded bundle. Upload will be prevented by channel setting downgrade_under_native. Only available for Android and iOS.
|
|
311
|
-
| **`updateUrl`** | <code>string</code> | Configure the URL / endpoint to which update checks are sent. Only available for Android and iOS.
|
|
312
|
-
| **`channelUrl`** | <code>string</code> | Configure the URL / endpoint for channel operations. Only available for Android and iOS.
|
|
313
|
-
| **`statsUrl`** | <code>string</code> | Configure the URL / endpoint to which update statistics are sent. Only available for Android and iOS. Set to "" to disable stats reporting. Native stats include update lifecycle events, app health signals such as crashes, Android ANRs, low-memory exits, iOS memory warnings, and WebView health signals such as JavaScript errors, unhandled promise rejections, resource load failures, WebView renderer exits, unclean WebView restarts, app launch readiness timing, and WebView load milestones when available.
|
|
314
|
-
| **`publicKey`** | <code>string</code> | Configure the public key for end to end live update encryption Version 2 Only available for Android and iOS.
|
|
315
|
-
| **`version`** | <code>string</code> | Configure the current version of the app. This will be used for the first update request. If not set, the plugin will get the version from the native code. Only available for Android and iOS.
|
|
316
|
-
| **`directUpdate`** | <code>boolean \| 'always' \| 'atInstall' \| 'onLaunch'</code> | Configure when the plugin should direct install updates. Only for autoUpdate mode.
|
|
317
|
-
| **`autoSplashscreen`** | <code>boolean</code> | Automatically
|
|
318
|
-
| **`autoSplashscreenLoader`** | <code>boolean</code> | Display a native loading indicator on top of the splashscreen while automatic direct updates are running. Only takes effect when {@link autoSplashscreen} is enabled. Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false. Only available for Android and iOS.
|
|
319
|
-
| **`autoSplashscreenTimeout`** | <code>number</code> | Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates. If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed. Set to `0` (zero) to disable the timeout. When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch. Requires {@link autoSplashscreen} to be enabled. Only available for Android and iOS.
|
|
320
|
-
| **`periodCheckDelay`** | <code>number</code> | Configure the interval in seconds for repeating update checks while the app stays open. Foreground checks still run when this is 0. Values below 600 are normalized to 600. Only available for Android and iOS. Cannot be less than 600 seconds (10 minutes).
|
|
321
|
-
| **`localS3`** | <code>boolean</code> | Configure the CLI to use a local server for testing or self-hosted update server.
|
|
322
|
-
| **`localHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server.
|
|
323
|
-
| **`localWebHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server.
|
|
324
|
-
| **`localSupa`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server.
|
|
325
|
-
| **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing.
|
|
326
|
-
| **`localApi`** | <code>string</code> | Configure the CLI to use a local api for testing.
|
|
327
|
-
| **`localApiFiles`** | <code>string</code> | Configure the CLI to use a local file api for testing.
|
|
328
|
-
| **`allowModifyUrl`** | <code>boolean</code> | Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side.
|
|
329
|
-
| **`allowModifyAppId`** | <code>boolean</code> | Allow the plugin to modify the appId dynamically from the JavaScript side.
|
|
330
|
-
| **`allowManualBundleError`** | <code>boolean</code> | Allow marking bundles as errored from JavaScript while using manual update flows. When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`.
|
|
331
|
-
| **`allowPreview`** | <code>boolean</code> | Allow JavaScript to start a native preview session and temporarily request updates for another app id. This is intended for trusted container apps that implement Expo Go-style preview flows. Only available for Android and iOS.
|
|
332
|
-
| **`persistCustomId`** | <code>boolean</code> | Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts. Only available for Android and iOS.
|
|
333
|
-
| **`persistModifyUrl`** | <code>boolean</code> | Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl}, {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts. Only available for Android and iOS.
|
|
334
|
-
| **`allowSetDefaultChannel`** | <code>boolean</code> | Allow or disallow the {@link CapacitorUpdaterPlugin.setChannel} method to modify the defaultChannel. When set to `false`, calling `setChannel()` will return an error with code `disabled_by_config`.
|
|
335
|
-
| **`persistDefaultChannelOnReinstall`** | <code>boolean</code> | Keep the default channel stored by {@link CapacitorUpdaterPlugin.setChannel} or refreshed by {@link CapacitorUpdaterPlugin.getChannel} when app data is restored into a new app install. `setChannel()` and a successful `getChannel()` still persist the selected channel across app restarts. When this option is `false`, native startup clears that persisted channel when it detects app data restored into a new installation. Native build cleanup clears the persisted channel only when `persistDefaultChannelOnReinstall` is `false`, `resetWhenUpdate` is `true`, and the native build version has changed. Only available for Android and iOS.
|
|
336
|
-
| **`defaultChannel`** | <code>string</code> | Set the default channel for the app in the config. Case sensitive. This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud. This requires the channel to allow devices to self dissociate/associate in the channel settings. https://capgo.app/docs/public-api/channels/#channel-configuration-options
|
|
337
|
-
| **`appId`** | <code>string</code> | Configure the app id for the app in the config.
|
|
338
|
-
| **`keepUrlPathAfterReload`** | <code>boolean</code> | Configure the plugin to keep the URL path after a reload. WARNING: When a reload is triggered, 'window.history' will be cleared.
|
|
339
|
-
| **`disableJSLogging`** | <code>boolean</code> | Disable the JavaScript logging of the plugin. if true, the plugin will not log to the JavaScript console. only the native log will be done
|
|
340
|
-
| **`osLogging`** | <code>boolean</code> | Enable OS-level logging. When enabled, logs are written to the system log which can be inspected in production builds. - **iOS**: Uses os_log instead of Swift.print, logs accessible via Console.app or Instruments - **Android**: Logs to Logcat (android.util.Log) When set to false, system logging is disabled on both platforms (only JavaScript console logging will occur if enabled). This is useful for debugging production apps (App Store/TestFlight builds on iOS, or production APKs on Android).
|
|
341
|
-
| **`shakeMenu`** | <code>boolean</code> | Enable the native preview menu gesture while a preview session is active. Outside preview sessions this preview menu is ignored, unless {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled.
|
|
342
|
-
| **`shakeMenuGesture`** | <code><a href="#shakemenugesture">ShakeMenuGesture</a></code> | Choose which native gesture opens the preview/channel menu. This applies to both {@link PluginsConfig.CapacitorUpdater.shakeMenu} and {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}. Only available for Android and iOS.
|
|
343
|
-
| **`allowShakeChannelSelector`** | <code>boolean</code> | Enable the native menu gesture to show a channel selector menu for switching between update channels. If {@link PluginsConfig.CapacitorUpdater.shakeMenu} is also enabled while a preview session is active, the shake menu includes both preview actions and channel switching. The native gesture can be changed with {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}. Only available for Android and iOS.
|
|
312
|
+
| Prop | Type | Description | Default | Since |
|
|
313
|
+
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------- |
|
|
314
|
+
| **`appReadyTimeout`** | <code>number</code> | Configure the number of milliseconds the native plugin should wait before considering an update 'failed'. Only available for Android and iOS. | <code>10000 // (10 seconds)</code> | |
|
|
315
|
+
| **`responseTimeout`** | <code>number</code> | Configure the number of seconds the native plugin should wait before considering an HTTP timeout. Applies to update checks and file downloads. On Android these are idle connect/read/write timeouts and do not cap total download time; on iOS the request timeout also bounds the total download duration. Only available for Android and iOS. | <code>20 // (20 second)</code> | |
|
|
316
|
+
| **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS. | <code>true</code> | |
|
|
317
|
+
| **`autoDeletePrevious`** | <code>boolean</code> | Configure whether the plugin should use automatically delete previous bundles after a successful update. Only available for Android and iOS. | <code>true</code> | |
|
|
318
|
+
| **`autoUpdate`** | <code>boolean \| 'always' \| 'off' \| 'atBackground' \| 'atInstall' \| 'onLaunch' \| 'onlyDownload'</code> | Configure how the plugin checks for, downloads, and applies live updates. The plugin checks for updates when the app moves to the foreground. When {@link periodCheckDelay} is greater than 0, it also checks on a repeating timer while the app stays open. Boolean values keep their existing behavior: - `true`: Same as `"atBackground"`. - `false`: Same as `"off"`. String values merge the previous Auto Update and Direct Update configuration: - `"off"`: Disable automatic update checks. - `"atBackground"`: Check and download automatically on each foreground check, then apply the update the next time the app moves to background. - `"atInstall"`: Apply immediately only after a fresh install or native app store update; otherwise use `"atBackground"` behavior. - `"onLaunch"`: Apply immediately only when the app is brought to the foreground from a killed state (cold start). After that first check, fall back to `"atBackground"` behavior. - `"always"`: Check on every foreground transition and apply immediately whenever an update is available. - `"onlyDownload"`: Check and download automatically, emit `updateAvailable`, and never set the next bundle or apply an update automatically. Instant apply modes (`"atInstall"`, `"onLaunch"`, `"always"`) apply while the user is waiting. Upload with `npx @capgo/cli@latest bundle upload --delta` so only changed files download. A full zip upload slows the user experience. These modes require `autoSplashscreen: true` and `@capacitor/splash-screen` installed with `launchAutoHide: false`. Only available for Android and iOS. | <code>true</code> | |
|
|
319
|
+
| **`resetWhenUpdate`** | <code>boolean</code> | Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device. Setting this to false can broke the auto update flow if the user download from the store a native app bundle that is older than the current downloaded bundle. Upload will be prevented by channel setting downgrade_under_native. Only available for Android and iOS. | <code>true</code> | |
|
|
320
|
+
| **`updateUrl`** | <code>string</code> | Configure the URL / endpoint to which update checks are sent. Only available for Android and iOS. | <code>https://plugin.capgo.app/updates</code> | |
|
|
321
|
+
| **`channelUrl`** | <code>string</code> | Configure the URL / endpoint for channel operations. Only available for Android and iOS. | <code>https://plugin.capgo.app/channel_self</code> | |
|
|
322
|
+
| **`statsUrl`** | <code>string</code> | Configure the URL / endpoint to which update statistics are sent. Only available for Android and iOS. Set to "" to disable stats reporting. Native stats include update lifecycle events, app health signals such as crashes, Android ANRs, low-memory exits, iOS memory warnings, and WebView health signals such as JavaScript errors, unhandled promise rejections, resource load failures, WebView renderer exits, unclean WebView restarts, app launch readiness timing, and WebView load milestones when available. | <code>https://plugin.capgo.app/stats</code> | |
|
|
323
|
+
| **`publicKey`** | <code>string</code> | Configure the public key for end to end live update encryption Version 2 Only available for Android and iOS. | <code>undefined</code> | 6.2.0 |
|
|
324
|
+
| **`version`** | <code>string</code> | Configure the current version of the app. This will be used for the first update request. If not set, the plugin will get the version from the native code. Only available for Android and iOS. | <code>undefined</code> | 4.17.48 |
|
|
325
|
+
| **`directUpdate`** | <code>boolean \| 'always' \| 'atInstall' \| 'onLaunch'</code> | Configure when the plugin should direct install updates. Only for autoUpdate mode. Instant apply (`atInstall`, `onLaunch`, `always`) should be uploaded with `--delta` so the update does not slow the user experience. A full zip, especially over 10MB, is relatively slow for users. These modes require `autoSplashscreen: true` and `@capacitor/splash-screen` installed with `launchAutoHide: false`. This flag makes the CLI upload delta in CI and ask for confirmation in local uploads. - false: Never do direct updates - atInstall: Same as `"atInstall"` for {@link autoUpdate} - onLaunch: Same as `"onLaunch"` for {@link autoUpdate} - always: Same as `"always"` for {@link autoUpdate} - true: (deprecated) Same as "always" for backward compatibility | <code>false</code> | 5.1.0 |
|
|
326
|
+
| **`autoSplashscreen`** | <code>boolean</code> | Automatically hide the splashscreen after instant apply updates finish, or when no update is needed. Required when using instant apply modes (`"atInstall"`, `"onLaunch"`, `"always"`), including the deprecated `directUpdate` values `"atInstall"`, `"onLaunch"`, `"always"`, and `true`. `@capacitor/splash-screen` must be installed and configured with `launchAutoHide: false`. This removes the need to manually listen for appReady events and call SplashScreen.hide(). Only available for Android and iOS. | <code>false</code> | 7.6.0 |
|
|
327
|
+
| **`autoSplashscreenLoader`** | <code>boolean</code> | Display a native loading indicator on top of the splashscreen while automatic direct updates are running. Only takes effect when {@link autoSplashscreen} is enabled. Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false. Only available for Android and iOS. | <code>false</code> | 7.19.0 |
|
|
328
|
+
| **`autoSplashscreenTimeout`** | <code>number</code> | Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates. If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed. Set to `0` (zero) to disable the timeout. When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch. Requires {@link autoSplashscreen} to be enabled. Only available for Android and iOS. | <code>10000 // (10 seconds)</code> | 7.19.0 |
|
|
329
|
+
| **`periodCheckDelay`** | <code>number</code> | Configure the interval in seconds for repeating update checks while the app stays open. Foreground checks still run when this is 0. Values below 600 are normalized to 600. Only available for Android and iOS. Cannot be less than 600 seconds (10 minutes). | <code>0 (disabled)</code> | |
|
|
330
|
+
| **`localS3`** | <code>boolean</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
331
|
+
| **`localHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
332
|
+
| **`localWebHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
333
|
+
| **`localSupa`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
334
|
+
| **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing. | <code>undefined</code> | 4.17.48 |
|
|
335
|
+
| **`localApi`** | <code>string</code> | Configure the CLI to use a local api for testing. | <code>undefined</code> | 6.3.3 |
|
|
336
|
+
| **`localApiFiles`** | <code>string</code> | Configure the CLI to use a local file api for testing. | <code>undefined</code> | 6.3.3 |
|
|
337
|
+
| **`allowModifyUrl`** | <code>boolean</code> | Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side. | <code>false</code> | 5.4.0 |
|
|
338
|
+
| **`allowModifyAppId`** | <code>boolean</code> | Allow the plugin to modify the appId dynamically from the JavaScript side. | <code>false</code> | 7.14.0 |
|
|
339
|
+
| **`allowManualBundleError`** | <code>boolean</code> | Allow marking bundles as errored from JavaScript while using manual update flows. When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`. | <code>false</code> | 7.20.0 |
|
|
340
|
+
| **`allowPreview`** | <code>boolean</code> | Allow JavaScript to start a native preview session and temporarily request updates for another app id. This is intended for trusted container apps that implement Expo Go-style preview flows. Only available for Android and iOS. | <code>false</code> | 8.47.0 |
|
|
341
|
+
| **`persistCustomId`** | <code>boolean</code> | Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts. Only available for Android and iOS. | <code>false (will be true by default in a future major release v8.x.x)</code> | 7.17.3 |
|
|
342
|
+
| **`persistModifyUrl`** | <code>boolean</code> | Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl}, {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts. Only available for Android and iOS. | <code>false</code> | 7.20.0 |
|
|
343
|
+
| **`allowSetDefaultChannel`** | <code>boolean</code> | Allow or disallow the {@link CapacitorUpdaterPlugin.setChannel} method to modify the defaultChannel. When set to `false`, calling `setChannel()` will return an error with code `disabled_by_config`. | <code>true</code> | 7.34.0 |
|
|
344
|
+
| **`persistDefaultChannelOnReinstall`** | <code>boolean</code> | Keep the default channel stored by {@link CapacitorUpdaterPlugin.setChannel} or refreshed by {@link CapacitorUpdaterPlugin.getChannel} when app data is restored into a new app install. `setChannel()` and a successful `getChannel()` still persist the selected channel across app restarts. When this option is `false`, native startup clears that persisted channel when it detects app data restored into a new installation. Native build cleanup clears the persisted channel only when `persistDefaultChannelOnReinstall` is `false`, `resetWhenUpdate` is `true`, and the native build version has changed. Only available for Android and iOS. | <code>true</code> | 8.51.0 |
|
|
345
|
+
| **`defaultChannel`** | <code>string</code> | Set the default channel for the app in the config. Case sensitive. This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud. This requires the channel to allow devices to self dissociate/associate in the channel settings. https://capgo.app/docs/public-api/channels/#channel-configuration-options | <code>undefined</code> | 5.5.0 |
|
|
346
|
+
| **`appId`** | <code>string</code> | Configure the app id for the app in the config. | <code>undefined</code> | 6.0.0 |
|
|
347
|
+
| **`keepUrlPathAfterReload`** | <code>boolean</code> | Configure the plugin to keep the URL path after a reload. WARNING: When a reload is triggered, 'window.history' will be cleared. | <code>false</code> | 6.8.0 |
|
|
348
|
+
| **`disableJSLogging`** | <code>boolean</code> | Disable the JavaScript logging of the plugin. if true, the plugin will not log to the JavaScript console. only the native log will be done | <code>false</code> | 7.3.0 |
|
|
349
|
+
| **`osLogging`** | <code>boolean</code> | Enable OS-level logging. When enabled, logs are written to the system log which can be inspected in production builds. - **iOS**: Uses os_log instead of Swift.print, logs accessible via Console.app or Instruments - **Android**: Logs to Logcat (android.util.Log) When set to false, system logging is disabled on both platforms (only JavaScript console logging will occur if enabled). This is useful for debugging production apps (App Store/TestFlight builds on iOS, or production APKs on Android). | <code>true</code> | 8.42.0 |
|
|
350
|
+
| **`shakeMenu`** | <code>boolean</code> | Enable the native preview menu gesture while a preview session is active. Outside preview sessions this preview menu is ignored, unless {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector} is enabled. | <code>false</code> | 7.5.0 |
|
|
351
|
+
| **`shakeMenuGesture`** | <code><a href="#shakemenugesture">ShakeMenuGesture</a></code> | Choose which native gesture opens the preview/channel menu. This applies to both {@link PluginsConfig.CapacitorUpdater.shakeMenu} and {@link PluginsConfig.CapacitorUpdater.allowShakeChannelSelector}. Only available for Android and iOS. | <code>'shake'</code> | 8.48.0 |
|
|
352
|
+
| **`allowShakeChannelSelector`** | <code>boolean</code> | Enable the native menu gesture to show a channel selector menu for switching between update channels. If {@link PluginsConfig.CapacitorUpdater.shakeMenu} is also enabled while a preview session is active, the shake menu includes both preview actions and channel switching. The native gesture can be changed with {@link PluginsConfig.CapacitorUpdater.shakeMenuGesture}. Only available for Android and iOS. | <code>false</code> | 8.43.0 |
|
|
344
353
|
|
|
345
354
|
### Examples
|
|
346
355
|
|
|
@@ -146,7 +146,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
146
146
|
static final int APPLICATION_EXIT_REASON_USER_REQUESTED = 10;
|
|
147
147
|
static final int APPLICATION_EXIT_REASON_DEPENDENCY_DIED = 12;
|
|
148
148
|
|
|
149
|
-
private final String pluginVersion = "5.51.
|
|
149
|
+
private final String pluginVersion = "5.51.23";
|
|
150
150
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
151
151
|
|
|
152
152
|
private SharedPreferences.Editor editor;
|
|
@@ -2139,9 +2139,10 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
2139
2139
|
);
|
|
2140
2140
|
}
|
|
2141
2141
|
} else {
|
|
2142
|
-
final boolean enabled =
|
|
2143
|
-
|
|
2144
|
-
|
|
2142
|
+
final boolean enabled =
|
|
2143
|
+
configuredMode != null
|
|
2144
|
+
? "true".equals(configuredMode)
|
|
2145
|
+
: Boolean.TRUE.equals(this.getConfig().getBoolean("autoUpdate", true));
|
|
2145
2146
|
this.autoUpdateMode = enabled
|
|
2146
2147
|
? autoUpdateModeForLegacyDirectUpdateMode(this.resolveLegacyDirectUpdateModeFromConfig())
|
|
2147
2148
|
: AUTO_UPDATE_MODE_OFF;
|
|
@@ -2841,6 +2842,16 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
2841
2842
|
final String checksum,
|
|
2842
2843
|
final JSONArray manifest
|
|
2843
2844
|
) throws IOException {
|
|
2845
|
+
if (!this.implementation.publicKey.isEmpty() && !CryptoCipher.isValidSessionKey(sessionKey)) {
|
|
2846
|
+
logger.error("Public key present but no valid session key provided");
|
|
2847
|
+
this.implementation.sendStats("session_key_required");
|
|
2848
|
+
throw new IOException("Session key required when public key is present");
|
|
2849
|
+
}
|
|
2850
|
+
if (manifest == null && (checksum == null || checksum.isEmpty())) {
|
|
2851
|
+
logger.error("No checksum provided");
|
|
2852
|
+
this.implementation.sendStats("checksum_required");
|
|
2853
|
+
throw new IOException("Checksum required");
|
|
2854
|
+
}
|
|
2844
2855
|
// Manual/preview downloads must wait too — launch orphan sweep can delete their temps.
|
|
2845
2856
|
waitForCleanupIfNeeded();
|
|
2846
2857
|
if (manifest != null) {
|
|
@@ -4013,33 +4024,30 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
4013
4024
|
this.editor.putBoolean(PREVIEW_SESSION_ALERT_PENDING_PREF_KEY, false);
|
|
4014
4025
|
this.editor.apply();
|
|
4015
4026
|
|
|
4016
|
-
new Handler(Looper.getMainLooper()).postDelayed(
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
if (getActivity() == null || getActivity().isFinishing()) {
|
|
4023
|
-
this.previewSessionAlertPending = true;
|
|
4024
|
-
this.editor.putBoolean(PREVIEW_SESSION_ALERT_PENDING_PREF_KEY, true);
|
|
4025
|
-
this.editor.apply();
|
|
4026
|
-
return;
|
|
4027
|
-
}
|
|
4028
|
-
|
|
4029
|
-
new AlertDialog.Builder(getActivity())
|
|
4030
|
-
.setTitle("Preview started")
|
|
4031
|
-
.setMessage("shake".equals(this.shakeMenuGesture) ? "Shake to open menu." : "Three-finger pinch to open menu.")
|
|
4032
|
-
.setPositiveButton("Got it", (dialog, which) -> dialog.dismiss())
|
|
4033
|
-
.show();
|
|
4034
|
-
} catch (final Exception e) {
|
|
4027
|
+
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
|
4028
|
+
try {
|
|
4029
|
+
if (!Boolean.TRUE.equals(this.previewSessionEnabled)) {
|
|
4030
|
+
return;
|
|
4031
|
+
}
|
|
4032
|
+
if (getActivity() == null || getActivity().isFinishing()) {
|
|
4035
4033
|
this.previewSessionAlertPending = true;
|
|
4036
4034
|
this.editor.putBoolean(PREVIEW_SESSION_ALERT_PENDING_PREF_KEY, true);
|
|
4037
4035
|
this.editor.apply();
|
|
4038
|
-
|
|
4036
|
+
return;
|
|
4039
4037
|
}
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4038
|
+
|
|
4039
|
+
new AlertDialog.Builder(getActivity())
|
|
4040
|
+
.setTitle("Preview started")
|
|
4041
|
+
.setMessage("shake".equals(this.shakeMenuGesture) ? "Shake to open menu." : "Three-finger pinch to open menu.")
|
|
4042
|
+
.setPositiveButton("Got it", (dialog, which) -> dialog.dismiss())
|
|
4043
|
+
.show();
|
|
4044
|
+
} catch (final Exception e) {
|
|
4045
|
+
this.previewSessionAlertPending = true;
|
|
4046
|
+
this.editor.putBoolean(PREVIEW_SESSION_ALERT_PENDING_PREF_KEY, true);
|
|
4047
|
+
this.editor.apply();
|
|
4048
|
+
logger.warn("Could not show preview session notice: " + e.getMessage());
|
|
4049
|
+
}
|
|
4050
|
+
}, 600);
|
|
4043
4051
|
}
|
|
4044
4052
|
|
|
4045
4053
|
@PluginMethod
|
|
@@ -4785,8 +4793,8 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
4785
4793
|
final String messageUpdate = initialDirectUpdateAllowed
|
|
4786
4794
|
? "Update will occur now."
|
|
4787
4795
|
: this.shouldAutoSetNextBundle()
|
|
4788
|
-
|
|
4789
|
-
|
|
4796
|
+
? "Update will occur next time app moves to background."
|
|
4797
|
+
: "Update will be downloaded and made available.";
|
|
4790
4798
|
Thread newTask = startNewThread(() -> {
|
|
4791
4799
|
if (CapacitorUpdaterPlugin.this.shouldBlockAutoUpdateForPreviewSession()) {
|
|
4792
4800
|
CapacitorUpdaterPlugin.this.clearBackgroundDownloadState();
|
|
@@ -4938,7 +4946,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
4938
4946
|
);
|
|
4939
4947
|
return;
|
|
4940
4948
|
}
|
|
4941
|
-
|
|
4949
|
+
final String latestSessionKey = jsRes.has("sessionKey") ? jsRes.getString("sessionKey") : "";
|
|
4950
|
+
if (
|
|
4951
|
+
latest.isDownloaded() &&
|
|
4952
|
+
BundleStatus.DOWNLOADING != latest.getStatus() &&
|
|
4953
|
+
(CapacitorUpdaterPlugin.this.implementation.publicKey.isEmpty() ||
|
|
4954
|
+
CryptoCipher.isValidSessionKey(latestSessionKey))
|
|
4955
|
+
) {
|
|
4942
4956
|
logger.info("Latest bundle already exists and download is NOT required. " + messageUpdate);
|
|
4943
4957
|
final boolean directUpdateAllowedNow = CapacitorUpdaterPlugin.this.isDirectUpdateCurrentlyAllowed(
|
|
4944
4958
|
plannedDirectUpdate
|