@capgo/capacitor-updater 8.54.2 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CapgoCapacitorUpdater.podspec +2 -2
  2. package/Package.swift +3 -4
  3. package/README.md +162 -417
  4. package/android/build.gradle +7 -7
  5. package/android/consumer-rules.pro +48 -0
  6. package/android/proguard-rules.pro +1 -23
  7. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1420 -404
  8. package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +1100 -308
  9. package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +102 -65
  10. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +155 -18
  11. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +22 -2
  12. package/android/src/main/java/ee/forgr/capacitor_updater/HeadlessUpdateWorker.java +82 -21
  13. package/android/src/main/java/ee/forgr/capacitor_updater/Http3.java +356 -0
  14. package/android/src/main/java/ee/forgr/capacitor_updater/HttpEngineTransport.java +553 -0
  15. package/dist/docs.json +44 -566
  16. package/dist/esm/definitions.d.ts +97 -215
  17. package/dist/esm/definitions.js.map +1 -1
  18. package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +197 -84
  19. package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +402 -139
  20. package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +81 -55
  21. package/ios/Sources/CapacitorUpdaterPlugin/RedirectPolicyDelegate.swift +24 -0
  22. package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +2 -1
  23. package/ios/Sources/CapacitorUpdaterPlugin/WKWebView+CapgoObjcBridge.swift +20 -0
  24. package/ios/Tests/CapacitorUpdaterPluginTests/BuiltinHashesTests.swift +210 -0
  25. package/ios/Tests/CapacitorUpdaterPluginTests/BundleHardeningTests.swift +292 -0
  26. package/ios/Tests/CapacitorUpdaterPluginTests/CapacitorUpdaterPluginTests.swift +3905 -0
  27. package/ios/Tests/CapacitorUpdaterPluginTests/CapgoSemanticVersionTests.swift +64 -0
  28. package/ios/Tests/CapacitorUpdaterPluginTests/ChecksumRequiredTests.swift +151 -0
  29. package/ios/Tests/CapacitorUpdaterPluginTests/CliCryptoFixtureTests.swift +249 -0
  30. package/ios/Tests/CapacitorUpdaterPluginTests/HttpsOnlyBuiltinMinimumTests.swift +528 -0
  31. package/ios/Tests/CapacitorUpdaterPluginTests/InstallPerfTests.swift +174 -0
  32. package/ios/Tests/CapacitorUpdaterPluginTests/ListChannelsTests.swift +74 -0
  33. package/ios/Tests/CapacitorUpdaterPluginTests/LoggerSecurityTests.swift +149 -0
  34. package/ios/Tests/CapacitorUpdaterPluginTests/NativeContractTests.swift +160 -0
  35. package/ios/Tests/CapacitorUpdaterPluginTests/NetworkTransportTests.swift +1095 -0
  36. package/ios/Tests/CapacitorUpdaterPluginTests/PopulateDeltaCacheTests.swift +573 -0
  37. package/ios/Tests/CapacitorUpdaterPluginTests/RedirectPolicyTests.swift +63 -0
  38. package/ios/Tests/CapacitorUpdaterPluginTests/RsaContractTests.swift +281 -0
  39. package/ios/Tests/CapacitorUpdaterPluginTests/SessionKeyRequiredTests.swift +192 -0
  40. package/ios/Tests/CapacitorUpdaterPluginTests/TestZipWriter.swift +235 -0
  41. package/ios/Tests/CapacitorUpdaterPluginTests/UpdateLifecycleTests.swift +454 -0
  42. package/ios/Tests/CapacitorUpdaterPluginTests/WebKitOverlayGuardTests.swift +32 -0
  43. package/ios/Tests/CapacitorUpdaterPluginTests/ZipArchiveReaderTests.swift +302 -0
  44. package/ios/Tests/CapacitorUpdaterPluginTests/ZipBundleExtractionTests.swift +122 -0
  45. package/package.json +15 -13
package/README.md CHANGED
@@ -7,7 +7,7 @@ This plugin is the live update layer of [Capgo](https://capgo.app/), the AI-read
7
7
  <a href="https://capgo.app/?ref=plugin_updater_v7"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-updater" alt="Capgo - Instant updates for Capacitor" /></a>
8
8
 
9
9
  <div align="center">
10
- <p><b>Capgo</b>: open-source live updates for Ionic and Capacitor apps. Ship OTA fixes and features instantly, without waiting for app store review.</p>
10
+ <p><b>Capgo</b>: the AI-ready platform to build, ship, and maintain Capacitor apps. Ship live updates to your users instantly, without waiting for app store review.</p>
11
11
  <h2><a href="https://capgo.app/register/?ref=plugin_updater_v7">➡️ Get started for free</a></h2>
12
12
  <p>14-day unlimited free trial. No credit card required</p>
13
13
  <p><a href="https://capgo.app/consulting/?ref=plugin_updater_v7">Missing a feature? We'll build the plugin for you 💪</a></p>
@@ -17,6 +17,18 @@ This plugin is the live update layer of [Capgo](https://capgo.app/), the AI-read
17
17
  <img src="https://raw.githubusercontent.com/Cap-go/capacitor-updater/main/assets/github-social-preview.png" alt="@capgo/capacitor-updater for Capacitor apps" width="300" />
18
18
  </p>
19
19
 
20
+ ## Built and maintained with AI
21
+
22
+ We build, improve and fix our plugins with heavy use of AI, so issues usually get fixed in under a day and pull requests get feedback the same day. A human still reviews, tests and merges 50+ pull requests daily.
23
+
24
+ - Most plugin issues get a fix pull request the same day, often within a couple of hours, and are usually resolved in one to two days.
25
+ - Every pull request goes through our AI review system, usually within minutes.
26
+ - Our AI pre-checks tests, code review, conventions and security, then a human reviews, tests and merges.
27
+ - A human, Martin, reviews, tests and merges 50+ pull requests every day.
28
+ - In the last 90 days, 95% of plugin issues were resolved.
29
+
30
+ [Learn more about how we build with AI](https://capgo.app/docs/plugins/ai-engineering/)
31
+
20
32
  ## Use with AI coding agents
21
33
 
22
34
  Capgo provides skills and a hosted MCP server so AI coding agents can set up and operate Capacitor apps, including this plugin.
@@ -37,6 +49,7 @@ Capgo provides skills and a hosted MCP server so AI coding agents can set up and
37
49
  - **Bundle control**: `download()`, `next()`, `set()`, `list()`, `delete()` and `reset()` for manual flows.
38
50
  - **Channels**: `setChannel()`, `getChannel()` and `listChannels()` for environments and per-device QA.
39
51
  - **Delta updates and security**: only changed files are downloaded, checksums are verified, and encryption is optional.
52
+ - **HTTP/3 downloads**: bundles download over HTTP/3 when your CDN supports it (Android 14+ through `HttpEngine`, iOS through URLSession), with automatic fallback to HTTP/2.
40
53
  - **Preview sessions**: `startPreviewSession()`, `setPreview()` and `resetPreview()` to test bundles on a device.
41
54
  - **Platforms**: iOS and Android. Web is a stub for development.
42
55
 
@@ -81,6 +94,7 @@ Perfect for fixing bugs immediately, A/B testing features, and maintaining contr
81
94
  - 🔄 Auto Update: Automatically download and set the latest bundle for the app.
82
95
  - 🛟 Rollback: Reset the app to last working bundle if an incompatible bundle has been set.
83
96
  - 🔁 **Delta Updates**: Make instant updates by only downloading changed files.
97
+ - 🚀 **HTTP/3 Downloads**: Bundles download over HTTP/3 (QUIC) when the CDN supports it, with automatic HTTP/2 fallback.
84
98
  - 🔒 Security: checksum on every update; encryption optional for high-security apps.
85
99
  - ⚔️ **Battle-Tested**: Used in more than 3000 projects.
86
100
  - 📊 View your deployment statistics
@@ -101,6 +115,64 @@ The most complete [documentation here](https://capgo.app/docs/).
101
115
  ## Community
102
116
  Join the [discord](https://discord.gg/VnYRvBfgA6) to get help.
103
117
 
118
+ ## Migration to v9
119
+
120
+ This version requires Capacitor 9.0.0 or later within major version 9, including the iOS listener override fix.
121
+ Both CocoaPods and Swift Package Manager integrations require iOS 16 or later.
122
+
123
+ This major version follows Capacitor major version 9. It removes every API deprecated in v8 and turns on stricter defaults.
124
+
125
+ First follow the migration guide of Capacitor:
126
+
127
+ [https://capacitorjs.com/docs/next/updating/9-0](https://capacitorjs.com/docs/next/updating/9-0)
128
+
129
+ ### Removed APIs
130
+
131
+ - **Per-event listeners**: `addListener('download', ...)`, `addListener('appReady', ...)`, and every other per-event listener were removed. The plugin now emits only `updaterEvent`. Listen to it and switch on `event.type`; `event.data` is the payload the old listener received:
132
+
133
+ ```typescript
134
+ // Before (v8)
135
+ CapacitorUpdater.addListener('download', (info) => console.log(info.percent));
136
+ CapacitorUpdater.addListener('appReady', (info) => console.log(info.status));
137
+
138
+ // After (v9)
139
+ CapacitorUpdater.addListener('updaterEvent', (event) => {
140
+ switch (event.type) {
141
+ case 'download':
142
+ console.log(event.data.percent);
143
+ break;
144
+ case 'appReady':
145
+ console.log(event.data.status);
146
+ break;
147
+ }
148
+ });
149
+ ```
150
+
151
+ Native code no longer sends the per-event names, so a listener registered with an old name never fires.
152
+ - **`majorAvailable` event and `MajorAvailableEvent` type**: use the `breakingAvailable` type of `updaterEvent` and `BreakingAvailableEvent`.
153
+ - **`LatestVersion.major`**: use `LatestVersion.breaking`.
154
+ - **`directUpdate` config**: use the `autoUpdate` string modes. The plugin ignores `directUpdate` and logs an error at startup when it is still set.
155
+
156
+ | v8 config | v9 config |
157
+ | --- | --- |
158
+ | `autoUpdate: true, directUpdate: false` | `autoUpdate: true` (or `"atBackground"`) |
159
+ | `autoUpdate: true, directUpdate: true` | `autoUpdate: "always"` |
160
+ | `autoUpdate: true, directUpdate: "always"` | `autoUpdate: "always"` |
161
+ | `autoUpdate: true, directUpdate: "atInstall"` | `autoUpdate: "atInstall"` |
162
+ | `autoUpdate: true, directUpdate: "onLaunch"` | `autoUpdate: "onLaunch"` |
163
+ - **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
+ - **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.
165
+ - **Android `CapgoUpdater.autoReset()`** without arguments: call `autoReset(currentNativeBuildVersion)`.
166
+
167
+ ### New defaults
168
+
169
+ | Option | v8 default | v9 default | Keep the v8 behavior |
170
+ | --- | --- | --- | --- |
171
+ | `builtinMinimum` | `false` | `true` | `builtinMinimum: false` if you version web bundles independently of the native app |
172
+ | `persistCustomId` | `false` | `true` | `persistCustomId: false` to keep the custom ID for the current session only |
173
+
174
+ `httpsOnly` stays `true` (the default since 8.54.0).
175
+
104
176
  ## Migration to v8
105
177
 
106
178
  This major version is here to follow Capacitor major version 8
@@ -127,6 +199,7 @@ The plugin has no third-party iOS dependencies besides Capacitor: ZIP extraction
127
199
 
128
200
  | Plugin version | Capacitor compatibility | Maintained |
129
201
  | -------------- | ----------------------- | ----------------- |
202
+ | v9.\*.\* | v9.\*.\* | Prerelease |
130
203
  | v8.\*.\* | v8.\*.\* | ✅ |
131
204
  | v7.\*.\* | v7.\*.\* | ✅ |
132
205
  | v6.\*.\* | v6.\*.\* | ✅ |
@@ -135,7 +208,7 @@ The plugin has no third-party iOS dependencies besides Capacitor: ZIP extraction
135
208
  | v3.\*.\* | v3.\*.\* | ⚠️ Deprecated |
136
209
  | > 7 | v4.\*.\* | ⚠️ Deprecated, our CI got crazy and bumped too much version |
137
210
 
138
- > **Note:** Versions 4, 5, 6, 7, and 8 all share the same features. The major version simply follows your Capacitor version. You can safely use any of these versions that matches your Capacitor installation.
211
+ > **Note:** Versions 4, 5, 6, 7, and 8 all share the same features. The major version simply follows your Capacitor version. You can safely use any of these versions that matches your Capacitor installation. Version 9 removes the APIs deprecated in v8 and turns on stricter defaults: see [Migration to v9](#migration-to-v9).
139
212
 
140
213
  ### iOS
141
214
 
@@ -196,9 +269,12 @@ npx cap sync
196
269
  Use npm tags to install the version matching your Capacitor version:
197
270
 
198
271
  ```bash
199
- # For Capacitor 8 (latest)
272
+ # For Capacitor 9 (latest)
200
273
  npm install @capgo/capacitor-updater@latest
201
274
 
275
+ # For Capacitor 8
276
+ npm install @capgo/capacitor-updater@^8
277
+
202
278
  # For Capacitor 7
203
279
  npm install @capgo/capacitor-updater@lts-v7
204
280
 
@@ -391,10 +467,9 @@ CapacitorUpdater can be configured with these options:
391
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. | <code>https://plugin.capgo.app/stats</code> | |
392
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. | <code>undefined</code> | 6.2.0 |
393
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. | <code>undefined</code> | 4.17.48 |
394
- | **`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 |
395
- | **`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 |
470
+ | **`autoSplashscreen`** | <code>boolean</code> | Automatically hide the splashscreen after instant apply updates finish, or when no update is needed. Required when using the instant apply {@link autoUpdate} modes (`"atInstall"`, `"onLaunch"`, `"always"`). `@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 |
396
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. | <code>false</code> | 7.19.0 |
397
- | **`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 |
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. | <code>10000 // (10 seconds)</code> | 7.19.0 |
398
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). | <code>0 (disabled)</code> | |
399
474
  | **`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 |
400
475
  | **`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 |
@@ -406,11 +481,12 @@ CapacitorUpdater can be configured with these options:
406
481
  | **`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 |
407
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. | <code>false</code> | 8.52.0 |
408
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 &lt;url&gt; 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 |
409
- | **`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. Only the numeric `major.minor.patch` part is compared (a `1.2.3-beta.1` bundle is accepted on native `1.2.3`), and versions that do not parse as semver skip the check. Rejections are reported as the `version_below_native` stat. Keep it off if you version web bundles independently of the native app (for example native `2.0.0` with bundle `1.4.7`). Future-major default candidate: `true`. Only available for Android and iOS. | <code>false</code> | 8.54.0 |
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. | <code>true</code> | 8.55.0 |
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. Only the numeric `major.minor.patch` part is compared (a `1.2.3-beta.1` bundle is accepted on native `1.2.3`), and versions that do not parse as semver skip 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`). Only available for Android and iOS. | <code>true (was `false` before 9.0.0)</code> | 8.54.0 |
410
486
  | **`allowModifyAppId`** | <code>boolean</code> | Allow the plugin to modify the appId dynamically from the JavaScript side. | <code>false</code> | 7.14.0 |
411
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`. | <code>false</code> | 7.20.0 |
412
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. | <code>false</code> | 8.47.0 |
413
- | **`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 |
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. | <code>true (was `false` before 9.0.0)</code> | 7.17.3 |
414
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. | <code>false</code> | 7.20.0 |
415
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`. | <code>true</code> | 7.34.0 |
416
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. | <code>true</code> | 8.51.0 |
@@ -422,7 +498,7 @@ CapacitorUpdater can be configured with these options:
422
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. | <code>false</code> | 7.5.0 |
423
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. | <code>'shake'</code> | 8.48.0 |
424
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. | <code>false</code> | 8.43.0 |
425
- | **`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` / `majorAvailable` flows. Only available for Android and iOS. No-op on web. | <code>false</code> | 8.53.0 |
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. | <code>false</code> | 8.53.0 |
426
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. | <code>"Update available"</code> | 8.53.0 |
427
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. | <code>A short message explaining that a newer native app is available in the store.</code> | 8.53.0 |
428
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. | <code>"Update"</code> | 8.53.0 |
@@ -450,7 +526,6 @@ In `capacitor.config.json`:
450
526
  "statsUrl": https://example.com/api/stats,
451
527
  "publicKey": undefined,
452
528
  "version": undefined,
453
- "directUpdate": undefined,
454
529
  "autoSplashscreen": undefined,
455
530
  "autoSplashscreenLoader": undefined,
456
531
  "autoSplashscreenTimeout": undefined,
@@ -465,6 +540,7 @@ In `capacitor.config.json`:
465
540
  "allowModifyUrl": undefined,
466
541
  "allowHttpsToHttpRedirect": undefined,
467
542
  "httpsOnly": undefined,
543
+ "http3": undefined,
468
544
  "builtinMinimum": undefined,
469
545
  "allowModifyAppId": undefined,
470
546
  "allowManualBundleError": undefined,
@@ -515,7 +591,6 @@ const config: CapacitorConfig = {
515
591
  statsUrl: https://example.com/api/stats,
516
592
  publicKey: undefined,
517
593
  version: undefined,
518
- directUpdate: undefined,
519
594
  autoSplashscreen: undefined,
520
595
  autoSplashscreenLoader: undefined,
521
596
  autoSplashscreenTimeout: undefined,
@@ -530,6 +605,7 @@ const config: CapacitorConfig = {
530
605
  allowModifyUrl: undefined,
531
606
  allowHttpsToHttpRedirect: undefined,
532
607
  httpsOnly: undefined,
608
+ http3: undefined,
533
609
  builtinMinimum: undefined,
534
610
  allowModifyAppId: undefined,
535
611
  allowManualBundleError: undefined,
@@ -605,21 +681,6 @@ export default config;
605
681
  * [`isAutoUpdateEnabled()`](#isautoupdateenabled)
606
682
  * [`removeAllListeners()`](#removealllisteners)
607
683
  * [`addListener('updaterEvent', ...)`](#addlistenerupdaterevent-)
608
- * [`addListener('download', ...)`](#addlistenerdownload-)
609
- * [`addListener('noNeedUpdate', ...)`](#addlistenernoneedupdate-)
610
- * [`addListener('updateCheckResult', ...)`](#addlistenerupdatecheckresult-)
611
- * [`addListener('updateAvailable', ...)`](#addlistenerupdateavailable-)
612
- * [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete-)
613
- * [`addListener('breakingAvailable', ...)`](#addlistenerbreakingavailable-)
614
- * [`addListener('majorAvailable', ...)`](#addlistenermajoravailable-)
615
- * [`addListener('updateFailed', ...)`](#addlistenerupdatefailed-)
616
- * [`addListener('set', ...)`](#addlistenerset-)
617
- * [`addListener('setNext', ...)`](#addlistenersetnext-)
618
- * [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed-)
619
- * [`addListener('appReloaded', ...)`](#addlistenerappreloaded-)
620
- * [`addListener('appReady', ...)`](#addlistenerappready-)
621
- * [`addListener('channelPrivate', ...)`](#addlistenerchannelprivate-)
622
- * [`addListener('onFlexibleUpdateStateChange', ...)`](#addlisteneronflexibleupdatestatechange-)
623
684
  * [`isAutoUpdateAvailable()`](#isautoupdateavailable)
624
685
  * [`getNextBundle()`](#getnextbundle)
625
686
  * [`getFailedUpdate()`](#getfailedupdate)
@@ -1157,6 +1218,9 @@ Common use cases:
1157
1218
  - Testing update flows during development
1158
1219
 
1159
1220
  If no update is pending (no call to {@link next}), this simply reloads the current bundle.
1221
+ If `builtinMinimum` rejects a pending bundle below the native version, the promise rejects with
1222
+ code `VERSION_BELOW_NATIVE` and a message naming both versions. The current bundle and pending
1223
+ update remain unchanged, so you can reset to builtin or choose another bundle.
1160
1224
 
1161
1225
  --------------------
1162
1226
 
@@ -1229,9 +1293,9 @@ such as a silent push notification asking the app to check for a Capgo
1229
1293
  bundle without reimplementing the update protocol in JavaScript.
1230
1294
 
1231
1295
  The promise resolves after the native background work has been queued, not
1232
- after the update has been downloaded or installed. Listen to updater events
1233
- such as `updateAvailable`, `downloadComplete`, `downloadFailed`, and
1234
- `noNeedUpdate` for the final result.
1296
+ after the update has been downloaded or installed. Listen to `updaterEvent`
1297
+ and its `updateAvailable`, `downloadComplete`, `downloadFailed`, and
1298
+ `noNeedUpdate` types for the final result.
1235
1299
 
1236
1300
  Native support is available on iOS and Android. On Web, this method returns
1237
1301
  a result with `status: 'unavailable'`. Native platforms also return
@@ -1399,13 +1463,15 @@ Only assignments created from the dashboard or the Public API are shown in the D
1399
1463
  **Important: Listen for the `channelPrivate` event**
1400
1464
 
1401
1465
  When a user attempts to set a channel that doesn't allow device self-assignment, the method will
1402
- throw an error AND fire a {@link addListener}('channelPrivate') event. You should listen to this event
1466
+ throw an error AND emit a `channelPrivate` {@link <a href="#updaterevent">UpdaterEvent</a>}. You should listen to this event
1403
1467
  to provide appropriate feedback to users:
1404
1468
 
1405
1469
  ```typescript
1406
- CapacitorUpdater.addListener('channelPrivate', (data) =&gt; {
1407
- console.warn(`Cannot access channel "${data.channel}": ${data.message}`);
1408
- // Show user-friendly message
1470
+ CapacitorUpdater.addListener('updaterEvent', (event) =&gt; {
1471
+ if (event.type === 'channelPrivate') {
1472
+ console.warn(`Cannot access channel "${event.data.channel}": ${event.data.message}`);
1473
+ // Show user-friendly message
1474
+ }
1409
1475
  });
1410
1476
  ```
1411
1477
 
@@ -1469,8 +1535,9 @@ Use this to:
1469
1535
  - Check if a device is on a specific channel before showing features
1470
1536
  - Verify channel assignment after calling {@link setChannel}
1471
1537
 
1472
- On native platforms, a successful response also refreshes the default channel used by update checks.
1473
- This refresh is persisted across app restarts.
1538
+ On native platforms, a successful response with a device channel override also refreshes the
1539
+ default channel used by update checks. Responses with `status: 'default'` are reported only and
1540
+ are not persisted. This refresh is persisted across app restarts.
1474
1541
 
1475
1542
  **Returns:** <code>Promise&lt;<a href="#getchannelres">GetChannelRes</a>&gt;</code>
1476
1543
 
@@ -1525,11 +1592,11 @@ to your update server and can be used for:
1525
1592
  - A/B testing or feature flagging
1526
1593
 
1527
1594
  **Persistence:**
1528
- - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true`, the ID persists across app restarts
1595
+ - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true` (the default), the ID persists across app restarts
1529
1596
  - When `false`, the ID is only kept for the current session
1530
1597
 
1531
1598
  **Clearing the custom ID:**
1532
- - Pass an empty string `""` to remove any stored custom ID
1599
+ - Pass an empty string `""` to remove any stored custom ID, even when persistence is disabled
1533
1600
 
1534
1601
  | Param | Type | Description |
1535
1602
  | ------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
@@ -1659,18 +1726,8 @@ removeAllListeners() => Promise<void>
1659
1726
 
1660
1727
  Remove all event listeners registered for this plugin.
1661
1728
 
1662
- This unregisters all listeners added via {@link addListener} for all event types:
1663
- - `updaterEvent`
1664
- - `download`
1665
- - `noNeedUpdate`
1666
- - `updateCheckResult`
1667
- - `updateAvailable`
1668
- - `downloadComplete`
1669
- - `downloadFailed`
1670
- - `breakingAvailable` / `majorAvailable`
1671
- - `updateFailed`
1672
- - `appReloaded`
1673
- - `appReady`
1729
+ This unregisters every listener added via {@link addListener}, including all
1730
+ `updaterEvent` listeners.
1674
1731
 
1675
1732
  Use this during cleanup (e.g., when unmounting components or closing screens)
1676
1733
  to prevent memory leaks from lingering event listeners.
@@ -1688,12 +1745,15 @@ addListener(eventName: 'updaterEvent', listenerFunc: (event: UpdaterEvent) => vo
1688
1745
 
1689
1746
  Listen for every updater event with a single listener.
1690
1747
 
1691
- Each call receives `{ type, data }`: `type` is the event name (`download`, `updateAvailable`,
1692
- `downloadFailed`, `appReady`, ...) and `data` is the payload the matching legacy listener receives.
1693
- When the native layer retains an event until a listener attaches (for example `set` and `appReady`),
1694
- `updaterEvent` gets the same retention.
1748
+ Each call receives `{ type, data }`: `type` is the event name and `data` is its payload
1749
+ (see {@link <a href="#updaterevent">UpdaterEvent</a>} for every type and its payload).
1695
1750
 
1696
- The per-event listeners below are deprecated and will be removed in v9.
1751
+ Since 9.0.0 this is the only listener the plugin emits. The per-event listeners
1752
+ (`addListener('download', ...)`, `addListener('appReady', ...)`, ...) and the `majorAvailable`
1753
+ alias were removed: switch on `event.type` instead.
1754
+
1755
+ `set` and `appReady` are retained natively until a listener attaches, so they are still
1756
+ delivered after a reload even when the listener is registered later in app startup.
1697
1757
 
1698
1758
  ```typescript
1699
1759
  CapacitorUpdater.addListener('updaterEvent', (event) =&gt; {
@@ -1704,6 +1764,9 @@ CapacitorUpdater.addListener('updaterEvent', (event) =&gt; {
1704
1764
  case 'downloadFailed':
1705
1765
  console.warn('download failed', event.data.version);
1706
1766
  break;
1767
+ case 'channelPrivate':
1768
+ console.warn(`Cannot access channel "${event.data.channel}": ${event.data.message}`);
1769
+ break;
1707
1770
  }
1708
1771
  });
1709
1772
  ```
@@ -1720,340 +1783,6 @@ CapacitorUpdater.addListener('updaterEvent', (event) =&gt; {
1720
1783
  --------------------
1721
1784
 
1722
1785
 
1723
- #### addListener('download', ...)
1724
-
1725
- ```typescript
1726
- addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void) => Promise<PluginListenerHandle>
1727
- ```
1728
-
1729
- Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.
1730
- This will return you all download percent during the download
1731
-
1732
- | Param | Type |
1733
- | ------------------ | --------------------------------------------------------------------------- |
1734
- | **`eventName`** | <code>'download'</code> |
1735
- | **`listenerFunc`** | <code>(state: <a href="#downloadevent">DownloadEvent</a>) =&gt; void</code> |
1736
-
1737
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1738
-
1739
- **Since:** 2.0.11
1740
-
1741
- --------------------
1742
-
1743
-
1744
- #### addListener('noNeedUpdate', ...)
1745
-
1746
- ```typescript
1747
- addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void) => Promise<PluginListenerHandle>
1748
- ```
1749
-
1750
- Listen for no need to update event, useful when you want force check every time the app is launched
1751
-
1752
- | Param | Type |
1753
- | ------------------ | ----------------------------------------------------------------------- |
1754
- | **`eventName`** | <code>'noNeedUpdate'</code> |
1755
- | **`listenerFunc`** | <code>(state: <a href="#noneedevent">NoNeedEvent</a>) =&gt; void</code> |
1756
-
1757
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1758
-
1759
- **Since:** 4.0.0
1760
-
1761
- --------------------
1762
-
1763
-
1764
- #### addListener('updateCheckResult', ...)
1765
-
1766
- ```typescript
1767
- addListener(eventName: 'updateCheckResult', listenerFunc: (state: UpdateCheckResultEvent) => void) => Promise<PluginListenerHandle>
1768
- ```
1769
-
1770
- Listen for update check results before the updater decides whether to download.
1771
- The backend can classify the <a href="#updatecheckresultevent">UpdateCheckResultEvent</a> payload as `up_to_date`, `blocked`, or `failed`.
1772
-
1773
- This event is emitted alongside legacy events. For `up_to_date` and `blocked`, it is emitted before
1774
- `noNeedUpdate` and does not emit `downloadFailed`. For `failed`, it is emitted before the legacy
1775
- `downloadFailed` event; native code also sends an `update_check_error` stat (with error metadata)
1776
- instead of `download_fail`, because no bundle download was attempted.
1777
-
1778
- | Param | Type |
1779
- | ------------------ | --------------------------------------------------------------------------------------------- |
1780
- | **`eventName`** | <code>'updateCheckResult'</code> |
1781
- | **`listenerFunc`** | <code>(state: <a href="#updatecheckresultevent">UpdateCheckResultEvent</a>) =&gt; void</code> |
1782
-
1783
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1784
-
1785
- **Since:** 8.45.11
1786
-
1787
- --------------------
1788
-
1789
-
1790
- #### addListener('updateAvailable', ...)
1791
-
1792
- ```typescript
1793
- addListener(eventName: 'updateAvailable', listenerFunc: (state: UpdateAvailableEvent) => void) => Promise<PluginListenerHandle>
1794
- ```
1795
-
1796
- Listen for available update event, useful when you want to force check every time the app is launched
1797
-
1798
- | Param | Type |
1799
- | ------------------ | ----------------------------------------------------------------------------------------- |
1800
- | **`eventName`** | <code>'updateAvailable'</code> |
1801
- | **`listenerFunc`** | <code>(state: <a href="#updateavailableevent">UpdateAvailableEvent</a>) =&gt; void</code> |
1802
-
1803
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1804
-
1805
- **Since:** 4.0.0
1806
-
1807
- --------------------
1808
-
1809
-
1810
- #### addListener('downloadComplete', ...)
1811
-
1812
- ```typescript
1813
- addListener(eventName: 'downloadComplete', listenerFunc: (state: DownloadCompleteEvent) => void) => Promise<PluginListenerHandle>
1814
- ```
1815
-
1816
- Listen for downloadComplete events.
1817
-
1818
- | Param | Type |
1819
- | ------------------ | ------------------------------------------------------------------------------------------- |
1820
- | **`eventName`** | <code>'downloadComplete'</code> |
1821
- | **`listenerFunc`** | <code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>) =&gt; void</code> |
1822
-
1823
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1824
-
1825
- **Since:** 4.0.0
1826
-
1827
- --------------------
1828
-
1829
-
1830
- #### addListener('breakingAvailable', ...)
1831
-
1832
- ```typescript
1833
- addListener(eventName: 'breakingAvailable', listenerFunc: (state: BreakingAvailableEvent) => void) => Promise<PluginListenerHandle>
1834
- ```
1835
-
1836
- Listen for breaking update events when the backend flags an update as incompatible with the current app.
1837
- Emits the same payload as the legacy `majorAvailable` listener.
1838
-
1839
- | Param | Type |
1840
- | ------------------ | --------------------------------------------------------------------------------------- |
1841
- | **`eventName`** | <code>'breakingAvailable'</code> |
1842
- | **`listenerFunc`** | <code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>) =&gt; void</code> |
1843
-
1844
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1845
-
1846
- **Since:** 7.22.0
1847
-
1848
- --------------------
1849
-
1850
-
1851
- #### addListener('majorAvailable', ...)
1852
-
1853
- ```typescript
1854
- addListener(eventName: 'majorAvailable', listenerFunc: (state: MajorAvailableEvent) => void) => Promise<PluginListenerHandle>
1855
- ```
1856
-
1857
- Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
1858
-
1859
- | Param | Type |
1860
- | ------------------ | --------------------------------------------------------------------------------------- |
1861
- | **`eventName`** | <code>'majorAvailable'</code> |
1862
- | **`listenerFunc`** | <code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>) =&gt; void</code> |
1863
-
1864
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1865
-
1866
- **Since:** 2.3.0
1867
-
1868
- --------------------
1869
-
1870
-
1871
- #### addListener('updateFailed', ...)
1872
-
1873
- ```typescript
1874
- addListener(eventName: 'updateFailed', listenerFunc: (state: UpdateFailedEvent) => void) => Promise<PluginListenerHandle>
1875
- ```
1876
-
1877
- Listen for update fail event in the App, let you know when update has fail to install at next app start
1878
-
1879
- | Param | Type |
1880
- | ------------------ | ----------------------------------------------------------------------------------- |
1881
- | **`eventName`** | <code>'updateFailed'</code> |
1882
- | **`listenerFunc`** | <code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>) =&gt; void</code> |
1883
-
1884
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1885
-
1886
- **Since:** 2.3.0
1887
-
1888
- --------------------
1889
-
1890
-
1891
- #### addListener('set', ...)
1892
-
1893
- ```typescript
1894
- addListener(eventName: 'set', listenerFunc: (state: SetEvent) => void) => Promise<PluginListenerHandle>
1895
- ```
1896
-
1897
- Listen for set event in the App, let you know when a bundle has been applied successfully.
1898
- This event is retained natively until JavaScript consumes it, so if the app reloads before your
1899
- listener is attached, the last pending `set` event is delivered once the listener subscribes.
1900
-
1901
- | Param | Type |
1902
- | ------------------ | ----------------------------------------------------------------- |
1903
- | **`eventName`** | <code>'set'</code> |
1904
- | **`listenerFunc`** | <code>(state: <a href="#setevent">SetEvent</a>) =&gt; void</code> |
1905
-
1906
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1907
-
1908
- **Since:** 8.43.12
1909
-
1910
- --------------------
1911
-
1912
-
1913
- #### addListener('setNext', ...)
1914
-
1915
- ```typescript
1916
- addListener(eventName: 'setNext', listenerFunc: (state: SetNextEvent) => void) => Promise<PluginListenerHandle>
1917
- ```
1918
-
1919
- Listen for set next event in the App, let you know when a bundle is queued as the next bundle to install.
1920
-
1921
- | Param | Type |
1922
- | ------------------ | ------------------------------------------------------------------------- |
1923
- | **`eventName`** | <code>'setNext'</code> |
1924
- | **`listenerFunc`** | <code>(state: <a href="#setnextevent">SetNextEvent</a>) =&gt; void</code> |
1925
-
1926
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1927
-
1928
- **Since:** 6.14.0
1929
-
1930
- --------------------
1931
-
1932
-
1933
- #### addListener('downloadFailed', ...)
1934
-
1935
- ```typescript
1936
- addListener(eventName: 'downloadFailed', listenerFunc: (state: DownloadFailedEvent) => void) => Promise<PluginListenerHandle>
1937
- ```
1938
-
1939
- Listen for download fail event in the App, let you know when a bundle download has failed
1940
-
1941
- | Param | Type |
1942
- | ------------------ | --------------------------------------------------------------------------------------- |
1943
- | **`eventName`** | <code>'downloadFailed'</code> |
1944
- | **`listenerFunc`** | <code>(state: <a href="#downloadfailedevent">DownloadFailedEvent</a>) =&gt; void</code> |
1945
-
1946
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1947
-
1948
- **Since:** 4.0.0
1949
-
1950
- --------------------
1951
-
1952
-
1953
- #### addListener('appReloaded', ...)
1954
-
1955
- ```typescript
1956
- addListener(eventName: 'appReloaded', listenerFunc: () => void) => Promise<PluginListenerHandle>
1957
- ```
1958
-
1959
- Listen for reload event in the App, let you know when reload has happened
1960
-
1961
- | Param | Type |
1962
- | ------------------ | -------------------------- |
1963
- | **`eventName`** | <code>'appReloaded'</code> |
1964
- | **`listenerFunc`** | <code>() =&gt; void</code> |
1965
-
1966
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1967
-
1968
- **Since:** 4.3.0
1969
-
1970
- --------------------
1971
-
1972
-
1973
- #### addListener('appReady', ...)
1974
-
1975
- ```typescript
1976
- addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void) => Promise<PluginListenerHandle>
1977
- ```
1978
-
1979
- Listen for app ready event in the App, let you know when app is ready to use.
1980
- This event is retained natively until JavaScript consumes it, so it can still be delivered after
1981
- a reload even if the listener is attached later in app startup.
1982
-
1983
- | Param | Type |
1984
- | ------------------ | --------------------------------------------------------------------------- |
1985
- | **`eventName`** | <code>'appReady'</code> |
1986
- | **`listenerFunc`** | <code>(state: <a href="#appreadyevent">AppReadyEvent</a>) =&gt; void</code> |
1987
-
1988
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1989
-
1990
- **Since:** 5.1.0
1991
-
1992
- --------------------
1993
-
1994
-
1995
- #### addListener('channelPrivate', ...)
1996
-
1997
- ```typescript
1998
- addListener(eventName: 'channelPrivate', listenerFunc: (state: ChannelPrivateEvent) => void) => Promise<PluginListenerHandle>
1999
- ```
2000
-
2001
- Listen for channel private event, fired when attempting to set a channel that doesn't allow device self-assignment.
2002
-
2003
- This event is useful for:
2004
- - Informing users they don't have permission to switch to a specific channel
2005
- - Implementing custom error handling for channel restrictions
2006
- - Logging unauthorized channel access attempts
2007
-
2008
- | Param | Type |
2009
- | ------------------ | --------------------------------------------------------------------------------------- |
2010
- | **`eventName`** | <code>'channelPrivate'</code> |
2011
- | **`listenerFunc`** | <code>(state: <a href="#channelprivateevent">ChannelPrivateEvent</a>) =&gt; void</code> |
2012
-
2013
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
2014
-
2015
- **Since:** 7.34.0
2016
-
2017
- --------------------
2018
-
2019
-
2020
- #### addListener('onFlexibleUpdateStateChange', ...)
2021
-
2022
- ```typescript
2023
- addListener(eventName: 'onFlexibleUpdateStateChange', listenerFunc: (state: FlexibleUpdateState) => void) => Promise<PluginListenerHandle>
2024
- ```
2025
-
2026
- Listen for flexible update state changes on Android.
2027
-
2028
- This event fires during the flexible update download process, providing:
2029
- - Download progress (bytes downloaded / total bytes)
2030
- - Installation status changes
2031
-
2032
- **Install status values:**
2033
- - `UNKNOWN` (0): Unknown status
2034
- - `PENDING` (1): Download pending
2035
- - `DOWNLOADING` (2): Download in progress
2036
- - `INSTALLING` (3): Installing the update
2037
- - `INSTALLED` (4): Update installed (app restart needed)
2038
- - `FAILED` (5): Update failed
2039
- - `CANCELED` (6): Update was canceled
2040
- - `DOWNLOADED` (11): Download complete, ready to install
2041
-
2042
- When status is `DOWNLOADED`, you should prompt the user and call
2043
- {@link completeFlexibleUpdate} to finish the installation.
2044
-
2045
- | Param | Type |
2046
- | ------------------ | --------------------------------------------------------------------------------------- |
2047
- | **`eventName`** | <code>'onFlexibleUpdateStateChange'</code> |
2048
- | **`listenerFunc`** | <code>(state: <a href="#flexibleupdatestate">FlexibleUpdateState</a>) =&gt; void</code> |
2049
-
2050
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
2051
-
2052
- **Since:** 8.0.0
2053
-
2054
- --------------------
2055
-
2056
-
2057
1786
  #### isAutoUpdateAvailable()
2058
1787
 
2059
1788
  ```typescript
@@ -2407,7 +2136,7 @@ This triggers Google Play's flexible update flow, which:
2407
2136
  3. Notifies when download is complete
2408
2137
  4. Requires calling {@link completeFlexibleUpdate} to install
2409
2138
 
2410
- Monitor the download progress using the `onFlexibleUpdateStateChange` listener.
2139
+ Monitor the download progress with the `onFlexibleUpdateStateChange` type of `updaterEvent`.
2411
2140
 
2412
2141
  **Requirements:**
2413
2142
  - Android only (throws error on iOS)
@@ -2416,7 +2145,7 @@ Monitor the download progress using the `onFlexibleUpdateStateChange` listener.
2416
2145
 
2417
2146
  **Typical flow:**
2418
2147
  1. Call `startFlexibleUpdate()` to begin download
2419
- 2. Listen to `onFlexibleUpdateStateChange` for progress
2148
+ 2. Listen to `updaterEvent` and handle `onFlexibleUpdateStateChange` for progress
2420
2149
  3. When status is `DOWNLOADED`, prompt user to restart
2421
2150
  4. Call `completeFlexibleUpdate()` to install and restart
2422
2151
 
@@ -2496,13 +2225,13 @@ and restart the app.
2496
2225
  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.
2497
2226
  If you don't use backend, you need to provide the URL and version of the bundle. Checksum and sessionKey are required if you encrypted the bundle with the CLI command encrypt, you should receive them as result of the command.
2498
2227
 
2499
- | Prop | Type | Description | Default | Since |
2500
- | ---------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- |
2501
- | **`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.) | | |
2502
- | **`version`** | <code>string</code> | The version code/name of this bundle/version | | |
2503
- | **`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 |
2504
- | **`checksum`** | <code>string</code> | The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted | <code>undefined</code> | 4.0.0 |
2505
- | **`manifest`** | <code>ManifestEntry[]</code> | The manifest for multi-file downloads | <code>undefined</code> | 6.1.0 |
2228
+ | Prop | Type | Description | Default | Since |
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 | <code>undefined</code> | 4.0.0 |
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 (the format `npx @capgo/cli@latest bundle encrypt` produces for updater 9). The plugin checks the downloaded bytes against it before decrypting them. | <code>undefined</code> | 4.0.0 |
2234
+ | **`manifest`** | <code>ManifestEntry[]</code> | The manifest for multi-file downloads | <code>undefined</code> | 6.1.0 |
2506
2235
 
2507
2236
 
2508
2237
  ##### ManifestEntry
@@ -2639,7 +2368,6 @@ Result returned after requesting an immediate native auto-update check.
2639
2368
  | **`version`** | <code>string</code> | Result of getLatest method | 4.0.0 |
2640
2369
  | **`checksum`** | <code>string</code> | | 6 |
2641
2370
  | **`breaking`** | <code>boolean</code> | Indicates whether the update was flagged as breaking by the backend. | 7.22.0 |
2642
- | **`major`** | <code>boolean</code> | | |
2643
2371
  | **`message`** | <code>string</code> | Optional message from the server. When no new version is available, this will be "No new version available". | |
2644
2372
  | **`sessionKey`** | <code>string</code> | | |
2645
2373
  | **`error`** | <code>string</code> | Error code from the server, if any. Use `kind` for classification instead of parsing this value. | |
@@ -2853,11 +2581,13 @@ Result returned after requesting an immediate native auto-update check.
2853
2581
  | **`version`** | <code>string</code> | Emit when a download fail. | 4.0.0 |
2854
2582
 
2855
2583
 
2856
- ##### MajorAvailableEvent
2584
+ ##### BreakingAvailableEvent
2585
+
2586
+ Payload of the `breakingAvailable` {@link <a href="#updaterevent">UpdaterEvent</a>}.
2857
2587
 
2858
- | Prop | Type | Description | Since |
2859
- | ------------- | ------------------- | ----------------------------------------- | ----- |
2860
- | **`version`** | <code>string</code> | Emit when a breaking update is available. | 4.0.0 |
2588
+ | Prop | Type | Description | Since |
2589
+ | ------------- | ------------------- | ---------------------------------------------------------------------------- | ------ |
2590
+ | **`version`** | <code>string</code> | Version of the breaking update that the backend blocked for this native app. | 7.22.0 |
2861
2591
 
2862
2592
 
2863
2593
  ##### UpdateFailedEvent
@@ -3046,21 +2776,32 @@ failed by native clients.
3046
2776
  ##### UpdaterEvent
3047
2777
 
3048
2778
  Payload of the single `updaterEvent` listener: every plugin event as `{ type, data }`.
3049
- `type` is the legacy event name and `data` is the same payload the legacy listener receives,
3050
- so you can switch on `type` and get a typed `data`.
3051
-
3052
- The deprecated `majorAvailable` alias is not forwarded: use `breakingAvailable`.
2779
+ Switch on `type` to get a typed `data`.
2780
+
2781
+ - `download`: download progress of a bundle, from start to finish (`percent` between 0 and 100).
2782
+ - `noNeedUpdate`: the update check found nothing to install.
2783
+ - `updateCheckResult`: classified result of an update check, before the updater decides whether to download.
2784
+ In the background update pipeline, `up_to_date` and `blocked` are emitted before `noNeedUpdate` and no
2785
+ `downloadFailed` follows. A `failed` result is emitted before `downloadFailed`, and native code sends an
2786
+ `update_check_error` stat instead of `download_fail` because no bundle download was attempted.
2787
+ Periodic checks (`periodCheckDelay`) may emit only `updateCheckResult`, without those follow-up events or stats.
2788
+ - `updateAvailable`: a new bundle is downloaded and ready.
2789
+ - `downloadComplete`: a bundle download finished.
2790
+ - `downloadFailed`: a bundle download or update check failed.
2791
+ - `breakingAvailable`: the backend blocked an update as incompatible with the current native app.
2792
+ - `updateFailed`: a bundle failed to install at the next app start and was rolled back.
2793
+ - `set`: a bundle was applied. Retained natively until a listener consumes it.
2794
+ - `setNext`: a bundle was queued as the next bundle to install.
2795
+ - `appReloaded`: the app reloaded.
2796
+ - `appReady`: the app is ready to use. Retained natively until a listener consumes it.
2797
+ - `channelPrivate`: `setChannel()` targeted a channel that does not allow device self-assignment.
2798
+ - `onFlexibleUpdateStateChange`: Android flexible in-app update progress and install status.
2799
+ When `installStatus` is `DOWNLOADED`, prompt the user and call
2800
+ {@link CapacitorUpdaterPlugin.completeFlexibleUpdate}.
3053
2801
 
3054
2802
  <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>&lt;string, never&gt; } | { 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>
3055
2803
 
3056
2804
 
3057
- ##### BreakingAvailableEvent
3058
-
3059
- Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with `breakingAvailable`.
3060
-
3061
- <code><a href="#majoravailableevent">MajorAvailableEvent</a></code>
3062
-
3063
-
3064
2805
  ##### Record
3065
2806
 
3066
2807
  Construct a type with a set of properties K of type T
@@ -3119,11 +2860,15 @@ Supported values are `shake` and `threeFingerPinch`.
3119
2860
 
3120
2861
  ### Listen to download events
3121
2862
 
3122
- ```javascript
3123
- import { CapacitorUpdater } from '@capgo/capacitor-updater';
2863
+ Every plugin event arrives through the single `updaterEvent` listener as `{ type, data }`:
3124
2864
 
3125
- CapacitorUpdater.addListener('download', (info: any) => {
3126
- console.log('download was fired', info.percent);
2865
+ ```typescript
2866
+ import { CapacitorUpdater } from '@capgo/capacitor-updater';
2867
+
2868
+ CapacitorUpdater.addListener('updaterEvent', (event) => {
2869
+ if (event.type === 'download') {
2870
+ console.log('download was fired', event.data.percent);
2871
+ }
3127
2872
  });
3128
2873
  ```
3129
2874