@capgo/capacitor-updater 9.0.1 → 9.0.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.
- package/README.md +106 -81
- package/android/build.gradle +1 -3
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +513 -21
- package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +675 -34
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +82 -10
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +23 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/HeadlessUpdateWorker.java +188 -4
- package/android/src/main/java/ee/forgr/capacitor_updater/Http3.java +81 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/HttpEngineTransport.java +72 -21
- package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +5 -1
- package/dist/docs.json +13 -13
- package/dist/esm/definitions.d.ts +57 -23
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +1278 -107
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoSemanticVersion.swift +38 -0
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +583 -56
- package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +8 -1
- package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +6 -1
- package/ios/Tests/CapacitorUpdaterPluginTests/CapacitorUpdaterPluginTests.swift +2705 -77
- package/ios/Tests/CapacitorUpdaterPluginTests/ChecksumRequiredTests.swift +9 -4
- package/ios/Tests/CapacitorUpdaterPluginTests/CliCryptoFixtureTests.swift +67 -2
- package/ios/Tests/CapacitorUpdaterPluginTests/HttpsOnlyBuiltinMinimumTests.swift +130 -5
- package/ios/Tests/CapacitorUpdaterPluginTests/NetworkTransportTests.swift +22 -8
- package/ios/Tests/CapacitorUpdaterPluginTests/SessionKeyRequiredTests.swift +4 -0
- package/ios/Tests/CapacitorUpdaterPluginTests/UpdateLifecycleTests.swift +19 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ Capgo provides skills and a hosted MCP server so AI coding agents can set up and
|
|
|
45
45
|
## Key features
|
|
46
46
|
|
|
47
47
|
- **Auto update**: downloads and applies the latest bundle from Capgo Cloud or your own update server.
|
|
48
|
+
- **Interrupted downloads**: auto update retries incomplete downloads after app kill or background interruption. Interrupted transfers and bundles that fail checksum or decryption share a budget of 3 retries per version (reset after a successful install), and a `download_fail` stat is sent on the next launch (best effort: like other stats, it is not queued durably). Every retry is verified again.
|
|
48
49
|
- **Safe rollouts**: `notifyAppReady()` confirms a bundle works, otherwise the app rolls back to the last working one.
|
|
49
50
|
- **Bundle control**: `download()`, `next()`, `set()`, `list()`, `delete()` and `reset()` for manual flows.
|
|
50
51
|
- **Channels**: `setChannel()`, `getChannel()` and `listChannels()` for environments and per-device QA.
|
|
@@ -162,6 +163,8 @@ First follow the migration guide of Capacitor:
|
|
|
162
163
|
| `autoUpdate: true, directUpdate: "onLaunch"` | `autoUpdate: "onLaunch"` |
|
|
163
164
|
- **Base64 encrypted checksums**: the native code only accepts the hex checksum format that the Capgo CLI has produced since plugin versions 5.30.0, 6.30.0 and 7.30.0. Re-upload bundles made with an older CLI. The CRC32 checksum labels were removed too: SHA-256 is the only supported checksum.
|
|
164
165
|
- **Encrypted checksums that sign only the decrypted bundle**: for encrypted bundles and encrypted delta files, v9 checks the downloaded encrypted bytes against the signed checksum before it decrypts anything. The checksum must sign the SHA-256 of the bundle (or file) followed by the SHA-256 of the encrypted bytes. The Capgo CLI produces this format when it detects `@capgo/capacitor-updater` 9 in the project: upload encrypted bundles with `npx @capgo/cli@latest`, and re-upload encrypted bundles made with an older CLI. Unencrypted bundles are not affected.
|
|
166
|
+
|
|
167
|
+
This format only works on v9. A v8 app that receives an encrypted bundle signed this way fails its checksum check, deletes the download, and stays on its current bundle until the native app is upgraded to v9. If v8 apps are still in the field, make sure they never receive these bundles. For example, keep them on a channel that only serves bundles uploaded for v8.
|
|
165
168
|
- **Android `CapgoUpdater.autoReset()`** without arguments: call `autoReset(currentNativeBuildVersion)`.
|
|
166
169
|
|
|
167
170
|
### New defaults
|
|
@@ -199,7 +202,7 @@ The plugin has no third-party iOS dependencies besides Capacitor: ZIP extraction
|
|
|
199
202
|
|
|
200
203
|
| Plugin version | Capacitor compatibility | Maintained |
|
|
201
204
|
| -------------- | ----------------------- | ----------------- |
|
|
202
|
-
| v9.\*.\* | v9.\*.\* |
|
|
205
|
+
| v9.\*.\* | v9.\*.\* | ✅ |
|
|
203
206
|
| v8.\*.\* | v8.\*.\* | ✅ |
|
|
204
207
|
| v7.\*.\* | v7.\*.\* | ✅ |
|
|
205
208
|
| v6.\*.\* | v6.\*.\* | ✅ |
|
|
@@ -318,7 +321,7 @@ These modes apply the update while the user is waiting. Upload with `--delta` so
|
|
|
318
321
|
npx @capgo/cli@latest bundle upload --delta
|
|
319
322
|
```
|
|
320
323
|
|
|
321
|
-
|
|
324
|
+
We recommend showing a splash screen while an instant update applies. To enable automatic splash handling, install `@capacitor/splash-screen`, set `autoSplashscreen: true`, and set `SplashScreen.launchAutoHide: false`. See [Update Behavior](https://capgo.app/docs/live-updates/update-behavior/).
|
|
322
325
|
|
|
323
326
|
On iOS, use at least `@capgo/capacitor-updater@8.51.22`. The same fix is in the LTS lines from `7.51.21`, `6.51.21`, and `5.51.21`. The Capacitor 4 line (`@lts-v4`) never shipped `autoSplashscreen`, so this rejection does not apply there.
|
|
324
327
|
|
|
@@ -454,58 +457,58 @@ Downgrading to a previous version of the updater plugin is not supported.
|
|
|
454
457
|
|
|
455
458
|
CapacitorUpdater can be configured with these options:
|
|
456
459
|
|
|
457
|
-
| Prop | Type | Description
|
|
458
|
-
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
459
|
-
| **`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.
|
|
460
|
-
| **`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.
|
|
461
|
-
| **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS.
|
|
462
|
-
| **`autoDeletePrevious`** | <code>boolean</code> | Configure whether the plugin should use automatically delete previous bundles after a successful update. Only available for Android and iOS.
|
|
463
|
-
| **`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.
|
|
464
|
-
| **`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.
|
|
465
|
-
| **`updateUrl`** | <code>string</code> | Configure the URL / endpoint to which update checks are sent. Only available for Android and iOS.
|
|
466
|
-
| **`channelUrl`** | <code>string</code> | Configure the URL / endpoint for channel operations. Only available for Android and iOS.
|
|
467
|
-
| **`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. Failed background update checks that never start a download (network errors, timeouts, non-2xx responses, unreadable payloads) are reported as `update_check_error` with `metadata.error` and optional `metadata.status_code`, not as `download_fail`. Self-hosted Capgo backends must allow the `update_check_error` stats action.
|
|
468
|
-
| **`publicKey`** | <code>string</code> | Configure the public key for end to end live update encryption Version 2. What it guarantees: a bundle can only be installed when its checksum and session key were produced with the matching private key. Capgo never holds that key, so Capgo cannot create, modify or decrypt an update for your app. It does NOT make the bundle unreadable to someone who has your app binary: the public key ships inside the app, and anyone holding the app can recover the session key and read the bundle. If you also need Capgo to be unable to find your app (and so its public key), use a Capgo app id that is not your store bundle id (`appId` in this plugin config) so the app is not identifiable from the dashboard. Only available for Android and iOS.
|
|
469
|
-
| **`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.
|
|
470
|
-
| **`autoSplashscreen`** | <code>boolean</code> |
|
|
471
|
-
| **`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.
|
|
472
|
-
| **`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. If installation has not started when the timeout fires, the downloaded bundle is installed on the next background/launch. If installation has already started, the splashscreen still hides at the deadline while the reload and app-ready checks finish. This can briefly expose the previous page while the new bundle loads. Requires {@link autoSplashscreen} to be enabled. Only available for Android and iOS.
|
|
473
|
-
| **`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).
|
|
474
|
-
| **`localS3`** | <code>boolean</code> | Configure the CLI to use a local server for testing or self-hosted update server.
|
|
475
|
-
| **`localHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server.
|
|
476
|
-
| **`localWebHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server.
|
|
477
|
-
| **`localSupa`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server.
|
|
478
|
-
| **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing.
|
|
479
|
-
| **`localApi`** | <code>string</code> | Configure the CLI to use a local api for testing.
|
|
480
|
-
| **`localApiFiles`** | <code>string</code> | Configure the CLI to use a local file api for testing.
|
|
481
|
-
| **`allowModifyUrl`** | <code>boolean</code> | Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side.
|
|
482
|
-
| **`allowHttpsToHttpRedirect`** | <code>boolean</code> | Allow the plugin to follow redirects from HTTPS to plain HTTP for its own network requests (update checks, stats, channel calls, and bundle/manifest downloads). Blocked by default so a redirect can never downgrade updater traffic to an unencrypted connection. Only enable this if your self-hosted update server or CDN must redirect to an HTTP URL. `httpsOnly` (default `true`) rejects every non-https URL and redirect hop regardless of this setting, so an HTTP redirect also needs `httpsOnly: false`. Direct HTTP URLs (for example `localApi` during development) are only allowed with `httpsOnly: false` as well. Only available for Android and iOS.
|
|
483
|
-
| **`httpsOnly`** | <code>boolean</code> | Require https for every URL the plugin talks to: `updateUrl`, `statsUrl`, `channelUrl` (from config, persisted values and `setUpdateUrl` / `setStatsUrl` / `setChannelUrl`), bundle zip URLs, every manifest `download_url`, preview payload URLs and every redirect hop. When enabled it overrides `allowHttpsToHttpRedirect`. A non-https URL fails the call or download with `httpsOnly is enabled and <url> is not https`. Set to `false` only for local development servers (for example a plain-http `localApi` on loopback) or a self-hosted plain-http update server you control. Upgrading with a plain-http `updateUrl`, `statsUrl`, `channelUrl` or `allowHttpsToHttpRedirect: true` requires setting this to `false` explicitly. Only available for Android and iOS.
|
|
484
|
-
| **`http3`** | <code>boolean</code> | Let bundle and manifest downloads use HTTP/3 when the server advertises it. Android 14+ (and Android 12 or 13 with the S extension at level 7) sends https downloads through the platform `HttpEngine`, which keeps the server's HTTP/3 support across app launches and falls back to HTTP/2 (or HTTP/1.1 when the server lacks HTTP/2) on its own when QUIC is blocked. Older Android versions keep the current OkHttp client (HTTP/2 or HTTP/1.1). iOS marks download requests as HTTP/3 capable, and URLSession falls back to HTTP/2 or HTTP/1.1 when QUIC fails or the server does not support HTTP/3. Update checks, stats and channel calls are not affected. Set to `false` to stop preferring HTTP/3. Android then keeps downloads on the previous OkHttp client (HTTP/2 or HTTP/1.1). iOS no longer marks downloads as HTTP/3 capable, but URLSession can still pick HTTP/3 on its own if it already learned the server supports it, so `false` is not a hard HTTP/2 guarantee there. Only available for Android and iOS.
|
|
485
|
-
| **`builtinMinimum`** | <code>boolean</code> | Refuse to download or install a bundle whose version is lower than the native app version (`version` config override, else `CFBundleShortVersionString` / `versionName`). This is the on-device counterpart of the Capgo channel setting "disable auto update under native" and protects against a replayed old update response rolling the app back below its store version.
|
|
486
|
-
| **`allowModifyAppId`** | <code>boolean</code> | Allow the plugin to modify the appId dynamically from the JavaScript side.
|
|
487
|
-
| **`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`.
|
|
488
|
-
| **`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.
|
|
489
|
-
| **`persistCustomId`** | <code>boolean</code> | Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts. Set it to `false` to keep the customId in memory only, so it resets on every app launch. Calling `setCustomId({ customId: '' })` clears the saved value even when persistence is disabled. Only available for Android and iOS.
|
|
490
|
-
| **`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.
|
|
491
|
-
| **`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`.
|
|
492
|
-
| **`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.
|
|
493
|
-
| **`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
|
|
494
|
-
| **`appId`** | <code>string</code> | Configure the app id for the app in the config.
|
|
495
|
-
| **`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.
|
|
496
|
-
| **`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
|
|
497
|
-
| **`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).
|
|
498
|
-
| **`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.
|
|
499
|
-
| **`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.
|
|
500
|
-
| **`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.
|
|
501
|
-
| **`nativeUpdatePrompt`** | <code>boolean</code> | When enabled, show a native dialog prompting the user to install a newer native app from the App Store or Play Store. The prompt appears when a live update is blocked because the device native app is too old, including backend `disable_auto_update_*` responses, `store_update_required`, and `breakingAvailable` flows. Only available for Android and iOS. No-op on web.
|
|
502
|
-
| **`nativeUpdatePromptTitle`** | <code>string</code> | Optional title for the native store update dialog shown when {@link PluginsConfig.CapacitorUpdater.nativeUpdatePrompt} is enabled. Only available for Android and iOS.
|
|
503
|
-
| **`nativeUpdatePromptMessage`** | <code>string</code> | Optional message body for the native store update dialog shown when {@link PluginsConfig.CapacitorUpdater.nativeUpdatePrompt} is enabled. Only available for Android and iOS.
|
|
504
|
-
| **`nativeUpdatePromptUpdateButton`** | <code>string</code> | Optional label for the primary action button that opens the store or starts an in-app update on Android. Only available for Android and iOS.
|
|
505
|
-
| **`nativeUpdatePromptLaterButton`** | <code>string</code> | Optional label for the dismiss action on the native store update dialog. Only available for Android and iOS.
|
|
506
|
-
| **`nativeUpdatePromptCountry`** | <code>string</code> | Optional ISO 3166-1 alpha-2 country filter. When set, the prompt is shown only when the device region matches one of the comma-separated country codes (for example `"US"` or `"US,CA"`). Only available for Android and iOS.
|
|
507
|
-
| **`nativeUpdatePromptOnStoreCheck`** | <code>boolean</code> | When {@link PluginsConfig.CapacitorUpdater.nativeUpdatePrompt} is enabled, also show the dialog when {@link CapacitorUpdaterPlugin.getAppUpdateInfo} reports that a store update is available. Only available for Android and iOS.
|
|
508
|
-
| **`nativeUpdatePromptCooldownHours`** | <code>number</code> | Minimum hours between native update prompts for the same native app version. Also limited to once per app session. Only available for Android and iOS.
|
|
460
|
+
| Prop | Type | Description | Default | Since |
|
|
461
|
+
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------- |
|
|
462
|
+
| **`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> | |
|
|
463
|
+
| **`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> | |
|
|
464
|
+
| **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS. | <code>true</code> | |
|
|
465
|
+
| **`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> | |
|
|
466
|
+
| **`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. They apply without `autoSplashscreen`, but `autoSplashscreen: true` (with `@capacitor/splash-screen` installed and `launchAutoHide: false`) is recommended so the splash screen covers the wait and hides itself afterwards. Only available for Android and iOS. | <code>true</code> | |
|
|
467
|
+
| **`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> | |
|
|
468
|
+
| **`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> | |
|
|
469
|
+
| **`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> | |
|
|
470
|
+
| **`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. Failed background update checks that never start a download (network errors, timeouts, non-2xx responses, unreadable payloads) are reported as `update_check_error` with `metadata.error` and optional `metadata.status_code`, not as `download_fail`. Self-hosted Capgo backends must allow the `update_check_error` stats action. | <code>https://plugin.capgo.app/stats</code> | |
|
|
471
|
+
| **`publicKey`** | <code>string</code> | Configure the public key for end to end live update encryption Version 2. What it guarantees: a bundle can only be installed when its checksum and session key were produced with the matching private key. Capgo never holds that key, so Capgo cannot create, modify or decrypt an update for your app. It does NOT make the bundle unreadable to someone who has your app binary: the public key ships inside the app, and anyone holding the app can recover the session key and read the bundle. If you also need Capgo to be unable to find your app (and so its public key), use a Capgo app id that is not your store bundle id (`appId` in this plugin config) so the app is not identifiable from the dashboard. Only available for Android and iOS. | <code>undefined</code> | 6.2.0 |
|
|
472
|
+
| **`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 |
|
|
473
|
+
| **`autoSplashscreen`** | <code>boolean</code> | Let the plugin handle the splashscreen: keep it up while an instant apply update runs, then hide it when the update finishes, when no update is needed, or after {@link autoSplashscreenTimeout}. It controls splash handling only, not whether an update applies immediately (that is {@link autoUpdate}); it is recommended with the instant apply modes (`"atInstall"`, `"onLaunch"`, `"always"`) so users do not see the app reload. `@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 |
|
|
474
|
+
| **`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 |
|
|
475
|
+
| **`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. If installation has not started when the timeout fires, the downloaded bundle is installed on the next background/launch. If installation has already started, the splashscreen still hides at the deadline while the reload and app-ready checks finish. This can briefly expose the previous page while the new bundle loads. Requires {@link autoSplashscreen} to be enabled. Only available for Android and iOS. | <code>10000 // (10 seconds)</code> | 7.19.0 |
|
|
476
|
+
| **`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> | |
|
|
477
|
+
| **`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 |
|
|
478
|
+
| **`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 |
|
|
479
|
+
| **`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 |
|
|
480
|
+
| **`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 |
|
|
481
|
+
| **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing. | <code>undefined</code> | 4.17.48 |
|
|
482
|
+
| **`localApi`** | <code>string</code> | Configure the CLI to use a local api for testing. | <code>undefined</code> | 6.3.3 |
|
|
483
|
+
| **`localApiFiles`** | <code>string</code> | Configure the CLI to use a local file api for testing. | <code>undefined</code> | 6.3.3 |
|
|
484
|
+
| **`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 |
|
|
485
|
+
| **`allowHttpsToHttpRedirect`** | <code>boolean</code> | Allow the plugin to follow redirects from HTTPS to plain HTTP for its own network requests (update checks, stats, channel calls, and bundle/manifest downloads). Blocked by default so a redirect can never downgrade updater traffic to an unencrypted connection. Only enable this if your self-hosted update server or CDN must redirect to an HTTP URL. `httpsOnly` (default `true`) rejects every non-https URL and redirect hop regardless of this setting, so an HTTP redirect also needs `httpsOnly: false`. Direct HTTP URLs (for example `localApi` during development) are only allowed with `httpsOnly: false` as well. Only available for Android and iOS. | <code>false</code> | 8.52.0 |
|
|
486
|
+
| **`httpsOnly`** | <code>boolean</code> | Require https for every URL the plugin talks to: `updateUrl`, `statsUrl`, `channelUrl` (from config, persisted values and `setUpdateUrl` / `setStatsUrl` / `setChannelUrl`), bundle zip URLs, every manifest `download_url`, preview payload URLs and every redirect hop. When enabled it overrides `allowHttpsToHttpRedirect`. A non-https URL fails the call or download with `httpsOnly is enabled and <url> is not https`. Set to `false` only for local development servers (for example a plain-http `localApi` on loopback) or a self-hosted plain-http update server you control. Upgrading with a plain-http `updateUrl`, `statsUrl`, `channelUrl` or `allowHttpsToHttpRedirect: true` requires setting this to `false` explicitly. Only available for Android and iOS. | <code>true</code> | 8.54.0 |
|
|
487
|
+
| **`http3`** | <code>boolean</code> | Let bundle and manifest downloads use HTTP/3 when the server advertises it. Android 14+ (and Android 12 or 13 with the S extension at level 7) sends https downloads through the platform `HttpEngine`, which keeps the server's HTTP/3 support across app launches and falls back to HTTP/2 (or HTTP/1.1 when the server lacks HTTP/2) on its own when QUIC is blocked. Older Android versions keep the current OkHttp client (HTTP/2 or HTTP/1.1). iOS marks download requests as HTTP/3 capable, and URLSession falls back to HTTP/2 or HTTP/1.1 when QUIC fails or the server does not support HTTP/3. Update checks, stats and channel calls are not affected. Set to `false` to stop preferring HTTP/3. Android then keeps downloads on the previous OkHttp client (HTTP/2 or HTTP/1.1). iOS no longer marks downloads as HTTP/3 capable, but URLSession can still pick HTTP/3 on its own if it already learned the server supports it, so `false` is not a hard HTTP/2 guarantee there. Only available for Android and iOS. | <code>true</code> | 8.55.0 |
|
|
488
|
+
| **`builtinMinimum`** | <code>boolean</code> | Refuse to download or install a bundle whose version is lower than the native app version (`version` config override, else `CFBundleShortVersionString` / `versionName`). This is the on-device counterpart of the Capgo channel setting "disable auto update under native" and protects against a replayed old update response rolling the app back below its store version. This is not strict semver validation: both versions are read as a numeric core, ignoring whitespace and `+build` metadata, cutting the prerelease at the first `-`, and taking the leading digits of the first three dot-separated parts (missing or non-numeric parts count as `0`, extra parts are ignored). So a `1.2.3-beta.1` bundle is accepted on native `1.2.3`, `1.2.preview` is read as `1.2.0`, and native `2.0.0.4` compares as `2.0.0`. Only a version that does not start with a digit (after whitespace is removed) skips the check. Rejections are reported as the `version_below_native` stat. Set it to `false` if you version web bundles independently of the native app (for example native `2.0.0` with bundle `1.4.7`). The default was `false` before 9.0.0. Only available for Android and iOS. | <code>true</code> | 8.54.0 |
|
|
489
|
+
| **`allowModifyAppId`** | <code>boolean</code> | Allow the plugin to modify the appId dynamically from the JavaScript side. | <code>false</code> | 7.14.0 |
|
|
490
|
+
| **`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 |
|
|
491
|
+
| **`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 |
|
|
492
|
+
| **`persistCustomId`** | <code>boolean</code> | Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts. Set it to `false` to keep the customId in memory only, so it resets on every app launch. Calling `setCustomId({ customId: '' })` clears the saved value even when persistence is disabled. The default was `false` before 9.0.0. Only available for Android and iOS. | <code>true</code> | 7.17.3 |
|
|
493
|
+
| **`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 |
|
|
494
|
+
| **`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 |
|
|
495
|
+
| **`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 |
|
|
496
|
+
| **`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 |
|
|
497
|
+
| **`appId`** | <code>string</code> | Configure the app id for the app in the config. | <code>undefined</code> | 6.0.0 |
|
|
498
|
+
| **`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 |
|
|
499
|
+
| **`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 |
|
|
500
|
+
| **`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 |
|
|
501
|
+
| **`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 |
|
|
502
|
+
| **`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 |
|
|
503
|
+
| **`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 |
|
|
504
|
+
| **`nativeUpdatePrompt`** | <code>boolean</code> | When enabled, show a native dialog prompting the user to install a newer native app from the App Store or Play Store. The prompt appears when a live update is blocked because the device native app is too old, including backend `disable_auto_update_*` responses, `store_update_required`, and `breakingAvailable` flows. Only available for Android and iOS. No-op on web. | <code>false</code> | 8.53.0 |
|
|
505
|
+
| **`nativeUpdatePromptTitle`** | <code>string</code> | Optional title for the native store update dialog shown when {@link PluginsConfig.CapacitorUpdater.nativeUpdatePrompt} is enabled. Only available for Android and iOS. | <code>"Update available"</code> | 8.53.0 |
|
|
506
|
+
| **`nativeUpdatePromptMessage`** | <code>string</code> | Optional message body for the native store update dialog shown when {@link PluginsConfig.CapacitorUpdater.nativeUpdatePrompt} is enabled. Only available for Android and iOS. | <code>A short message explaining that a newer native app is available in the store.</code> | 8.53.0 |
|
|
507
|
+
| **`nativeUpdatePromptUpdateButton`** | <code>string</code> | Optional label for the primary action button that opens the store or starts an in-app update on Android. Only available for Android and iOS. | <code>"Update"</code> | 8.53.0 |
|
|
508
|
+
| **`nativeUpdatePromptLaterButton`** | <code>string</code> | Optional label for the dismiss action on the native store update dialog. Only available for Android and iOS. | <code>"Not now"</code> | 8.53.0 |
|
|
509
|
+
| **`nativeUpdatePromptCountry`** | <code>string</code> | Optional ISO 3166-1 alpha-2 country filter. When set, the prompt is shown only when the device region matches one of the comma-separated country codes (for example `"US"` or `"US,CA"`). Only available for Android and iOS. | <code>undefined (show in all regions)</code> | 8.53.0 |
|
|
510
|
+
| **`nativeUpdatePromptOnStoreCheck`** | <code>boolean</code> | When {@link PluginsConfig.CapacitorUpdater.nativeUpdatePrompt} is enabled, also show the dialog when {@link CapacitorUpdaterPlugin.getAppUpdateInfo} reports that a store update is available. Only available for Android and iOS. | <code>false</code> | 8.53.0 |
|
|
511
|
+
| **`nativeUpdatePromptCooldownHours`** | <code>number</code> | Minimum hours between native update prompts for the same native app version. Also limited to once per app session. Only available for Android and iOS. | <code>24</code> | 8.53.0 |
|
|
509
512
|
|
|
510
513
|
### Examples
|
|
511
514
|
|
|
@@ -1293,9 +1296,14 @@ such as a silent push notification asking the app to check for a Capgo
|
|
|
1293
1296
|
bundle without reimplementing the update protocol in JavaScript.
|
|
1294
1297
|
|
|
1295
1298
|
The promise resolves after the native background work has been queued, not
|
|
1296
|
-
after the update has been downloaded or installed. Listen to `updaterEvent
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
+
after the update has been downloaded or installed. Listen to `updaterEvent`:
|
|
1300
|
+
its `updateCheckResult` type reports classified responses (`kind` with the
|
|
1301
|
+
backend error or message), including blocked and up-to-date results, which
|
|
1302
|
+
both emit `noNeedUpdate`. A successful offer of a new bundle is not always
|
|
1303
|
+
classified: it can go straight to `download` and `updateAvailable` events
|
|
1304
|
+
without an `updateCheckResult`, so do not wait for one after every check.
|
|
1305
|
+
Use `updateAvailable`, `downloadComplete`, `downloadFailed`, and
|
|
1306
|
+
`noNeedUpdate` for download and activation progress.
|
|
1299
1307
|
|
|
1300
1308
|
Native support is available on iOS and Android. On Web, this method returns
|
|
1301
1309
|
a result with `status: 'unavailable'`. Native platforms also return
|
|
@@ -1467,7 +1475,7 @@ throw an error AND emit a `channelPrivate` {@link <a href="#updaterevent">Update
|
|
|
1467
1475
|
to provide appropriate feedback to users:
|
|
1468
1476
|
|
|
1469
1477
|
```typescript
|
|
1470
|
-
CapacitorUpdater.addListener('updaterEvent', (event)
|
|
1478
|
+
CapacitorUpdater.addListener('updaterEvent', (event) => {
|
|
1471
1479
|
if (event.type === 'channelPrivate') {
|
|
1472
1480
|
console.warn(`Cannot access channel "${event.data.channel}": ${event.data.message}`);
|
|
1473
1481
|
// Show user-friendly message
|
|
@@ -1752,11 +1760,15 @@ Since 9.0.0 this is the only listener the plugin emits. The per-event listeners
|
|
|
1752
1760
|
(`addListener('download', ...)`, `addListener('appReady', ...)`, ...) and the `majorAvailable`
|
|
1753
1761
|
alias were removed: switch on `event.type` instead.
|
|
1754
1762
|
|
|
1755
|
-
|
|
1756
|
-
|
|
1763
|
+
Some events are retained natively until a listener attaches: `set`, `appReady`, `noNeedUpdate`, and
|
|
1764
|
+
`updateAvailable` from the automatic update when `autoUpdate` is `onlyDownload`. Do not rely on retention for an
|
|
1765
|
+
`updateAvailable` from a manual `download()` (iOS does not retain it): register the listener before calling it.
|
|
1766
|
+
The first `updaterEvent` listener receives every
|
|
1767
|
+
retained event in emission order, so these are still delivered after a reload or a fast update check
|
|
1768
|
+
even when the listener is registered later in app startup.
|
|
1757
1769
|
|
|
1758
1770
|
```typescript
|
|
1759
|
-
CapacitorUpdater.addListener('updaterEvent', (event)
|
|
1771
|
+
CapacitorUpdater.addListener('updaterEvent', (event) => {
|
|
1760
1772
|
switch (event.type) {
|
|
1761
1773
|
case 'download':
|
|
1762
1774
|
console.log('progress', event.data.percent);
|
|
@@ -2144,8 +2156,9 @@ Monitor the download progress with the `onFlexibleUpdateStateChange` type of `up
|
|
|
2144
2156
|
- The update must allow flexible updates (`flexibleUpdateAllowed: true`)
|
|
2145
2157
|
|
|
2146
2158
|
**Typical flow:**
|
|
2147
|
-
1.
|
|
2148
|
-
|
|
2159
|
+
1. Register `addListener('updaterEvent', ...)` and await it, handling `onFlexibleUpdateStateChange`
|
|
2160
|
+
for progress, so no state change is missed
|
|
2161
|
+
2. Call `startFlexibleUpdate()` to begin download
|
|
2149
2162
|
3. When status is `DOWNLOADED`, prompt user to restart
|
|
2150
2163
|
4. Call `completeFlexibleUpdate()` to install and restart
|
|
2151
2164
|
|
|
@@ -2223,15 +2236,17 @@ and restart the app.
|
|
|
2223
2236
|
##### DownloadOptions
|
|
2224
2237
|
|
|
2225
2238
|
This URL and versions are used to download the bundle from the server, If you use backend all information will be given by the method getLatest.
|
|
2226
|
-
If you don't use backend, you need to provide the URL and version of the bundle.
|
|
2239
|
+
If you don't use backend, you need to provide the URL and version of the bundle. Encrypted ZIP downloads require checksum and sessionKey. Encrypted manifest downloads require
|
|
2240
|
+
sessionKey and a signed file_hash for each manifest entry. For updater 9, take them from the Capgo CLI upload flow, which produces the v9 checksum format when it
|
|
2241
|
+
detects updater 9 in the project; see "Migration to v9" in the README. A standalone encrypt command may not produce it.
|
|
2227
2242
|
|
|
2228
|
-
| Prop | Type | Description
|
|
2229
|
-
| ---------------- | ---------------------------- |
|
|
2230
|
-
| **`url`** | <code>string</code> | The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a GitHub tag, any other place you've hosted your bundle.)
|
|
2231
|
-
| **`version`** | <code>string</code> | The version code/name of this bundle/version
|
|
2232
|
-
| **`sessionKey`** | <code>string</code> | The session key for the update, when the bundle is encrypted with a session key
|
|
2233
|
-
| **`checksum`** | <code>string</code> | The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted. Since 9.0.0, the checksum of an encrypted bundle must sign both the SHA-256 of the bundle zip and the SHA-256 of the encrypted bytes
|
|
2234
|
-
| **`manifest`** | <code>ManifestEntry[]</code> | The manifest for multi-file downloads
|
|
2243
|
+
| Prop | Type | Description | Default | Since |
|
|
2244
|
+
| ---------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- |
|
|
2245
|
+
| **`url`** | <code>string</code> | The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a GitHub tag, any other place you've hosted your bundle.) | | |
|
|
2246
|
+
| **`version`** | <code>string</code> | The version code/name of this bundle/version | | |
|
|
2247
|
+
| **`sessionKey`** | <code>string</code> | The session key for the update, when the bundle is encrypted with a session key | <code>undefined</code> | 4.0.0 |
|
|
2248
|
+
| **`checksum`** | <code>string</code> | The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted. Since 9.0.0, the checksum of an encrypted bundle must sign both the SHA-256 of the bundle zip and the SHA-256 of the encrypted bytes. The plugin checks the downloaded bytes against it before decrypting them. The Capgo CLI upload flow produces this format when it detects updater 9 in the project; for self-hosted updates, follow "Migration to v9" in the README instead of relying on a standalone encrypt command. | <code>undefined</code> | 4.0.0 |
|
|
2249
|
+
| **`manifest`** | <code>ManifestEntry[]</code> | The manifest for multi-file downloads | <code>undefined</code> | 6.1.0 |
|
|
2235
2250
|
|
|
2236
2251
|
|
|
2237
2252
|
##### ManifestEntry
|
|
@@ -2585,9 +2600,9 @@ Result returned after requesting an immediate native auto-update check.
|
|
|
2585
2600
|
|
|
2586
2601
|
Payload of the `breakingAvailable` {@link <a href="#updaterevent">UpdaterEvent</a>}.
|
|
2587
2602
|
|
|
2588
|
-
| Prop | Type | Description
|
|
2589
|
-
| ------------- | ------------------- |
|
|
2590
|
-
| **`version`** | <code>string</code> | Version of the breaking update that the backend blocked for this native app. | 7.22.0 |
|
|
2603
|
+
| Prop | Type | Description | Since |
|
|
2604
|
+
| ------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
|
|
2605
|
+
| **`version`** | <code>string</code> | Version of the breaking update that the backend blocked for this native app. This is the target version when the backend sends one. When the backend omits it, the native code can fall back to the current bundle version, so do not show this value as the required upgrade without checking that it differs from the running bundle. | 7.22.0 |
|
|
2591
2606
|
|
|
2592
2607
|
|
|
2593
2608
|
##### UpdateFailedEvent
|
|
@@ -2779,24 +2794,34 @@ Payload of the single `updaterEvent` listener: every plugin event as `{ type, da
|
|
|
2779
2794
|
Switch on `type` to get a typed `data`.
|
|
2780
2795
|
|
|
2781
2796
|
- `download`: download progress of a bundle, from start to finish (`percent` between 0 and 100).
|
|
2782
|
-
- `noNeedUpdate`: the update
|
|
2797
|
+
- `noNeedUpdate`: the update pipeline run completed. It does not mean nothing is pending: a bundle can already be
|
|
2798
|
+
downloaded and waiting (iOS can queue one to apply on background), so use `getNextBundle()` for what is queued
|
|
2799
|
+
and `updateCheckResult.kind` for the backend's classification. `data.bundle` is usually the running
|
|
2800
|
+
bundle, but after a download waiting on install conditions (for example `autoUpdate: 'always'` with delay
|
|
2801
|
+
conditions) it is that downloaded bundle, not the active one; use `current()` for the running bundle.
|
|
2802
|
+
It is not proof that no update existed (it also follows a blocked check and a background install).
|
|
2803
|
+
Retained natively until a listener consumes it.
|
|
2783
2804
|
- `updateCheckResult`: classified result of an update check, before the updater decides whether to download.
|
|
2784
2805
|
In the background update pipeline, `up_to_date` and `blocked` are emitted before `noNeedUpdate` and no
|
|
2785
2806
|
`downloadFailed` follows. A `failed` result is emitted before `downloadFailed`, and native code sends an
|
|
2786
2807
|
`update_check_error` stat instead of `download_fail` because no bundle download was attempted.
|
|
2787
2808
|
Periodic checks (`periodCheckDelay`) may emit only `updateCheckResult`, without those follow-up events or stats.
|
|
2788
|
-
- `updateAvailable`: a new bundle is downloaded and ready.
|
|
2809
|
+
- `updateAvailable`: a new bundle is downloaded and ready. When `autoUpdate` is `onlyDownload`, the one from the
|
|
2810
|
+
automatic update is retained natively until a listener consumes it, because the app must apply that bundle
|
|
2811
|
+
itself. Do not rely on retention for one from a manual `download()` (iOS does not retain it).
|
|
2789
2812
|
- `downloadComplete`: a bundle download finished.
|
|
2790
2813
|
- `downloadFailed`: a bundle download or update check failed.
|
|
2791
2814
|
- `breakingAvailable`: the backend blocked an update as incompatible with the current native app.
|
|
2792
|
-
- `updateFailed`: a bundle failed
|
|
2815
|
+
- `updateFailed`: a bundle failed its readiness check (no `notifyAppReady()` in time) and was rolled back. This happens
|
|
2816
|
+
at the next app start or after an in-session reload (for example `set()`, `next()` applied on background, or an
|
|
2817
|
+
instant apply update).
|
|
2793
2818
|
- `set`: a bundle was applied. Retained natively until a listener consumes it.
|
|
2794
2819
|
- `setNext`: a bundle was queued as the next bundle to install.
|
|
2795
2820
|
- `appReloaded`: the app reloaded.
|
|
2796
2821
|
- `appReady`: the app is ready to use. Retained natively until a listener consumes it.
|
|
2797
2822
|
- `channelPrivate`: `setChannel()` targeted a channel that does not allow device self-assignment.
|
|
2798
2823
|
- `onFlexibleUpdateStateChange`: Android flexible in-app update progress and install status.
|
|
2799
|
-
|
|
2824
|
+
`installStatus` is numeric: when it equals <a href="#flexibleupdateinstallstatus">`FlexibleUpdateInstallStatus.DOWNLOADED`</a> (`11`), prompt the user and call
|
|
2800
2825
|
{@link CapacitorUpdaterPlugin.completeFlexibleUpdate}.
|
|
2801
2826
|
|
|
2802
2827
|
<code>{ type: 'download'; data: <a href="#downloadevent">DownloadEvent</a> } | { type: 'noNeedUpdate'; data: <a href="#noneedevent">NoNeedEvent</a> } | { type: 'updateCheckResult'; data: <a href="#updatecheckresultevent">UpdateCheckResultEvent</a> } | { type: 'updateAvailable'; data: <a href="#updateavailableevent">UpdateAvailableEvent</a> } | { type: 'downloadComplete'; data: <a href="#downloadcompleteevent">DownloadCompleteEvent</a> } | { type: 'downloadFailed'; data: <a href="#downloadfailedevent">DownloadFailedEvent</a> } | { type: 'breakingAvailable'; data: <a href="#breakingavailableevent">BreakingAvailableEvent</a> } | { type: 'updateFailed'; data: <a href="#updatefailedevent">UpdateFailedEvent</a> } | { type: 'set'; data: <a href="#setevent">SetEvent</a> } | { type: 'setNext'; data: <a href="#setnextevent">SetNextEvent</a> } | { type: 'appReloaded'; data: <a href="#record">Record</a><string, never> } | { type: 'appReady'; data: <a href="#appreadyevent">AppReadyEvent</a> } | { type: 'channelPrivate'; data: <a href="#channelprivateevent">ChannelPrivateEvent</a> } | { type: 'onFlexibleUpdateStateChange'; data: <a href="#flexibleupdatestate">FlexibleUpdateState</a> }</code>
|
|
@@ -2806,7 +2831,9 @@ Switch on `type` to get a typed `data`.
|
|
|
2806
2831
|
|
|
2807
2832
|
Construct a type with a set of properties K of type T
|
|
2808
2833
|
|
|
2809
|
-
<code>{
|
|
2810
|
-
[P in K]: T;
|
|
2811
|
-
}</code>
|
|
2834
|
+
<code>{
|
|
2835
|
+
[P in K]: T;
|
|
2836
|
+
}</code>
|
|
2812
2837
|
|
|
2813
2838
|
|
|
2814
2839
|
##### ShakeMenuGesture
|