@capgo/capacitor-updater 8.0.0 → 8.1.0

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 (64) hide show
  1. package/CapgoCapacitorUpdater.podspec +7 -5
  2. package/Package.swift +37 -0
  3. package/README.md +1461 -231
  4. package/android/build.gradle +29 -12
  5. package/android/proguard-rules.pro +45 -0
  6. package/android/src/main/AndroidManifest.xml +0 -1
  7. package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +223 -195
  8. package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +23 -23
  9. package/android/src/main/java/ee/forgr/capacitor_updater/Callback.java +13 -0
  10. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +2159 -1234
  11. package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +1507 -0
  12. package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +330 -121
  13. package/android/src/main/java/ee/forgr/capacitor_updater/DataManager.java +28 -0
  14. package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +43 -49
  15. package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +4 -4
  16. package/android/src/main/java/ee/forgr/capacitor_updater/DelayUpdateUtils.java +260 -0
  17. package/android/src/main/java/ee/forgr/capacitor_updater/DeviceIdHelper.java +221 -0
  18. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +808 -117
  19. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +156 -0
  20. package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +32 -0
  21. package/android/src/main/java/ee/forgr/capacitor_updater/Logger.java +338 -0
  22. package/android/src/main/java/ee/forgr/capacitor_updater/ShakeDetector.java +72 -0
  23. package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +169 -0
  24. package/dist/docs.json +2187 -625
  25. package/dist/esm/definitions.d.ts +1286 -249
  26. package/dist/esm/definitions.js.map +1 -1
  27. package/dist/esm/history.d.ts +1 -0
  28. package/dist/esm/history.js +283 -0
  29. package/dist/esm/history.js.map +1 -0
  30. package/dist/esm/index.d.ts +3 -2
  31. package/dist/esm/index.js +5 -4
  32. package/dist/esm/index.js.map +1 -1
  33. package/dist/esm/web.d.ts +36 -41
  34. package/dist/esm/web.js +94 -35
  35. package/dist/esm/web.js.map +1 -1
  36. package/dist/plugin.cjs.js +376 -35
  37. package/dist/plugin.cjs.js.map +1 -1
  38. package/dist/plugin.js +376 -35
  39. package/dist/plugin.js.map +1 -1
  40. package/ios/Sources/CapacitorUpdaterPlugin/AES.swift +69 -0
  41. package/ios/Sources/CapacitorUpdaterPlugin/BigInt.swift +55 -0
  42. package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/BundleInfo.swift +37 -10
  43. package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/BundleStatus.swift +1 -1
  44. package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +1605 -0
  45. package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +1526 -0
  46. package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +267 -0
  47. package/ios/Sources/CapacitorUpdaterPlugin/DelayUpdateUtils.swift +220 -0
  48. package/ios/Sources/CapacitorUpdaterPlugin/DeviceIdHelper.swift +120 -0
  49. package/ios/Sources/CapacitorUpdaterPlugin/InternalUtils.swift +311 -0
  50. package/ios/Sources/CapacitorUpdaterPlugin/Logger.swift +310 -0
  51. package/ios/Sources/CapacitorUpdaterPlugin/RSA.swift +274 -0
  52. package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +112 -0
  53. package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/UserDefaultsExtension.swift +0 -2
  54. package/package.json +41 -35
  55. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +0 -1130
  56. package/ios/Plugin/CapacitorUpdater.swift +0 -858
  57. package/ios/Plugin/CapacitorUpdaterPlugin.h +0 -10
  58. package/ios/Plugin/CapacitorUpdaterPlugin.m +0 -27
  59. package/ios/Plugin/CapacitorUpdaterPlugin.swift +0 -675
  60. package/ios/Plugin/CryptoCipher.swift +0 -240
  61. /package/{LICENCE → LICENSE} +0 -0
  62. /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/DelayCondition.swift +0 -0
  63. /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/DelayUntilNext.swift +0 -0
  64. /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/Info.plist +0 -0
package/README.md CHANGED
@@ -15,22 +15,120 @@
15
15
  [![Open Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2FCapgo%2Fbounties%3Fstatus%3Dopen)](https://console.algora.io/org/Capgo/bounties?status=open)
16
16
  [![Rewarded Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2FCapgo%2Fbounties%3Fstatus%3Dcompleted)](https://console.algora.io/org/Capgo/bounties?status=completed)
17
17
 
18
- Update Ionic Capacitor apps without App/Play Store review (Code-push / hot-code updates).
18
+ <div align="center">
19
+ <h2><a href="https://capgo.app/?ref=plugin_updater_v7"> ➡️ Get Instant updates for your App with Capgo</a></h2>
20
+ <h2><a href="https://capgo.app/consulting/?ref=plugin_updater_v7"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
21
+ </div>
22
+
23
+ Capacitor plugin to update your app remotely in real-time.
24
+
25
+ Open-source Alternative to Appflow, Codepush or Capawesome
26
+
27
+ ## Why Capacitor Updater?
28
+
29
+ App store review processes can take days or weeks, blocking critical bug fixes and updates from reaching your users. Capacitor Updater solves this by:
30
+
31
+ - **Instant updates** - Push JavaScript/HTML/CSS updates directly to users without app store review
32
+ - **Delta updates** - Only download changed files, making updates ultra-fast
33
+ - **Rollback protection** - Automatically revert broken updates to keep your app stable
34
+ - **Open source** - Self-host or use Capgo Cloud, with full control over your update infrastructure
35
+ - **Battle-tested** - Used by 3000+ production apps with proven reliability
36
+ - **Most stared** - Capacitor updater is the most stared Capacitor plugin on GitHub
37
+
38
+ Perfect for fixing bugs immediately, A/B testing features, and maintaining control over your release schedule.
39
+
40
+ ## Features
41
+
42
+ - ☁️ Cloud / Self hosted Support: Use our [Cloud](https://capgo.app/) to manage your app updates or yours.
43
+ - 📦 Bundle Management: Download, assign to channel, rollback.
44
+ - 📺 Channel Support: Use channels to manage different environments.
45
+ - 🎯 Set Channel to specific device to do QA or debug one user.
46
+ - 🔄 Auto Update: Automatically download and set the latest bundle for the app.
47
+ - 🛟 Rollback: Reset the app to last working bundle if an incompatible bundle has been set.
48
+ - 🔁 **Delta Updates**: Make instant updates by only downloading changed files.
49
+ - 🔒 **Security**: Encrypt and sign each updates with best in class security standards.
50
+ - ⚔️ **Battle-Tested**: Used in more than 3000 projects.
51
+ - 📊 View your deployment statistics
52
+ - 🔋 Supports Android and iOS
53
+ - ⚡️ Capacitor 6/7 support
54
+ - 🌐 **Open Source**: Licensed under the Mozilla Public License 2.0
55
+ - 🌐 **Open Source Backend**: Self install [our backend](https://github.com/Cap-go/capgo) in your infra
56
+
19
57
 
20
58
  You have 3 ways possible :
21
- - Use [capgo.app](https://capgo.app) a full featured auto update system in 5 min Setup, to manage version, update, revert and see stats.
22
- - Use your own server update with auto update system
59
+ - Use [capgo.app](https://capgo.app) a full featured auto-update system in 5 min Setup, to manage version, update, revert and see stats.
60
+ - Use your own server update with auto-update system
23
61
  - Use manual methods to zip, upload, download, from JS to do it when you want.
24
62
 
63
+ ## Documentation
64
+ The most complete [documentation here](https://capgo.app/docs/).
25
65
 
26
66
  ## Community
27
67
  Join the [discord](https://discord.gg/VnYRvBfgA6) to get help.
28
68
 
29
- ## Documentation
30
- I maintain a more user friendly and complete [documentation here](https://docs.capgo.app/).
69
+ ## Migration to v8
70
+
71
+ ## Migration to v7.34
72
+
73
+ - **Channel storage change**: `setChannel()` now stores channel assignments locally on the device instead of in the cloud. This provides better offline support and reduces backend load.
74
+ - Channel assignments persist between app restarts
75
+ - Use `unsetChannel()` to clear the local assignment and revert to `defaultChannel`
76
+ - Old devices (< v7.34.0) will continue using cloud-based storage
77
+ - **New event**: Listen to the `channelPrivate` event to handle cases where a user tries to assign themselves to a private channel (one that doesn't allow self-assignment). See example in the `setChannel()` documentation above.
78
+
79
+ ## Migration to v7
80
+
81
+ The min version of IOS is now 15.5 instead of 15 as Capacitor 8 requirement.
82
+ This is due to bump of ZipArchive to latest, a key dependency of this project is the zlib library. zlib before version 1.2.12 allows memory corruption when deflating (i.e., when compressing) if the input has many distant matches according to [CVE-2018-25032](https://nvd.nist.gov/vuln/detail/cve-2018-25032).
83
+ zlib is a native library so we need to bump the minimum iOS version to 15.5 as ZipArchive did the same in their latest versions.
84
+
85
+ ## Compatibility
86
+
87
+ | Plugin version | Capacitor compatibility | Maintained |
88
+ | -------------- | ----------------------- | ----------------- |
89
+ | v8.\*.\* | v8.\*.\* | Beta |
90
+ | v7.\*.\* | v7.\*.\* | ✅ |
91
+ | v6.\*.\* | v6.\*.\* | ✅ |
92
+ | v5.\*.\* | v5.\*.\* | ⚠️ Deprecated |
93
+ | v4.\*.\* | v4.\*.\* | ⚠️ Deprecated |
94
+ | v3.\*.\* | v3.\*.\* | ⚠️ Deprecated |
95
+ | > 7 | v4.\*.\* | ⚠️ Deprecated, our CI got crazy and bumped too much version |
96
+
97
+ ### iOS
98
+
99
+ #### Privacy manifest
100
+
101
+ Add the `NSPrivacyAccessedAPICategoryUserDefaults` dictionary key to your [Privacy Manifest](https://capacitorjs.com/docs/ios/privacy-manifest) (usually `ios/App/PrivacyInfo.xcprivacy`):
102
+
103
+ ```xml
104
+ <?xml version="1.0" encoding="UTF-8"?>
105
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
106
+ <plist version="1.0">
107
+ <dict>
108
+ <key>NSPrivacyAccessedAPITypes</key>
109
+ <array>
110
+ <!-- Add this dict entry to the array if the file already exists. -->
111
+ <dict>
112
+ <key>NSPrivacyAccessedAPIType</key>
113
+ <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
114
+ <key>NSPrivacyAccessedAPITypeReasons</key>
115
+ <array>
116
+ <string>CA92.1</string>
117
+ </array>
118
+ </dict>
119
+ </array>
120
+ </dict>
121
+ </plist>
122
+ ```
123
+
124
+ We recommend to declare [`CA92.1`](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278401) as the reason for accessing the [`UserDefaults`](https://developer.apple.com/documentation/foundation/userdefaults) API.
31
125
 
32
126
  ## Installation
33
127
 
128
+ Step by step here: [Getting started](https://capgo.app/docs/getting-started/add-an-app/)
129
+
130
+ Or
131
+
34
132
  ```bash
35
133
  npm install @capgo/capacitor-updater
36
134
  npx cap sync
@@ -38,16 +136,16 @@ npx cap sync
38
136
 
39
137
  ## Auto-update setup
40
138
 
41
- Create your account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/app/apikeys)
139
+ Create your account in [capgo.app](https://capgo.app) and get your [API key](https://console.capgo.app/dashboard/apikeys)
42
140
  - Login to CLI `npx @capgo/cli@latest init API_KEY`
43
141
  And follow the steps by step to setup your app.
44
142
 
45
- See more there in the [Auto update documentation](https://docs.capgo.app/plugin/auto-update).
143
+ For detailed instructions on the auto-update setup, refer to the [Auto update documentation](https://capgo.app/docs/plugin/cloud-mode/getting-started/).
46
144
 
47
145
 
48
- ## Manual setup
146
+ ## No Cloud setup
49
147
 
50
- Download update distribution zipfiles from a custom url. Manually control the entire update process.
148
+ Download update distribution zipfiles from a custom URL. Manually control the entire update process.
51
149
 
52
150
  - Edit your `capacitor.config.json` like below, set `autoUpdate` to false.
53
151
  ```json
@@ -67,10 +165,11 @@ Download update distribution zipfiles from a custom url. Manually control the en
67
165
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
68
166
  CapacitorUpdater.notifyAppReady()
69
167
  ```
70
- This informs Capacitor Updator that the current update bundle has loaded succesfully. Failing to call this method will cause your application to be rolled back to the previously successful version (or built-in bundle).
168
+ This informs Capacitor Updater that the current update bundle has loaded successfully. Failing to call this method will cause your application to be rolled back to the previously successful version (or built-in bundle).
71
169
  - Add this to your application.
72
170
  ```javascript
73
171
  const version = await CapacitorUpdater.download({
172
+ version: '0.0.4',
74
173
  url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
75
174
  })
76
175
  await CapacitorUpdater.set(version); // sets the new version, and reloads the app
@@ -88,6 +187,7 @@ You might also consider performing auto-update when application state changes, a
88
187
  if (state.isActive) {
89
188
  // Ensure download occurs while the app is active, or download may fail
90
189
  version = await CapacitorUpdater.download({
190
+ version: '0.0.4',
91
191
  url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
92
192
  })
93
193
  }
@@ -106,47 +206,239 @@ You might also consider performing auto-update when application state changes, a
106
206
 
107
207
  ```
108
208
 
109
- TIP: If you prefer a secure and automated way to update your app, you can use [capgo.app](https://capgo.app) - a full-featured, auto update system.
209
+ TIP: If you prefer a secure and automated way to update your app, you can use [capgo.app](https://capgo.app) - a full-featured, auto-update system.
210
+
211
+ ### Store Guideline Compliance
212
+
213
+ Android Google Play and iOS App Store have corresponding guidelines that have rules you should be aware of before integrating the Capacitor-updater solution within your application.
214
+
215
+ #### Google play
216
+
217
+ Third paragraph of [Device and Network Abuse](https://support.google.com/googleplay/android-developer/answer/9888379?hl=en) topic describe that updating source code by any method besides Google Play's update mechanism is restricted. But this restriction does not apply to updating JavaScript bundles.
218
+ > This restriction does not apply to code that runs in a virtual machine and has limited access to Android APIs (such as JavaScript in a web view or browser).
219
+
220
+ That fully allow Capacitor-updater as it updates just JS bundles and can't update native code part.
221
+
222
+ #### App Store
223
+
224
+ Paragraph **3.3.2**, since back in 2015's [Apple Developer Program License Agreement](https://developer.apple.com/programs/ios/information/) fully allowed performing over-the-air updates of JavaScript and assets.
225
+
226
+ And in its latest version (20170605) [downloadable here](https://developer.apple.com/terms/) this ruling is even broader:
227
+
228
+ > Interpreted code may be downloaded to an Application, but only so long as such code:
229
+ - (a) does not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store
230
+ - (b) does not create a store or storefront for other code or applications
231
+ - (c) does not bypass signing, sandbox, or other security features of the OS.
232
+
233
+ Capacitor-updater allows you to respect these rules in full compliance, so long as the update you push does not significantly deviate your product from its original App Store approved intent.
234
+
235
+ To further remain in compliance with Apple's guidelines, we suggest that App Store-distributed apps don't enable the `Force update` scenario, since in the [App Store Review Guidelines](https://developer.apple.com/app-store/review/guidelines/) it is written that:
236
+
237
+ > Apps must not force users to rate the app, review the app, download other apps, or other similar actions to access functionality, content, or use of the app.
238
+
239
+ This is not a problem for the default behavior of background update, since it won't force the user to apply the new version until the next app close, but at least you should be aware of that ruling if you decide to show it.
110
240
 
111
241
  ### Packaging `dist.zip` update bundles
112
242
 
113
- Capacitor Updator works by unzipping a compiled app bundle to the native device filesystem. Whatever you choose to name the file you upload/download from your release/update server URL (via either manual or automatic updating), this `.zip` bundle must meet the following requirements:
243
+ Capacitor Updater works by unzipping a compiled app bundle to the native device filesystem. Whatever you choose to name the file you upload/download from your release/update server URL (via either manual or automatic updating), this `.zip` bundle must meet the following requirements:
114
244
 
115
245
  - The zip file should contain the full contents of your production Capacitor build output folder, usually `{project directory}/dist/` or `{project directory}/www/`. This is where `index.html` will be located, and it should also contain all bundled JavaScript, CSS, and web resources necessary for your app to run.
116
246
  - Do not password encrypt the bundle zip file, or it will fail to unpack.
117
247
  - Make sure the bundle does not contain any extra hidden files or folders, or it may fail to unpack.
118
248
 
249
+ ## Updater Plugin Config
250
+
251
+ <docgen-config>
252
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
253
+
254
+ CapacitorUpdater can be configured with these options:
255
+
256
+ | Prop | Type | Description | Default | Since |
257
+ | ----------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------- |
258
+ | **`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> | |
259
+ | **`responseTimeout`** | <code>number</code> | Configure the number of seconds the native plugin should wait before considering API timeout. Only available for Android and iOS. | <code>20 // (20 second)</code> | |
260
+ | **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS. | <code>true</code> | |
261
+ | **`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> | |
262
+ | **`autoUpdate`** | <code>boolean</code> | Configure whether the plugin should use Auto Update via an update server. Only available for Android and iOS. | <code>true</code> | |
263
+ | **`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> | |
264
+ | **`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> | |
265
+ | **`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> | |
266
+ | **`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. | <code>https://plugin.capgo.app/stats</code> | |
267
+ | **`publicKey`** | <code>string</code> | Configure the public key for end to end live update encryption Version 2 Only available for Android and iOS. | <code>undefined</code> | 6.2.0 |
268
+ | **`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 |
269
+ | **`directUpdate`** | <code>boolean \| 'always' \| 'atInstall' \| 'onLaunch'</code> | Configure when the plugin should direct install updates. Only for autoUpdate mode. Works well for apps less than 10MB and with uploads done using --partial flag. Zip or apps more than 10MB will be relatively slow for users to update. - false: Never do direct updates (use default behavior: download at start, set when backgrounded) - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false - true: (deprecated) Same as "always" for backward compatibility Only available for Android and iOS. | <code>false</code> | 5.1.0 |
270
+ | **`autoSplashscreen`** | <code>boolean</code> | Automatically handle splashscreen hiding when using directUpdate. When enabled, the plugin will automatically hide the splashscreen after updates are applied or when no update is needed. This removes the need to manually listen for appReady events and call SplashScreen.hide(). Only works when directUpdate is set to "atInstall", "always", "onLaunch", or true. Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false. Requires autoUpdate and directUpdate to be enabled. Only available for Android and iOS. | <code>false</code> | 7.6.0 |
271
+ | **`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 |
272
+ | **`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 |
273
+ | **`periodCheckDelay`** | <code>number</code> | Configure the delay period for period update check. the unit is in seconds. Only available for Android and iOS. Cannot be less than 600 seconds (10 minutes). | <code>0 (disabled)</code> | |
274
+ | **`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 |
275
+ | **`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 |
276
+ | **`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 |
277
+ | **`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 |
278
+ | **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing. | <code>undefined</code> | 4.17.48 |
279
+ | **`localApi`** | <code>string</code> | Configure the CLI to use a local api for testing. | <code>undefined</code> | 6.3.3 |
280
+ | **`localApiFiles`** | <code>string</code> | Configure the CLI to use a local file api for testing. | <code>undefined</code> | 6.3.3 |
281
+ | **`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 |
282
+ | **`allowModifyAppId`** | <code>boolean</code> | Allow the plugin to modify the appId dynamically from the JavaScript side. | <code>false</code> | 7.14.0 |
283
+ | **`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 |
284
+ | **`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 |
285
+ | **`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 |
286
+ | **`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 |
287
+ | **`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 |
288
+ | **`appId`** | <code>string</code> | Configure the app id for the app in the config. | <code>undefined</code> | 6.0.0 |
289
+ | **`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 |
290
+ | **`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 |
291
+ | **`shakeMenu`** | <code>boolean</code> | Enable shake gesture to show update menu for debugging/testing purposes | <code>false</code> | 7.5.0 |
292
+
293
+ ### Examples
294
+
295
+ In `capacitor.config.json`:
296
+
297
+ ```json
298
+ {
299
+ "plugins": {
300
+ "CapacitorUpdater": {
301
+ "appReadyTimeout": 1000 // (1 second),
302
+ "responseTimeout": 10 // (10 second),
303
+ "autoDeleteFailed": false,
304
+ "autoDeletePrevious": false,
305
+ "autoUpdate": false,
306
+ "resetWhenUpdate": false,
307
+ "updateUrl": https://example.com/api/auto_update,
308
+ "channelUrl": https://example.com/api/channel,
309
+ "statsUrl": https://example.com/api/stats,
310
+ "publicKey": undefined,
311
+ "version": undefined,
312
+ "directUpdate": undefined,
313
+ "autoSplashscreen": undefined,
314
+ "autoSplashscreenLoader": undefined,
315
+ "autoSplashscreenTimeout": undefined,
316
+ "periodCheckDelay": 3600 (1 hour),
317
+ "localS3": undefined,
318
+ "localHost": undefined,
319
+ "localWebHost": undefined,
320
+ "localSupa": undefined,
321
+ "localSupaAnon": undefined,
322
+ "localApi": undefined,
323
+ "localApiFiles": undefined,
324
+ "allowModifyUrl": undefined,
325
+ "allowModifyAppId": undefined,
326
+ "allowManualBundleError": undefined,
327
+ "persistCustomId": undefined,
328
+ "persistModifyUrl": undefined,
329
+ "allowSetDefaultChannel": undefined,
330
+ "defaultChannel": undefined,
331
+ "appId": undefined,
332
+ "keepUrlPathAfterReload": undefined,
333
+ "disableJSLogging": undefined,
334
+ "shakeMenu": undefined
335
+ }
336
+ }
337
+ }
338
+ ```
339
+
340
+ In `capacitor.config.ts`:
341
+
342
+ ```ts
343
+ /// <reference types="@capgo/capacitor-updater" />
344
+
345
+ import { CapacitorConfig } from '@capacitor/cli';
346
+
347
+ const config: CapacitorConfig = {
348
+ plugins: {
349
+ CapacitorUpdater: {
350
+ appReadyTimeout: 1000 // (1 second),
351
+ responseTimeout: 10 // (10 second),
352
+ autoDeleteFailed: false,
353
+ autoDeletePrevious: false,
354
+ autoUpdate: false,
355
+ resetWhenUpdate: false,
356
+ updateUrl: https://example.com/api/auto_update,
357
+ channelUrl: https://example.com/api/channel,
358
+ statsUrl: https://example.com/api/stats,
359
+ publicKey: undefined,
360
+ version: undefined,
361
+ directUpdate: undefined,
362
+ autoSplashscreen: undefined,
363
+ autoSplashscreenLoader: undefined,
364
+ autoSplashscreenTimeout: undefined,
365
+ periodCheckDelay: 3600 (1 hour),
366
+ localS3: undefined,
367
+ localHost: undefined,
368
+ localWebHost: undefined,
369
+ localSupa: undefined,
370
+ localSupaAnon: undefined,
371
+ localApi: undefined,
372
+ localApiFiles: undefined,
373
+ allowModifyUrl: undefined,
374
+ allowModifyAppId: undefined,
375
+ allowManualBundleError: undefined,
376
+ persistCustomId: undefined,
377
+ persistModifyUrl: undefined,
378
+ allowSetDefaultChannel: undefined,
379
+ defaultChannel: undefined,
380
+ appId: undefined,
381
+ keepUrlPathAfterReload: undefined,
382
+ disableJSLogging: undefined,
383
+ shakeMenu: undefined,
384
+ },
385
+ },
386
+ };
387
+
388
+ export default config;
389
+ ```
390
+
391
+ </docgen-config>
392
+
119
393
  ## API
120
394
 
121
395
  <docgen-index>
396
+ <!--Auto-generated, compact index-->
122
397
 
123
398
  * [`notifyAppReady()`](#notifyappready)
399
+ * [`setUpdateUrl(...)`](#setupdateurl)
400
+ * [`setStatsUrl(...)`](#setstatsurl)
401
+ * [`setChannelUrl(...)`](#setchannelurl)
124
402
  * [`download(...)`](#download)
125
403
  * [`next(...)`](#next)
126
404
  * [`set(...)`](#set)
127
405
  * [`delete(...)`](#delete)
128
- * [`list()`](#list)
406
+ * [`setBundleError(...)`](#setbundleerror)
407
+ * [`list(...)`](#list)
129
408
  * [`reset(...)`](#reset)
130
409
  * [`current()`](#current)
131
410
  * [`reload()`](#reload)
132
411
  * [`setMultiDelay(...)`](#setmultidelay)
133
412
  * [`cancelDelay()`](#canceldelay)
134
- * [`getLatest()`](#getlatest)
413
+ * [`getLatest(...)`](#getlatest)
135
414
  * [`setChannel(...)`](#setchannel)
415
+ * [`unsetChannel(...)`](#unsetchannel)
136
416
  * [`getChannel()`](#getchannel)
417
+ * [`listChannels()`](#listchannels)
137
418
  * [`setCustomId(...)`](#setcustomid)
138
- * [`addListener('download', ...)`](#addlistenerdownload)
139
- * [`addListener('noNeedUpdate', ...)`](#addlistenernoneedupdate)
140
- * [`addListener('updateAvailable', ...)`](#addlistenerupdateavailable)
141
- * [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete)
142
- * [`addListener('majorAvailable', ...)`](#addlistenermajoravailable)
143
- * [`addListener('updateFailed', ...)`](#addlistenerupdatefailed)
144
- * [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed)
145
- * [`addListener('appReloaded', ...)`](#addlistenerappreloaded)
419
+ * [`getBuiltinVersion()`](#getbuiltinversion)
146
420
  * [`getDeviceId()`](#getdeviceid)
147
421
  * [`getPluginVersion()`](#getpluginversion)
148
422
  * [`isAutoUpdateEnabled()`](#isautoupdateenabled)
149
423
  * [`removeAllListeners()`](#removealllisteners)
424
+ * [`addListener('download', ...)`](#addlistenerdownload-)
425
+ * [`addListener('noNeedUpdate', ...)`](#addlistenernoneedupdate-)
426
+ * [`addListener('updateAvailable', ...)`](#addlistenerupdateavailable-)
427
+ * [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete-)
428
+ * [`addListener('breakingAvailable', ...)`](#addlistenerbreakingavailable-)
429
+ * [`addListener('majorAvailable', ...)`](#addlistenermajoravailable-)
430
+ * [`addListener('updateFailed', ...)`](#addlistenerupdatefailed-)
431
+ * [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed-)
432
+ * [`addListener('appReloaded', ...)`](#addlistenerappreloaded-)
433
+ * [`addListener('appReady', ...)`](#addlistenerappready-)
434
+ * [`addListener('channelPrivate', ...)`](#addlistenerchannelprivate-)
435
+ * [`isAutoUpdateAvailable()`](#isautoupdateavailable)
436
+ * [`getNextBundle()`](#getnextbundle)
437
+ * [`getFailedUpdate()`](#getfailedupdate)
438
+ * [`setShakeMenu(...)`](#setshakemenu)
439
+ * [`isShakeMenuEnabled()`](#isshakemenuenabled)
440
+ * [`getAppId()`](#getappid)
441
+ * [`setAppId(...)`](#setappid)
150
442
  * [Interfaces](#interfaces)
151
443
  * [Type Aliases](#type-aliases)
152
444
 
@@ -155,449 +447,1212 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
155
447
  <docgen-api>
156
448
  <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
157
449
 
158
- ### notifyAppReady()
450
+ #### notifyAppReady()
159
451
 
160
452
  ```typescript
161
- notifyAppReady() => Promise<BundleInfo>
453
+ notifyAppReady() => Promise<AppReadyResult>
162
454
  ```
163
455
 
164
- Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
165
- By default this method should be called in the first 10 sec after app launch, otherwise a rollback will occur.
166
- Change this behaviour with {@link appReadyTimeout}
456
+ Notify the native layer that JavaScript initialized successfully.
167
457
 
168
- **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
458
+ **CRITICAL: You must call this method on every app launch to prevent automatic rollback.**
459
+
460
+ This is a simple notification to confirm that your bundle's JavaScript loaded and executed.
461
+ The native web server successfully served the bundle files and your JS runtime started.
462
+ That's all it checks - nothing more complex.
463
+
464
+ **What triggers rollback:**
465
+ - NOT calling this method within the timeout (default: 10 seconds)
466
+ - Complete JavaScript failure (bundle won't load at all)
467
+
468
+ **What does NOT trigger rollback:**
469
+ - Runtime errors after initialization (API failures, crashes, etc.)
470
+ - Network request failures
471
+ - Application logic errors
472
+
473
+ **IMPORTANT: Call this BEFORE any network requests.**
474
+ Don't wait for APIs, data loading, or async operations. Call it as soon as your
475
+ JavaScript bundle starts executing to confirm the bundle itself is valid.
476
+
477
+ Best practices:
478
+ - Call immediately in your app entry point (main.js, app component mount, etc.)
479
+ - Don't put it after network calls or heavy initialization
480
+ - Don't wrap it in try/catch with conditions
481
+ - Adjust {@link PluginsConfig.CapacitorUpdater.appReadyTimeout} if you need more time
482
+
483
+ **Returns:** <code>Promise&lt;<a href="#appreadyresult">AppReadyResult</a>&gt;</code>
484
+
485
+ --------------------
486
+
487
+
488
+ #### setUpdateUrl(...)
489
+
490
+ ```typescript
491
+ setUpdateUrl(options: UpdateUrl) => Promise<void>
492
+ ```
493
+
494
+ Set the update URL for the app dynamically at runtime.
495
+
496
+ This overrides the {@link PluginsConfig.CapacitorUpdater.updateUrl} config value.
497
+ Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
498
+
499
+ Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
500
+ Otherwise, the URL will reset to the config value on next app launch.
501
+
502
+ | Param | Type | Description |
503
+ | ------------- | ----------------------------------------------- | ------------------------------------------------- |
504
+ | **`options`** | <code><a href="#updateurl">UpdateUrl</a></code> | Contains the URL to use for checking for updates. |
505
+
506
+ **Since:** 5.4.0
507
+
508
+ --------------------
509
+
510
+
511
+ #### setStatsUrl(...)
512
+
513
+ ```typescript
514
+ setStatsUrl(options: StatsUrl) => Promise<void>
515
+ ```
516
+
517
+ Set the statistics URL for the app dynamically at runtime.
518
+
519
+ This overrides the {@link PluginsConfig.CapacitorUpdater.statsUrl} config value.
520
+ Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
521
+
522
+ Pass an empty string to disable statistics gathering entirely.
523
+ Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
524
+
525
+ | Param | Type | Description |
526
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------ |
527
+ | **`options`** | <code><a href="#statsurl">StatsUrl</a></code> | Contains the URL to use for sending statistics, or an empty string to disable. |
528
+
529
+ **Since:** 5.4.0
169
530
 
170
531
  --------------------
171
532
 
172
533
 
173
- ### download(...)
534
+ #### setChannelUrl(...)
174
535
 
175
536
  ```typescript
176
- download(options: { url: string; version: string; sessionKey?: string; checksum?: string; }) => Promise<BundleInfo>
537
+ setChannelUrl(options: ChannelUrl) => Promise<void>
177
538
  ```
178
539
 
179
- Download a new bundle from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
540
+ Set the channel URL for the app dynamically at runtime.
541
+
542
+ This overrides the {@link PluginsConfig.CapacitorUpdater.channelUrl} config value.
543
+ Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
544
+
545
+ Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
546
+ Otherwise, the URL will reset to the config value on next app launch.
547
+
548
+ | Param | Type | Description |
549
+ | ------------- | ------------------------------------------------- | ----------------------------------------------- |
550
+ | **`options`** | <code><a href="#channelurl">ChannelUrl</a></code> | Contains the URL to use for channel operations. |
551
+
552
+ **Since:** 5.4.0
553
+
554
+ --------------------
180
555
 
181
- | Param | Type |
182
- | ------------- | -------------------------------------------------------------------------------------- |
183
- | **`options`** | <code>{ url: string; version: string; sessionKey?: string; checksum?: string; }</code> |
556
+
557
+ #### download(...)
558
+
559
+ ```typescript
560
+ download(options: DownloadOptions) => Promise<BundleInfo>
561
+ ```
562
+
563
+ Download a new bundle from the provided URL for later installation.
564
+
565
+ The downloaded bundle is stored locally but not activated. To use it:
566
+ - Call {@link next} to set it for installation on next app backgrounding/restart
567
+ - Call {@link set} to activate it immediately (destroys current JavaScript context)
568
+
569
+ The URL should point to a zip file containing either:
570
+ - Your app files directly in the zip root, or
571
+ - A single folder containing all your app files
572
+
573
+ The bundle must include an `index.html` file at the root level.
574
+
575
+ For encrypted bundles, provide the `sessionKey` and `checksum` parameters.
576
+ For multi-file partial updates, provide the `manifest` array.
577
+
578
+ | Param | Type | Description |
579
+ | ------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
580
+ | **`options`** | <code><a href="#downloadoptions">DownloadOptions</a></code> | The {@link <a href="#downloadoptions">DownloadOptions</a>} for downloading a new bundle zip. |
184
581
 
185
582
  **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
186
583
 
187
584
  --------------------
188
585
 
189
586
 
190
- ### next(...)
587
+ #### next(...)
191
588
 
192
589
  ```typescript
193
- next(options: { id: string; }) => Promise<BundleInfo>
590
+ next(options: BundleId) => Promise<BundleInfo>
194
591
  ```
195
592
 
196
- Set the next bundle to be used when the app is reloaded.
593
+ Set the next bundle to be activated when the app backgrounds or restarts.
594
+
595
+ This is the recommended way to apply updates as it doesn't interrupt the user's current session.
596
+ The bundle will be activated when:
597
+ - The app is backgrounded (user switches away), or
598
+ - The app is killed and relaunched, or
599
+ - {@link reload} is called manually
600
+
601
+ Unlike {@link set}, this method does NOT destroy the current JavaScript context immediately.
602
+ Your app continues running normally until one of the above events occurs.
603
+
604
+ Use {@link setMultiDelay} to add additional conditions before the update is applied.
197
605
 
198
- | Param | Type |
199
- | ------------- | ---------------------------- |
200
- | **`options`** | <code>{ id: string; }</code> |
606
+ | Param | Type | Description |
607
+ | ------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
608
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | Contains the ID of the bundle to set as next. Use {@link <a href="#bundleinfo">BundleInfo.id</a>} from a downloaded bundle. |
201
609
 
202
610
  **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
203
611
 
204
612
  --------------------
205
613
 
206
614
 
207
- ### set(...)
615
+ #### set(...)
208
616
 
209
617
  ```typescript
210
- set(options: { id: string; }) => Promise<void>
618
+ set(options: BundleId) => Promise<void>
211
619
  ```
212
620
 
213
621
  Set the current bundle and immediately reloads the app.
214
622
 
215
- | Param | Type |
216
- | ------------- | ---------------------------- |
217
- | **`options`** | <code>{ id: string; }</code> |
623
+ **IMPORTANT: This is a terminal operation that destroys the current JavaScript context.**
624
+
625
+ When you call this method:
626
+ - The entire JavaScript context is immediately destroyed
627
+ - The app reloads from a different folder with different files
628
+ - NO code after this call will execute
629
+ - NO promises will resolve
630
+ - NO callbacks will fire
631
+ - Event listeners registered after this call are unreliable and may never fire
632
+
633
+ The reload happens automatically - you don't need to do anything else.
634
+ If you need to preserve state like the current URL path, use the {@link PluginsConfig.CapacitorUpdater.keepUrlPathAfterReload} config option.
635
+ For other state preservation needs, save your data before calling this method (e.g., to localStorage).
636
+
637
+ **Do not** try to execute additional logic after calling `set()` - it won't work as expected.
638
+
639
+ | Param | Type | Description |
640
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
641
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the new bundle id to set as current. |
642
+
643
+ --------------------
644
+
645
+
646
+ #### delete(...)
647
+
648
+ ```typescript
649
+ delete(options: BundleId) => Promise<void>
650
+ ```
651
+
652
+ Delete a bundle from local storage to free up disk space.
653
+
654
+ You cannot delete:
655
+ - The currently active bundle
656
+ - The `builtin` bundle (the version shipped with your app)
657
+ - The bundle set as `next` (call {@link next} with a different bundle first)
658
+
659
+ Use {@link list} to get all available bundle IDs.
660
+
661
+ **Note:** The bundle ID is NOT the same as the version name.
662
+ Use the `id` field from {@link <a href="#bundleinfo">BundleInfo</a>}, not the `version` field.
663
+
664
+ | Param | Type | Description |
665
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------- |
666
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the bundle ID to delete. |
218
667
 
219
668
  --------------------
220
669
 
221
670
 
222
- ### delete(...)
671
+ #### setBundleError(...)
223
672
 
224
673
  ```typescript
225
- delete(options: { id: string; }) => Promise<void>
674
+ setBundleError(options: BundleId) => Promise<BundleInfo>
226
675
  ```
227
676
 
228
- Delete bundle in storage
677
+ Manually mark a bundle as failed/errored in manual update mode.
678
+
679
+ This is useful when you detect that a bundle has critical issues and want to prevent
680
+ it from being used again. The bundle status will be changed to `error` and the plugin
681
+ will avoid using this bundle in the future.
682
+
683
+ **Requirements:**
684
+ - {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} must be set to `true`
685
+ - Only works in manual update mode (when autoUpdate is disabled)
686
+
687
+ Common use case: After downloading and testing a bundle, you discover it has critical
688
+ bugs and want to mark it as failed so it won't be retried.
229
689
 
230
- | Param | Type |
231
- | ------------- | ---------------------------- |
232
- | **`options`** | <code>{ id: string; }</code> |
690
+ | Param | Type | Description |
691
+ | ------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------- |
692
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the bundle ID to mark as errored. |
693
+
694
+ **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
695
+
696
+ **Since:** 7.20.0
233
697
 
234
698
  --------------------
235
699
 
236
700
 
237
- ### list()
701
+ #### list(...)
238
702
 
239
703
  ```typescript
240
- list() => Promise<{ bundles: BundleInfo[]; }>
704
+ list(options?: ListOptions | undefined) => Promise<BundleListResult>
241
705
  ```
242
706
 
243
- Get all available bundles
707
+ Get all locally downloaded bundles stored in your app.
708
+
709
+ This returns all bundles that have been downloaded and are available locally, including:
710
+ - The currently active bundle
711
+ - The `builtin` bundle (shipped with your app)
712
+ - Any downloaded bundles waiting to be activated
713
+ - Failed bundles (with `error` status)
714
+
715
+ Use this to:
716
+ - Check available disk space by counting bundles
717
+ - Delete old bundles with {@link delete}
718
+ - Monitor bundle download status
719
+
720
+ | Param | Type | Description |
721
+ | ------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------ |
722
+ | **`options`** | <code><a href="#listoptions">ListOptions</a></code> | The {@link <a href="#listoptions">ListOptions</a>} for customizing the bundle list output. |
244
723
 
245
- **Returns:** <code>Promise&lt;{ bundles: BundleInfo[]; }&gt;</code>
724
+ **Returns:** <code>Promise&lt;<a href="#bundlelistresult">BundleListResult</a>&gt;</code>
246
725
 
247
726
  --------------------
248
727
 
249
728
 
250
- ### reset(...)
729
+ #### reset(...)
251
730
 
252
731
  ```typescript
253
- reset(options?: { toLastSuccessful?: boolean | undefined; } | undefined) => Promise<void>
732
+ reset(options?: ResetOptions | undefined) => Promise<void>
254
733
  ```
255
734
 
256
- Set the `builtin` bundle (the one sent to Apple store / Google play store ) as current bundle
735
+ Reset the app to a known good bundle.
257
736
 
258
- | Param | Type |
259
- | ------------- | -------------------------------------------- |
260
- | **`options`** | <code>{ toLastSuccessful?: boolean; }</code> |
737
+ This method helps recover from problematic updates by reverting to either:
738
+ - The `builtin` bundle (the original version shipped with your app to App Store/Play Store)
739
+ - The last successfully loaded bundle (most recent bundle that worked correctly)
740
+
741
+ **IMPORTANT: This triggers an immediate app reload, destroying the current JavaScript context.**
742
+ See {@link set} for details on the implications of this operation.
743
+
744
+ Use cases:
745
+ - Emergency recovery when an update causes critical issues
746
+ - Testing rollback functionality
747
+ - Providing users a "reset to factory" option
748
+
749
+ | Param | Type |
750
+ | ------------- | ----------------------------------------------------- |
751
+ | **`options`** | <code><a href="#resetoptions">ResetOptions</a></code> |
261
752
 
262
753
  --------------------
263
754
 
264
755
 
265
- ### current()
756
+ #### current()
266
757
 
267
758
  ```typescript
268
- current() => Promise<{ bundle: BundleInfo; native: string; }>
759
+ current() => Promise<CurrentBundleResult>
269
760
  ```
270
761
 
271
- Get the current bundle, if none are set it returns `builtin`, currentNative is the original bundle installed on the device
762
+ Get information about the currently active bundle.
763
+
764
+ Returns:
765
+ - `bundle`: The currently active bundle information
766
+ - `native`: The version of the builtin bundle (the original app version from App/Play Store)
272
767
 
273
- **Returns:** <code>Promise&lt;{ bundle: <a href="#bundleinfo">BundleInfo</a>; native: string; }&gt;</code>
768
+ If no updates have been applied, `bundle.id` will be `"builtin"`, indicating the app
769
+ is running the original version shipped with the native app.
770
+
771
+ Use this to:
772
+ - Display the current version to users
773
+ - Check if an update is currently active
774
+ - Compare against available updates
775
+ - Log the active bundle for debugging
776
+
777
+ **Returns:** <code>Promise&lt;<a href="#currentbundleresult">CurrentBundleResult</a>&gt;</code>
274
778
 
275
779
  --------------------
276
780
 
277
781
 
278
- ### reload()
782
+ #### reload()
279
783
 
280
784
  ```typescript
281
785
  reload() => Promise<void>
282
786
  ```
283
787
 
284
- Reload the view
788
+ Manually reload the app to apply a pending update.
789
+
790
+ This triggers the same reload behavior that happens automatically when the app backgrounds.
791
+ If you've called {@link next} to queue an update, calling `reload()` will apply it immediately.
792
+
793
+ **IMPORTANT: This destroys the current JavaScript context immediately.**
794
+ See {@link set} for details on the implications of this operation.
795
+
796
+ Common use cases:
797
+ - Applying an update immediately after download instead of waiting for backgrounding
798
+ - Providing a "Restart now" button to users after an update is ready
799
+ - Testing update flows during development
800
+
801
+ If no update is pending (no call to {@link next}), this simply reloads the current bundle.
285
802
 
286
803
  --------------------
287
804
 
288
805
 
289
- ### setMultiDelay(...)
806
+ #### setMultiDelay(...)
290
807
 
291
808
  ```typescript
292
- setMultiDelay(options: { delayConditions: DelayCondition[]; }) => Promise<void>
809
+ setMultiDelay(options: MultiDelayConditions) => Promise<void>
293
810
  ```
294
811
 
295
- Set <a href="#delaycondition">DelayCondition</a>, skip updates until one of the conditions is met
812
+ Configure conditions that must be met before a pending update is applied.
813
+
814
+ After calling {@link next} to queue an update, use this method to control when it gets applied.
815
+ The update will only be installed after ALL specified conditions are satisfied.
816
+
817
+ Available condition types:
818
+ - `background`: Wait for the app to be backgrounded. Optionally specify duration in milliseconds.
819
+ - `kill`: Wait for the app to be killed and relaunched (**Note:** Current behavior triggers update immediately on kill, not on next background. This will be fixed in v8.)
820
+ - `date`: Wait until a specific date/time (ISO 8601 format)
821
+ - `nativeVersion`: Wait until the native app is updated to a specific version
822
+
823
+ Condition value formats:
824
+ - `background`: Number in milliseconds (e.g., `"300000"` for 5 minutes), or omit for immediate
825
+ - `kill`: No value needed
826
+ - `date`: ISO 8601 date string (e.g., `"2025-12-31T23:59:59Z"`)
827
+ - `nativeVersion`: Version string (e.g., `"2.0.0"`)
296
828
 
297
- | Param | Type | Description |
298
- | ------------- | --------------------------------------------------- | ------------------------------------------------------------------------ |
299
- | **`options`** | <code>{ delayConditions: DelayCondition[]; }</code> | are the {@link <a href="#delaycondition">DelayCondition</a>} list to set |
829
+ | Param | Type | Description |
830
+ | ------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
831
+ | **`options`** | <code><a href="#multidelayconditions">MultiDelayConditions</a></code> | Contains the {@link <a href="#multidelayconditions">MultiDelayConditions</a>} array of conditions. |
300
832
 
301
833
  **Since:** 4.3.0
302
834
 
303
835
  --------------------
304
836
 
305
837
 
306
- ### cancelDelay()
838
+ #### cancelDelay()
307
839
 
308
840
  ```typescript
309
841
  cancelDelay() => Promise<void>
310
842
  ```
311
843
 
312
- Cancel delay to updates as usual
844
+ Cancel all delay conditions and apply the pending update immediately.
845
+
846
+ If you've set delay conditions with {@link setMultiDelay}, this method clears them
847
+ and triggers the pending update to be applied on the next app background or restart.
848
+
849
+ This is useful when:
850
+ - User manually requests to update now (e.g., clicks "Update now" button)
851
+ - Your app detects it's a good time to update (e.g., user finished critical task)
852
+ - You want to override a time-based delay early
313
853
 
314
854
  **Since:** 4.0.0
315
855
 
316
856
  --------------------
317
857
 
318
858
 
319
- ### getLatest()
859
+ #### getLatest(...)
320
860
 
321
861
  ```typescript
322
- getLatest() => Promise<latestVersion>
862
+ getLatest(options?: GetLatestOptions | undefined) => Promise<LatestVersion>
863
+ ```
864
+
865
+ Check the update server for the latest available bundle version.
866
+
867
+ This queries your configured update URL (or Capgo backend) to see if a newer bundle
868
+ is available for download. It does NOT download the bundle automatically.
869
+
870
+ The response includes:
871
+ - `version`: The latest available version identifier
872
+ - `url`: Download URL for the bundle (if available)
873
+ - `breaking`: Whether this update is marked as incompatible (requires native app update)
874
+ - `message`: Optional message from the server
875
+ - `manifest`: File list for partial updates (if using multi-file downloads)
876
+
877
+ After receiving the latest version info, you can:
878
+ 1. Compare it with your current version
879
+ 2. Download it using {@link download}
880
+ 3. Apply it using {@link next} or {@link set}
881
+
882
+ **Important: Error handling for "no new version available"**
883
+
884
+ When the device's current version matches the latest version on the server (i.e., the device is already
885
+ up-to-date), the server returns a 200 response with `error: "no_new_version_available"` and
886
+ `message: "No new version available"`. **This causes `getLatest()` to throw an error**, even though
887
+ this is a normal, expected condition.
888
+
889
+ You should catch this specific error to handle it gracefully:
890
+
891
+ ```typescript
892
+ try {
893
+ const latest = await CapacitorUpdater.getLatest();
894
+ // New version is available, proceed with download
895
+ } catch (error) {
896
+ if (error.message === 'No new version available') {
897
+ // Device is already on the latest version - this is normal
898
+ console.log('Already up to date');
899
+ } else {
900
+ // Actual error occurred
901
+ console.error('Failed to check for updates:', error);
902
+ }
903
+ }
323
904
  ```
324
905
 
325
- Get Latest bundle available from update Url
906
+ In this scenario, the server:
907
+ - Logs the request with a "No new version available" message
908
+ - Sends a "noNew" stat action to track that the device checked for updates but was already current (done on the backend)
326
909
 
327
- **Returns:** <code>Promise&lt;<a href="#latestversion">latestVersion</a>&gt;</code>
910
+ | Param | Type | Description |
911
+ | ------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
912
+ | **`options`** | <code><a href="#getlatestoptions">GetLatestOptions</a></code> | Optional {@link <a href="#getlatestoptions">GetLatestOptions</a>} to specify which channel to check. |
913
+
914
+ **Returns:** <code>Promise&lt;<a href="#latestversion">LatestVersion</a>&gt;</code>
328
915
 
329
916
  **Since:** 4.0.0
330
917
 
331
918
  --------------------
332
919
 
333
920
 
334
- ### setChannel(...)
921
+ #### setChannel(...)
922
+
923
+ ```typescript
924
+ setChannel(options: SetChannelOptions) => Promise<ChannelRes>
925
+ ```
926
+
927
+ Assign this device to a specific update channel at runtime.
928
+
929
+ Channels allow you to distribute different bundle versions to different groups of users
930
+ (e.g., "production", "beta", "staging"). This method switches the device to a new channel.
931
+
932
+ **Requirements:**
933
+ - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)
934
+ - The backend may accept or reject the request based on channel settings
935
+
936
+ **When to use:**
937
+ - After the app is ready and the user has interacted (e.g., opted into beta program)
938
+ - To implement in-app channel switching (beta toggle, tester access, etc.)
939
+ - For user-driven channel changes
940
+
941
+ **When NOT to use:**
942
+ - At app boot/initialization - use {@link PluginsConfig.CapacitorUpdater.defaultChannel} config instead
943
+ - Before user interaction
944
+
945
+ **Important: Listen for the `channelPrivate` event**
946
+
947
+ When a user attempts to set a channel that doesn't allow device self-assignment, the method will
948
+ throw an error AND fire a {@link addListener}('channelPrivate') event. You should listen to this event
949
+ to provide appropriate feedback to users:
950
+
951
+ ```typescript
952
+ CapacitorUpdater.addListener('channelPrivate', (data) =&gt; {
953
+ console.warn(`Cannot access channel "${data.channel}": ${data.message}`);
954
+ // Show user-friendly message
955
+ });
956
+ ```
957
+
958
+ This sends a request to the Capgo backend linking your device ID to the specified channel.
959
+
960
+ | Param | Type | Description |
961
+ | ------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
962
+ | **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> | The {@link <a href="#setchanneloptions">SetChannelOptions</a>} containing the channel name and optional auto-update trigger. |
963
+
964
+ **Returns:** <code>Promise&lt;<a href="#channelres">ChannelRes</a>&gt;</code>
965
+
966
+ **Since:** 4.7.0
967
+
968
+ --------------------
969
+
970
+
971
+ #### unsetChannel(...)
335
972
 
336
973
  ```typescript
337
- setChannel(options: SetChannelOptions) => Promise<channelRes>
974
+ unsetChannel(options: UnsetChannelOptions) => Promise<void>
338
975
  ```
339
976
 
340
- Set Channel for this device
977
+ Remove the device's channel assignment and return to the default channel.
978
+
979
+ This unlinks the device from any specifically assigned channel, causing it to fall back to:
980
+ - The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or
981
+ - Your backend's default channel for this app
341
982
 
342
- | Param | Type | Description |
343
- | ------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------- |
344
- | **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> | is the {@link <a href="#setchanneloptions">SetChannelOptions</a>} channel to set |
983
+ Use this when:
984
+ - Users opt out of beta/testing programs
985
+ - You want to reset a device to standard update distribution
986
+ - Testing channel switching behavior
345
987
 
346
- **Returns:** <code>Promise&lt;<a href="#channelres">channelRes</a>&gt;</code>
988
+ | Param | Type |
989
+ | ------------- | ------------------------------------------------------------------- |
990
+ | **`options`** | <code><a href="#unsetchanneloptions">UnsetChannelOptions</a></code> |
347
991
 
348
992
  **Since:** 4.7.0
349
993
 
350
994
  --------------------
351
995
 
352
996
 
353
- ### getChannel()
997
+ #### getChannel()
354
998
 
355
999
  ```typescript
356
- getChannel() => Promise<getChannelRes>
1000
+ getChannel() => Promise<GetChannelRes>
357
1001
  ```
358
1002
 
359
- get Channel for this device
1003
+ Get the current channel assigned to this device.
360
1004
 
361
- **Returns:** <code>Promise&lt;<a href="#getchannelres">getChannelRes</a>&gt;</code>
1005
+ Returns information about:
1006
+ - `channel`: The currently assigned channel name (if any)
1007
+ - `allowSet`: Whether the channel allows self-assignment
1008
+ - `status`: Operation status
1009
+ - `error`/`message`: Additional information (if applicable)
1010
+
1011
+ Use this to:
1012
+ - Display current channel to users (e.g., "You're on the Beta channel")
1013
+ - Check if a device is on a specific channel before showing features
1014
+ - Verify channel assignment after calling {@link setChannel}
1015
+
1016
+ **Returns:** <code>Promise&lt;<a href="#getchannelres">GetChannelRes</a>&gt;</code>
362
1017
 
363
1018
  **Since:** 4.8.0
364
1019
 
365
1020
  --------------------
366
1021
 
367
1022
 
368
- ### setCustomId(...)
1023
+ #### listChannels()
1024
+
1025
+ ```typescript
1026
+ listChannels() => Promise<ListChannelsResult>
1027
+ ```
1028
+
1029
+ Get a list of all channels available for this device to self-assign to.
1030
+
1031
+ Only returns channels where `allow_self_set` is `true`. These are channels that
1032
+ users can switch to using {@link setChannel} without backend administrator intervention.
1033
+
1034
+ Each channel includes:
1035
+ - `id`: Unique channel identifier
1036
+ - `name`: Human-readable channel name
1037
+ - `public`: Whether the channel is publicly visible
1038
+ - `allow_self_set`: Always `true` in results (filtered to only self-assignable channels)
1039
+
1040
+ Use this to:
1041
+ - Build a channel selector UI for users (e.g., "Join Beta" button)
1042
+ - Show available testing/preview channels
1043
+ - Implement channel discovery features
1044
+
1045
+ **Returns:** <code>Promise&lt;<a href="#listchannelsresult">ListChannelsResult</a>&gt;</code>
1046
+
1047
+ **Since:** 7.5.0
1048
+
1049
+ --------------------
1050
+
1051
+
1052
+ #### setCustomId(...)
369
1053
 
370
1054
  ```typescript
371
1055
  setCustomId(options: SetCustomIdOptions) => Promise<void>
372
1056
  ```
373
1057
 
374
- Set Channel for this device
1058
+ Set a custom identifier for this device.
1059
+
1060
+ This allows you to identify devices by your own custom ID (user ID, account ID, etc.)
1061
+ instead of or in addition to the device's unique hardware ID. The custom ID is sent
1062
+ to your update server and can be used for:
1063
+ - Targeting specific users for updates
1064
+ - Analytics and user tracking
1065
+ - Debugging and support (correlating devices with users)
1066
+ - A/B testing or feature flagging
1067
+
1068
+ **Persistence:**
1069
+ - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true`, the ID persists across app restarts
1070
+ - When `false`, the ID is only kept for the current session
375
1071
 
376
- | Param | Type | Description |
377
- | ------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
378
- | **`options`** | <code><a href="#setcustomidoptions">SetCustomIdOptions</a></code> | is the {@link <a href="#setcustomidoptions">SetCustomIdOptions</a>} customId to set |
1072
+ **Clearing the custom ID:**
1073
+ - Pass an empty string `""` to remove any stored custom ID
1074
+
1075
+ | Param | Type | Description |
1076
+ | ------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
1077
+ | **`options`** | <code><a href="#setcustomidoptions">SetCustomIdOptions</a></code> | The {@link <a href="#setcustomidoptions">SetCustomIdOptions</a>} containing the custom identifier string. |
379
1078
 
380
1079
  **Since:** 4.9.0
381
1080
 
382
1081
  --------------------
383
1082
 
384
1083
 
385
- ### addListener('download', ...)
1084
+ #### getBuiltinVersion()
386
1085
 
387
1086
  ```typescript
388
- addListener(eventName: "download", listenerFunc: DownloadChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1087
+ getBuiltinVersion() => Promise<BuiltinVersion>
389
1088
  ```
390
1089
 
391
- Listen for download event in the App, let you know when the download is started, loading and finished
1090
+ Get the builtin bundle version (the original version shipped with your native app).
1091
+
1092
+ This returns the version of the bundle that was included when the app was installed
1093
+ from the App Store or Play Store. This is NOT the currently active bundle version -
1094
+ use {@link current} for that.
1095
+
1096
+ Returns:
1097
+ - The {@link PluginsConfig.CapacitorUpdater.version} config value if set, or
1098
+ - The native app version from platform configs (package.json, Info.plist, build.gradle)
1099
+
1100
+ Use this to:
1101
+ - Display the "factory" version to users
1102
+ - Compare against downloaded bundle versions
1103
+ - Determine if any updates have been applied
1104
+ - Debugging version mismatches
1105
+
1106
+ **Returns:** <code>Promise&lt;<a href="#builtinversion">BuiltinVersion</a>&gt;</code>
1107
+
1108
+ **Since:** 5.2.0
1109
+
1110
+ --------------------
1111
+
1112
+
1113
+ #### getDeviceId()
1114
+
1115
+ ```typescript
1116
+ getDeviceId() => Promise<DeviceId>
1117
+ ```
1118
+
1119
+ Get the unique, privacy-friendly identifier for this device.
1120
+
1121
+ This ID is used to identify the device when communicating with update servers.
1122
+ It's automatically generated and stored securely by the plugin.
1123
+
1124
+ **Privacy & Security characteristics:**
1125
+ - Generated as a UUID (not based on hardware identifiers)
1126
+ - Stored securely in platform-specific secure storage
1127
+ - Android: Android Keystore (persists across app reinstalls on API 23+)
1128
+ - iOS: Keychain with `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`
1129
+ - Not synced to cloud (iOS)
1130
+ - Follows Apple and Google privacy best practices
1131
+ - Users can clear it via system settings (Android) or keychain access (iOS)
1132
+
1133
+ **Persistence:**
1134
+ The device ID persists across app reinstalls to maintain consistent device identity
1135
+ for update tracking and analytics.
1136
+
1137
+ Use this to:
1138
+ - Debug update delivery issues (check what ID the server sees)
1139
+ - Implement device-specific features
1140
+ - Correlate server logs with specific devices
1141
+
1142
+ **Returns:** <code>Promise&lt;<a href="#deviceid">DeviceId</a>&gt;</code>
1143
+
1144
+ --------------------
392
1145
 
393
- | Param | Type |
394
- | ------------------ | ------------------------------------------------------------------------- |
395
- | **`eventName`** | <code>'download'</code> |
396
- | **`listenerFunc`** | <code><a href="#downloadchangelistener">DownloadChangeListener</a></code> |
397
1146
 
398
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1147
+ #### getPluginVersion()
1148
+
1149
+ ```typescript
1150
+ getPluginVersion() => Promise<PluginVersion>
1151
+ ```
1152
+
1153
+ Get the version of the Capacitor Updater plugin installed in your app.
1154
+
1155
+ This returns the version of the native plugin code (Android/iOS), which is sent
1156
+ to the update server with each request. This is NOT your app version or bundle version.
1157
+
1158
+ Use this to:
1159
+ - Debug plugin-specific issues (when reporting bugs)
1160
+ - Verify plugin installation and version
1161
+ - Check compatibility with backend features
1162
+ - Display in debug/about screens
1163
+
1164
+ **Returns:** <code>Promise&lt;<a href="#pluginversion">PluginVersion</a>&gt;</code>
1165
+
1166
+ --------------------
1167
+
1168
+
1169
+ #### isAutoUpdateEnabled()
1170
+
1171
+ ```typescript
1172
+ isAutoUpdateEnabled() => Promise<AutoUpdateEnabled>
1173
+ ```
1174
+
1175
+ Check if automatic updates are currently enabled.
1176
+
1177
+ Returns `true` if {@link PluginsConfig.CapacitorUpdater.autoUpdate} is enabled,
1178
+ meaning the plugin will automatically check for, download, and apply updates.
1179
+
1180
+ Returns `false` if in manual mode, where you control the update flow using
1181
+ {@link getLatest}, {@link download}, {@link next}, and {@link set}.
1182
+
1183
+ Use this to:
1184
+ - Determine which update flow your app is using
1185
+ - Show/hide manual update UI based on mode
1186
+ - Debug update behavior
1187
+
1188
+ **Returns:** <code>Promise&lt;<a href="#autoupdateenabled">AutoUpdateEnabled</a>&gt;</code>
1189
+
1190
+ --------------------
1191
+
1192
+
1193
+ #### removeAllListeners()
1194
+
1195
+ ```typescript
1196
+ removeAllListeners() => Promise<void>
1197
+ ```
1198
+
1199
+ Remove all event listeners registered for this plugin.
1200
+
1201
+ This unregisters all listeners added via {@link addListener} for all event types:
1202
+ - `download`
1203
+ - `noNeedUpdate`
1204
+ - `updateAvailable`
1205
+ - `downloadComplete`
1206
+ - `downloadFailed`
1207
+ - `breakingAvailable` / `majorAvailable`
1208
+ - `updateFailed`
1209
+ - `appReloaded`
1210
+ - `appReady`
1211
+
1212
+ Use this during cleanup (e.g., when unmounting components or closing screens)
1213
+ to prevent memory leaks from lingering event listeners.
1214
+
1215
+ **Since:** 1.0.0
1216
+
1217
+ --------------------
1218
+
1219
+
1220
+ #### addListener('download', ...)
1221
+
1222
+ ```typescript
1223
+ addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void) => Promise<PluginListenerHandle>
1224
+ ```
1225
+
1226
+ Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.
1227
+ This will return you all download percent during the download
1228
+
1229
+ | Param | Type |
1230
+ | ------------------ | --------------------------------------------------------------------------- |
1231
+ | **`eventName`** | <code>'download'</code> |
1232
+ | **`listenerFunc`** | <code>(state: <a href="#downloadevent">DownloadEvent</a>) =&gt; void</code> |
1233
+
1234
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
399
1235
 
400
1236
  **Since:** 2.0.11
401
1237
 
402
1238
  --------------------
403
1239
 
404
1240
 
405
- ### addListener('noNeedUpdate', ...)
1241
+ #### addListener('noNeedUpdate', ...)
406
1242
 
407
1243
  ```typescript
408
- addListener(eventName: "noNeedUpdate", listenerFunc: NoNeedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1244
+ addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void) => Promise<PluginListenerHandle>
409
1245
  ```
410
1246
 
411
- Listen for no need to update event, usefull when you want force check every time the app is launched
1247
+ Listen for no need to update event, useful when you want force check every time the app is launched
412
1248
 
413
- | Param | Type |
414
- | ------------------ | --------------------------------------------------------- |
415
- | **`eventName`** | <code>'noNeedUpdate'</code> |
416
- | **`listenerFunc`** | <code><a href="#noneedlistener">NoNeedListener</a></code> |
1249
+ | Param | Type |
1250
+ | ------------------ | ----------------------------------------------------------------------- |
1251
+ | **`eventName`** | <code>'noNeedUpdate'</code> |
1252
+ | **`listenerFunc`** | <code>(state: <a href="#noneedevent">NoNeedEvent</a>) =&gt; void</code> |
417
1253
 
418
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1254
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
419
1255
 
420
1256
  **Since:** 4.0.0
421
1257
 
422
1258
  --------------------
423
1259
 
424
1260
 
425
- ### addListener('updateAvailable', ...)
1261
+ #### addListener('updateAvailable', ...)
426
1262
 
427
1263
  ```typescript
428
- addListener(eventName: "updateAvailable", listenerFunc: UpdateAvailabledListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1264
+ addListener(eventName: 'updateAvailable', listenerFunc: (state: UpdateAvailableEvent) => void) => Promise<PluginListenerHandle>
429
1265
  ```
430
1266
 
431
- Listen for availbale update event, usefull when you want to force check every time the app is launched
1267
+ Listen for available update event, useful when you want to force check every time the app is launched
432
1268
 
433
- | Param | Type |
434
- | ------------------ | ----------------------------------------------------------------------------- |
435
- | **`eventName`** | <code>'updateAvailable'</code> |
436
- | **`listenerFunc`** | <code><a href="#updateavailabledlistener">UpdateAvailabledListener</a></code> |
1269
+ | Param | Type |
1270
+ | ------------------ | ----------------------------------------------------------------------------------------- |
1271
+ | **`eventName`** | <code>'updateAvailable'</code> |
1272
+ | **`listenerFunc`** | <code>(state: <a href="#updateavailableevent">UpdateAvailableEvent</a>) =&gt; void</code> |
437
1273
 
438
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1274
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
439
1275
 
440
1276
  **Since:** 4.0.0
441
1277
 
442
1278
  --------------------
443
1279
 
444
1280
 
445
- ### addListener('downloadComplete', ...)
1281
+ #### addListener('downloadComplete', ...)
446
1282
 
447
1283
  ```typescript
448
- addListener(eventName: "downloadComplete", listenerFunc: DownloadCompleteListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1284
+ addListener(eventName: 'downloadComplete', listenerFunc: (state: DownloadCompleteEvent) => void) => Promise<PluginListenerHandle>
449
1285
  ```
450
1286
 
451
- Listen for download event in the App, let you know when the download is started, loading and finished
1287
+ Listen for downloadComplete events.
452
1288
 
453
- | Param | Type |
454
- | ------------------ | ----------------------------------------------------------------------------- |
455
- | **`eventName`** | <code>'downloadComplete'</code> |
456
- | **`listenerFunc`** | <code><a href="#downloadcompletelistener">DownloadCompleteListener</a></code> |
1289
+ | Param | Type |
1290
+ | ------------------ | ------------------------------------------------------------------------------------------- |
1291
+ | **`eventName`** | <code>'downloadComplete'</code> |
1292
+ | **`listenerFunc`** | <code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>) =&gt; void</code> |
457
1293
 
458
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1294
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
459
1295
 
460
1296
  **Since:** 4.0.0
461
1297
 
462
1298
  --------------------
463
1299
 
464
1300
 
465
- ### addListener('majorAvailable', ...)
1301
+ #### addListener('breakingAvailable', ...)
1302
+
1303
+ ```typescript
1304
+ addListener(eventName: 'breakingAvailable', listenerFunc: (state: BreakingAvailableEvent) => void) => Promise<PluginListenerHandle>
1305
+ ```
1306
+
1307
+ Listen for breaking update events when the backend flags an update as incompatible with the current app.
1308
+ Emits the same payload as the legacy `majorAvailable` listener.
1309
+
1310
+ | Param | Type |
1311
+ | ------------------ | --------------------------------------------------------------------------------------- |
1312
+ | **`eventName`** | <code>'breakingAvailable'</code> |
1313
+ | **`listenerFunc`** | <code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>) =&gt; void</code> |
1314
+
1315
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
1316
+
1317
+ **Since:** 7.22.0
1318
+
1319
+ --------------------
1320
+
1321
+
1322
+ #### addListener('majorAvailable', ...)
466
1323
 
467
1324
  ```typescript
468
- addListener(eventName: "majorAvailable", listenerFunc: MajorAvailableListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1325
+ addListener(eventName: 'majorAvailable', listenerFunc: (state: MajorAvailableEvent) => void) => Promise<PluginListenerHandle>
469
1326
  ```
470
1327
 
471
1328
  Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
472
1329
 
473
- | Param | Type |
474
- | ------------------ | ------------------------------------------------------------------------- |
475
- | **`eventName`** | <code>'majorAvailable'</code> |
476
- | **`listenerFunc`** | <code><a href="#majoravailablelistener">MajorAvailableListener</a></code> |
1330
+ | Param | Type |
1331
+ | ------------------ | --------------------------------------------------------------------------------------- |
1332
+ | **`eventName`** | <code>'majorAvailable'</code> |
1333
+ | **`listenerFunc`** | <code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>) =&gt; void</code> |
477
1334
 
478
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1335
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
479
1336
 
480
1337
  **Since:** 2.3.0
481
1338
 
482
1339
  --------------------
483
1340
 
484
1341
 
485
- ### addListener('updateFailed', ...)
1342
+ #### addListener('updateFailed', ...)
486
1343
 
487
1344
  ```typescript
488
- addListener(eventName: "updateFailed", listenerFunc: UpdateFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1345
+ addListener(eventName: 'updateFailed', listenerFunc: (state: UpdateFailedEvent) => void) => Promise<PluginListenerHandle>
489
1346
  ```
490
1347
 
491
1348
  Listen for update fail event in the App, let you know when update has fail to install at next app start
492
1349
 
493
- | Param | Type |
494
- | ------------------ | --------------------------------------------------------------------- |
495
- | **`eventName`** | <code>'updateFailed'</code> |
496
- | **`listenerFunc`** | <code><a href="#updatefailedlistener">UpdateFailedListener</a></code> |
1350
+ | Param | Type |
1351
+ | ------------------ | ----------------------------------------------------------------------------------- |
1352
+ | **`eventName`** | <code>'updateFailed'</code> |
1353
+ | **`listenerFunc`** | <code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>) =&gt; void</code> |
497
1354
 
498
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1355
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
499
1356
 
500
1357
  **Since:** 2.3.0
501
1358
 
502
1359
  --------------------
503
1360
 
504
1361
 
505
- ### addListener('downloadFailed', ...)
1362
+ #### addListener('downloadFailed', ...)
506
1363
 
507
1364
  ```typescript
508
- addListener(eventName: "downloadFailed", listenerFunc: DownloadFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1365
+ addListener(eventName: 'downloadFailed', listenerFunc: (state: DownloadFailedEvent) => void) => Promise<PluginListenerHandle>
509
1366
  ```
510
1367
 
511
- Listen for download fail event in the App, let you know when download has fail finished
1368
+ Listen for download fail event in the App, let you know when a bundle download has failed
512
1369
 
513
- | Param | Type |
514
- | ------------------ | ------------------------------------------------------------------------- |
515
- | **`eventName`** | <code>'downloadFailed'</code> |
516
- | **`listenerFunc`** | <code><a href="#downloadfailedlistener">DownloadFailedListener</a></code> |
1370
+ | Param | Type |
1371
+ | ------------------ | --------------------------------------------------------------------------------------- |
1372
+ | **`eventName`** | <code>'downloadFailed'</code> |
1373
+ | **`listenerFunc`** | <code>(state: <a href="#downloadfailedevent">DownloadFailedEvent</a>) =&gt; void</code> |
517
1374
 
518
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1375
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
519
1376
 
520
1377
  **Since:** 4.0.0
521
1378
 
522
1379
  --------------------
523
1380
 
524
1381
 
525
- ### addListener('appReloaded', ...)
1382
+ #### addListener('appReloaded', ...)
526
1383
 
527
1384
  ```typescript
528
- addListener(eventName: "appReloaded", listenerFunc: AppReloadedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
1385
+ addListener(eventName: 'appReloaded', listenerFunc: () => void) => Promise<PluginListenerHandle>
529
1386
  ```
530
1387
 
531
- Listen for download fail event in the App, let you know when download has fail finished
1388
+ Listen for reload event in the App, let you know when reload has happened
532
1389
 
533
- | Param | Type |
534
- | ------------------ | ------------------------------------------------------------------- |
535
- | **`eventName`** | <code>'appReloaded'</code> |
536
- | **`listenerFunc`** | <code><a href="#appreloadedlistener">AppReloadedListener</a></code> |
1390
+ | Param | Type |
1391
+ | ------------------ | -------------------------- |
1392
+ | **`eventName`** | <code>'appReloaded'</code> |
1393
+ | **`listenerFunc`** | <code>() =&gt; void</code> |
537
1394
 
538
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
1395
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
539
1396
 
540
1397
  **Since:** 4.3.0
541
1398
 
542
1399
  --------------------
543
1400
 
544
1401
 
545
- ### getDeviceId()
1402
+ #### addListener('appReady', ...)
546
1403
 
547
1404
  ```typescript
548
- getDeviceId() => Promise<{ deviceId: string; }>
1405
+ addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void) => Promise<PluginListenerHandle>
549
1406
  ```
550
1407
 
551
- Get unique ID used to identify device (sent to auto update server)
1408
+ Listen for app ready event in the App, let you know when app is ready to use, this event is retain till consumed.
1409
+
1410
+ | Param | Type |
1411
+ | ------------------ | --------------------------------------------------------------------------- |
1412
+ | **`eventName`** | <code>'appReady'</code> |
1413
+ | **`listenerFunc`** | <code>(state: <a href="#appreadyevent">AppReadyEvent</a>) =&gt; void</code> |
1414
+
1415
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
552
1416
 
553
- **Returns:** <code>Promise&lt;{ deviceId: string; }&gt;</code>
1417
+ **Since:** 5.1.0
554
1418
 
555
1419
  --------------------
556
1420
 
557
1421
 
558
- ### getPluginVersion()
1422
+ #### addListener('channelPrivate', ...)
559
1423
 
560
1424
  ```typescript
561
- getPluginVersion() => Promise<{ version: string; }>
1425
+ addListener(eventName: 'channelPrivate', listenerFunc: (state: ChannelPrivateEvent) => void) => Promise<PluginListenerHandle>
562
1426
  ```
563
1427
 
564
- Get the native Capacitor Updater plugin version (sent to auto update server)
1428
+ Listen for channel private event, fired when attempting to set a channel that doesn't allow device self-assignment.
1429
+
1430
+ This event is useful for:
1431
+ - Informing users they don't have permission to switch to a specific channel
1432
+ - Implementing custom error handling for channel restrictions
1433
+ - Logging unauthorized channel access attempts
1434
+
1435
+ | Param | Type |
1436
+ | ------------------ | --------------------------------------------------------------------------------------- |
1437
+ | **`eventName`** | <code>'channelPrivate'</code> |
1438
+ | **`listenerFunc`** | <code>(state: <a href="#channelprivateevent">ChannelPrivateEvent</a>) =&gt; void</code> |
1439
+
1440
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
565
1441
 
566
- **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
1442
+ **Since:** 7.34.0
567
1443
 
568
1444
  --------------------
569
1445
 
570
1446
 
571
- ### isAutoUpdateEnabled()
1447
+ #### isAutoUpdateAvailable()
572
1448
 
573
1449
  ```typescript
574
- isAutoUpdateEnabled() => Promise<{ enabled: boolean; }>
1450
+ isAutoUpdateAvailable() => Promise<AutoUpdateAvailable>
575
1451
  ```
576
1452
 
577
- Get the state of auto update config. This will return `false` in manual mode.
1453
+ Check if the auto-update feature is available (not disabled by custom server configuration).
578
1454
 
579
- **Returns:** <code>Promise&lt;{ enabled: boolean; }&gt;</code>
1455
+ Returns `false` when a custom `updateUrl` is configured, as this typically indicates
1456
+ you're using a self-hosted update server that may not support all auto-update features.
1457
+
1458
+ Returns `true` when using the default Capgo backend or when the feature is available.
1459
+
1460
+ This is different from {@link isAutoUpdateEnabled}:
1461
+ - `isAutoUpdateEnabled()`: Checks if auto-update MODE is turned on/off
1462
+ - `isAutoUpdateAvailable()`: Checks if auto-update is SUPPORTED with your current configuration
1463
+
1464
+ **Returns:** <code>Promise&lt;<a href="#autoupdateavailable">AutoUpdateAvailable</a>&gt;</code>
580
1465
 
581
1466
  --------------------
582
1467
 
583
1468
 
584
- ### removeAllListeners()
1469
+ #### getNextBundle()
585
1470
 
586
1471
  ```typescript
587
- removeAllListeners() => Promise<void>
1472
+ getNextBundle() => Promise<BundleInfo | null>
588
1473
  ```
589
1474
 
590
- Remove all listeners for this plugin.
1475
+ Get information about the bundle queued to be activated on next reload.
591
1476
 
592
- **Since:** 1.0.0
1477
+ Returns:
1478
+ - {@link <a href="#bundleinfo">BundleInfo</a>} object if a bundle has been queued via {@link next}
1479
+ - `null` if no update is pending
1480
+
1481
+ This is useful to:
1482
+ - Check if an update is waiting to be applied
1483
+ - Display "Update pending" status to users
1484
+ - Show version info of the queued update
1485
+ - Decide whether to show a "Restart to update" prompt
1486
+
1487
+ The queued bundle will be activated when:
1488
+ - The app is backgrounded (default behavior)
1489
+ - The app is killed and restarted
1490
+ - {@link reload} is called manually
1491
+ - Delay conditions set by {@link setMultiDelay} are met
1492
+
1493
+ **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a> | null&gt;</code>
1494
+
1495
+ **Since:** 6.8.0
593
1496
 
594
1497
  --------------------
595
1498
 
596
1499
 
597
- ### Interfaces
1500
+ #### getFailedUpdate()
1501
+
1502
+ ```typescript
1503
+ getFailedUpdate() => Promise<UpdateFailedEvent | null>
1504
+ ```
1505
+
1506
+ Retrieve information about the most recent bundle that failed to load.
598
1507
 
1508
+ When a bundle fails to load (e.g., JavaScript errors prevent initialization, missing files),
1509
+ the plugin automatically rolls back and stores information about the failure. This method
1510
+ retrieves that failure information.
599
1511
 
600
- #### BundleInfo
1512
+ **IMPORTANT: The stored value is cleared after being retrieved once.**
1513
+ Calling this method multiple times will only return the failure info on the first call,
1514
+ then `null` on subsequent calls until another failure occurs.
1515
+
1516
+ Returns:
1517
+ - {@link <a href="#updatefailedevent">UpdateFailedEvent</a>} with bundle info if a failure was recorded
1518
+ - `null` if no failure has occurred or if it was already retrieved
1519
+
1520
+ Use this to:
1521
+ - Show users why an update failed
1522
+ - Log failure information for debugging
1523
+ - Implement custom error handling/reporting
1524
+ - Display rollback notifications
1525
+
1526
+ **Returns:** <code>Promise&lt;<a href="#updatefailedevent">UpdateFailedEvent</a> | null&gt;</code>
1527
+
1528
+ **Since:** 7.22.0
1529
+
1530
+ --------------------
1531
+
1532
+
1533
+ #### setShakeMenu(...)
1534
+
1535
+ ```typescript
1536
+ setShakeMenu(options: SetShakeMenuOptions) => Promise<void>
1537
+ ```
1538
+
1539
+ Enable or disable the shake gesture menu for debugging and testing.
1540
+
1541
+ When enabled, users can shake their device to open a debug menu that shows:
1542
+ - Current bundle information
1543
+ - Available bundles
1544
+ - Options to switch bundles manually
1545
+ - Update status
1546
+
1547
+ This is useful during development and testing to:
1548
+ - Quickly test different bundle versions
1549
+ - Debug update flows
1550
+ - Switch between production and test bundles
1551
+ - Verify bundle installations
1552
+
1553
+ **Important:** Disable this in production builds or only enable for internal testers.
1554
+
1555
+ Can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
1556
+
1557
+ | Param | Type |
1558
+ | ------------- | ------------------------------------------------------------------- |
1559
+ | **`options`** | <code><a href="#setshakemenuoptions">SetShakeMenuOptions</a></code> |
1560
+
1561
+ **Since:** 7.5.0
1562
+
1563
+ --------------------
1564
+
1565
+
1566
+ #### isShakeMenuEnabled()
1567
+
1568
+ ```typescript
1569
+ isShakeMenuEnabled() => Promise<ShakeMenuEnabled>
1570
+ ```
1571
+
1572
+ Check if the shake gesture debug menu is currently enabled.
1573
+
1574
+ Returns the current state of the shake menu feature that can be toggled via
1575
+ {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
1576
+
1577
+ Use this to:
1578
+ - Check if debug features are enabled
1579
+ - Show/hide debug settings UI
1580
+ - Verify configuration during testing
1581
+
1582
+ **Returns:** <code>Promise&lt;<a href="#shakemenuenabled">ShakeMenuEnabled</a>&gt;</code>
1583
+
1584
+ **Since:** 7.5.0
1585
+
1586
+ --------------------
1587
+
1588
+
1589
+ #### getAppId()
1590
+
1591
+ ```typescript
1592
+ getAppId() => Promise<GetAppIdRes>
1593
+ ```
1594
+
1595
+ Get the currently configured App ID used for update server communication.
1596
+
1597
+ Returns the App ID that identifies this app to the update server. This can be:
1598
+ - The value set via {@link setAppId}, or
1599
+ - The {@link PluginsConfig.CapacitorUpdater.appId} config value, or
1600
+ - The default app identifier from your native app configuration
1601
+
1602
+ Use this to:
1603
+ - Verify which App ID is being used for updates
1604
+ - Debug update delivery issues
1605
+ - Display app configuration in debug screens
1606
+ - Confirm App ID after calling {@link setAppId}
1607
+
1608
+ **Returns:** <code>Promise&lt;<a href="#getappidres">GetAppIdRes</a>&gt;</code>
1609
+
1610
+ **Since:** 7.14.0
1611
+
1612
+ --------------------
1613
+
1614
+
1615
+ #### setAppId(...)
1616
+
1617
+ ```typescript
1618
+ setAppId(options: SetAppIdOptions) => Promise<void>
1619
+ ```
1620
+
1621
+ Dynamically change the App ID used for update server communication.
1622
+
1623
+ This overrides the App ID used to identify your app to the update server, allowing you
1624
+ to switch between different app configurations at runtime (e.g., production vs staging
1625
+ app IDs, or multi-tenant configurations).
1626
+
1627
+ **Requirements:**
1628
+ - {@link PluginsConfig.CapacitorUpdater.allowModifyAppId} must be set to `true`
1629
+
1630
+ **Important considerations:**
1631
+ - Changing the App ID will affect which updates this device receives
1632
+ - The new App ID must exist on your update server
1633
+ - This is primarily for advanced use cases (multi-tenancy, environment switching)
1634
+ - Most apps should use the config-based {@link PluginsConfig.CapacitorUpdater.appId} instead
1635
+
1636
+ | Param | Type |
1637
+ | ------------- | ----------------------------------------------------------- |
1638
+ | **`options`** | <code><a href="#setappidoptions">SetAppIdOptions</a></code> |
1639
+
1640
+ **Since:** 7.14.0
1641
+
1642
+ --------------------
1643
+
1644
+
1645
+ #### Interfaces
1646
+
1647
+
1648
+ ##### AppReadyResult
1649
+
1650
+ | Prop | Type |
1651
+ | ------------ | ------------------------------------------------- |
1652
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> |
1653
+
1654
+
1655
+ ##### BundleInfo
601
1656
 
602
1657
  | Prop | Type |
603
1658
  | ---------------- | ----------------------------------------------------- |
@@ -608,7 +1663,94 @@ Remove all listeners for this plugin.
608
1663
  | **`status`** | <code><a href="#bundlestatus">BundleStatus</a></code> |
609
1664
 
610
1665
 
611
- #### DelayCondition
1666
+ ##### UpdateUrl
1667
+
1668
+ | Prop | Type |
1669
+ | --------- | ------------------- |
1670
+ | **`url`** | <code>string</code> |
1671
+
1672
+
1673
+ ##### StatsUrl
1674
+
1675
+ | Prop | Type |
1676
+ | --------- | ------------------- |
1677
+ | **`url`** | <code>string</code> |
1678
+
1679
+
1680
+ ##### ChannelUrl
1681
+
1682
+ | Prop | Type |
1683
+ | --------- | ------------------- |
1684
+ | **`url`** | <code>string</code> |
1685
+
1686
+
1687
+ ##### DownloadOptions
1688
+
1689
+ 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.
1690
+ 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.
1691
+
1692
+ | Prop | Type | Description | Default | Since |
1693
+ | ---------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- |
1694
+ | **`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.) | | |
1695
+ | **`version`** | <code>string</code> | The version code/name of this bundle/version | | |
1696
+ | **`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 |
1697
+ | **`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 |
1698
+ | **`manifest`** | <code>ManifestEntry[]</code> | The manifest for multi-file downloads | <code>undefined</code> | 6.1.0 |
1699
+
1700
+
1701
+ ##### ManifestEntry
1702
+
1703
+ | Prop | Type |
1704
+ | ------------------ | --------------------------- |
1705
+ | **`file_name`** | <code>string \| null</code> |
1706
+ | **`file_hash`** | <code>string \| null</code> |
1707
+ | **`download_url`** | <code>string \| null</code> |
1708
+
1709
+
1710
+ ##### BundleId
1711
+
1712
+ | Prop | Type |
1713
+ | -------- | ------------------- |
1714
+ | **`id`** | <code>string</code> |
1715
+
1716
+
1717
+ ##### BundleListResult
1718
+
1719
+ | Prop | Type |
1720
+ | ------------- | ------------------------- |
1721
+ | **`bundles`** | <code>BundleInfo[]</code> |
1722
+
1723
+
1724
+ ##### ListOptions
1725
+
1726
+ | Prop | Type | Description | Default | Since |
1727
+ | --------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ------ |
1728
+ | **`raw`** | <code>boolean</code> | Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk. | <code>false</code> | 6.14.0 |
1729
+
1730
+
1731
+ ##### ResetOptions
1732
+
1733
+ | Prop | Type |
1734
+ | ---------------------- | -------------------- |
1735
+ | **`toLastSuccessful`** | <code>boolean</code> |
1736
+
1737
+
1738
+ ##### CurrentBundleResult
1739
+
1740
+ | Prop | Type |
1741
+ | ------------ | ------------------------------------------------- |
1742
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> |
1743
+ | **`native`** | <code>string</code> |
1744
+
1745
+
1746
+ ##### MultiDelayConditions
1747
+
1748
+ | Prop | Type |
1749
+ | --------------------- | ----------------------------- |
1750
+ | **`delayConditions`** | <code>DelayCondition[]</code> |
1751
+
1752
+
1753
+ ##### DelayCondition
612
1754
 
613
1755
  | Prop | Type | Description |
614
1756
  | ----------- | --------------------------------------------------------- | ---------------------------------------- |
@@ -616,61 +1758,126 @@ Remove all listeners for this plugin.
616
1758
  | **`value`** | <code>string</code> | |
617
1759
 
618
1760
 
619
- #### latestVersion
1761
+ ##### LatestVersion
1762
+
1763
+ | Prop | Type | Description | Since |
1764
+ | ---------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
1765
+ | **`version`** | <code>string</code> | Result of getLatest method | 4.0.0 |
1766
+ | **`checksum`** | <code>string</code> | | 6 |
1767
+ | **`breaking`** | <code>boolean</code> | Indicates whether the update was flagged as breaking by the backend. | 7.22.0 |
1768
+ | **`major`** | <code>boolean</code> | | |
1769
+ | **`message`** | <code>string</code> | Optional message from the server. When no new version is available, this will be "No new version available". | |
1770
+ | **`sessionKey`** | <code>string</code> | | |
1771
+ | **`error`** | <code>string</code> | Error code from the server, if any. Common values: - `"no_new_version_available"`: Device is already on the latest version (not a failure) - Other error codes indicate actual failures in the update process | |
1772
+ | **`old`** | <code>string</code> | The previous/current version name (provided for reference). | |
1773
+ | **`url`** | <code>string</code> | Download URL for the bundle (when a new version is available). | |
1774
+ | **`manifest`** | <code>ManifestEntry[]</code> | File list for partial updates (when using multi-file downloads). | 6.1 |
1775
+ | **`link`** | <code>string</code> | Optional link associated with this bundle version (e.g., release notes URL, changelog, GitHub release). | 7.35.0 |
1776
+ | **`comment`** | <code>string</code> | Optional comment or description for this bundle version. | 7.35.0 |
1777
+
1778
+
1779
+ ##### GetLatestOptions
620
1780
 
621
- | Prop | Type | Description | Since |
622
- | ---------------- | -------------------- | ----------------------- | ----- |
623
- | **`version`** | <code>string</code> | Res of getLatest method | 4.0.0 |
624
- | **`major`** | <code>boolean</code> | | |
625
- | **`message`** | <code>string</code> | | |
626
- | **`sessionKey`** | <code>string</code> | | |
627
- | **`error`** | <code>string</code> | | |
628
- | **`old`** | <code>string</code> | | |
629
- | **`url`** | <code>string</code> | | |
1781
+ | Prop | Type | Description | Default | Since |
1782
+ | ------------- | ------------------- | ----------------------------------------------------------------------------------------------- | ---------------------- | ----- |
1783
+ | **`channel`** | <code>string</code> | The channel to get the latest version for The channel must allow 'self_assign' for this to work | <code>undefined</code> | 6.8.0 |
630
1784
 
631
1785
 
632
- #### channelRes
1786
+ ##### ChannelRes
633
1787
 
634
1788
  | Prop | Type | Description | Since |
635
1789
  | ------------- | ------------------- | ----------------------------- | ----- |
636
1790
  | **`status`** | <code>string</code> | Current status of set channel | 4.7.0 |
637
- | **`error`** | <code>any</code> | | |
638
- | **`message`** | <code>any</code> | | |
1791
+ | **`error`** | <code>string</code> | | |
1792
+ | **`message`** | <code>string</code> | | |
639
1793
 
640
1794
 
641
- #### SetChannelOptions
1795
+ ##### SetChannelOptions
1796
+
1797
+ | Prop | Type |
1798
+ | ----------------------- | -------------------- |
1799
+ | **`channel`** | <code>string</code> |
1800
+ | **`triggerAutoUpdate`** | <code>boolean</code> |
642
1801
 
643
- | Prop | Type |
644
- | ------------- | ------------------- |
645
- | **`channel`** | <code>string</code> |
646
1802
 
1803
+ ##### UnsetChannelOptions
647
1804
 
648
- #### getChannelRes
1805
+ | Prop | Type |
1806
+ | ----------------------- | -------------------- |
1807
+ | **`triggerAutoUpdate`** | <code>boolean</code> |
1808
+
1809
+
1810
+ ##### GetChannelRes
649
1811
 
650
1812
  | Prop | Type | Description | Since |
651
1813
  | -------------- | -------------------- | ----------------------------- | ----- |
652
1814
  | **`channel`** | <code>string</code> | Current status of get channel | 4.8.0 |
653
- | **`error`** | <code>any</code> | | |
654
- | **`message`** | <code>any</code> | | |
1815
+ | **`error`** | <code>string</code> | | |
1816
+ | **`message`** | <code>string</code> | | |
655
1817
  | **`status`** | <code>string</code> | | |
656
1818
  | **`allowSet`** | <code>boolean</code> | | |
657
1819
 
658
1820
 
659
- #### SetCustomIdOptions
1821
+ ##### ListChannelsResult
1822
+
1823
+ | Prop | Type | Description | Since |
1824
+ | -------------- | -------------------------- | -------------------------- | ----- |
1825
+ | **`channels`** | <code>ChannelInfo[]</code> | List of available channels | 7.5.0 |
1826
+
1827
+
1828
+ ##### ChannelInfo
1829
+
1830
+ | Prop | Type | Description | Since |
1831
+ | -------------------- | -------------------- | ----------------------------------------------- | ----- |
1832
+ | **`id`** | <code>string</code> | The channel ID | 7.5.0 |
1833
+ | **`name`** | <code>string</code> | The channel name | 7.5.0 |
1834
+ | **`public`** | <code>boolean</code> | Whether this is a public channel | 7.5.0 |
1835
+ | **`allow_self_set`** | <code>boolean</code> | Whether devices can self-assign to this channel | 7.5.0 |
1836
+
1837
+
1838
+ ##### SetCustomIdOptions
1839
+
1840
+ | Prop | Type | Description |
1841
+ | -------------- | ------------------- | --------------------------------------------------------------------------------------------- |
1842
+ | **`customId`** | <code>string</code> | Custom identifier to associate with the device. Use an empty string to clear any saved value. |
1843
+
1844
+
1845
+ ##### BuiltinVersion
1846
+
1847
+ | Prop | Type |
1848
+ | ------------- | ------------------- |
1849
+ | **`version`** | <code>string</code> |
1850
+
1851
+
1852
+ ##### DeviceId
660
1853
 
661
1854
  | Prop | Type |
662
1855
  | -------------- | ------------------- |
663
- | **`customId`** | <code>string</code> |
1856
+ | **`deviceId`** | <code>string</code> |
664
1857
 
665
1858
 
666
- #### PluginListenerHandle
1859
+ ##### PluginVersion
1860
+
1861
+ | Prop | Type |
1862
+ | ------------- | ------------------- |
1863
+ | **`version`** | <code>string</code> |
1864
+
1865
+
1866
+ ##### AutoUpdateEnabled
1867
+
1868
+ | Prop | Type |
1869
+ | ------------- | -------------------- |
1870
+ | **`enabled`** | <code>boolean</code> |
1871
+
1872
+
1873
+ ##### PluginListenerHandle
667
1874
 
668
1875
  | Prop | Type |
669
1876
  | ------------ | ----------------------------------------- |
670
1877
  | **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
671
1878
 
672
1879
 
673
- #### DownloadEvent
1880
+ ##### DownloadEvent
674
1881
 
675
1882
  | Prop | Type | Description | Since |
676
1883
  | ------------- | ------------------------------------------------- | ---------------------------------------------- | ----- |
@@ -678,99 +1885,122 @@ Remove all listeners for this plugin.
678
1885
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | | |
679
1886
 
680
1887
 
681
- #### noNeedEvent
1888
+ ##### NoNeedEvent
682
1889
 
683
1890
  | Prop | Type | Description | Since |
684
1891
  | ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
685
1892
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current status of download, between 0 and 100. | 4.0.0 |
686
1893
 
687
1894
 
688
- #### updateAvailableEvent
1895
+ ##### UpdateAvailableEvent
689
1896
 
690
1897
  | Prop | Type | Description | Since |
691
1898
  | ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
692
1899
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current status of download, between 0 and 100. | 4.0.0 |
693
1900
 
694
1901
 
695
- #### DownloadCompleteEvent
1902
+ ##### DownloadCompleteEvent
696
1903
 
697
1904
  | Prop | Type | Description | Since |
698
1905
  | ------------ | ------------------------------------------------- | ------------------------------------ | ----- |
699
1906
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a new update is available. | 4.0.0 |
700
1907
 
701
1908
 
702
- #### MajorAvailableEvent
1909
+ ##### MajorAvailableEvent
703
1910
 
704
- | Prop | Type | Description | Since |
705
- | ------------- | ------------------- | ------------------------------------------ | ----- |
706
- | **`version`** | <code>string</code> | Emit when a new major bundle is available. | 4.0.0 |
1911
+ | Prop | Type | Description | Since |
1912
+ | ------------- | ------------------- | ----------------------------------------- | ----- |
1913
+ | **`version`** | <code>string</code> | Emit when a breaking update is available. | 4.0.0 |
707
1914
 
708
1915
 
709
- #### UpdateFailedEvent
1916
+ ##### UpdateFailedEvent
710
1917
 
711
1918
  | Prop | Type | Description | Since |
712
1919
  | ------------ | ------------------------------------------------- | ------------------------------------- | ----- |
713
1920
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a update failed to install. | 4.0.0 |
714
1921
 
715
1922
 
716
- #### DownloadFailedEvent
1923
+ ##### DownloadFailedEvent
717
1924
 
718
1925
  | Prop | Type | Description | Since |
719
1926
  | ------------- | ------------------- | -------------------------- | ----- |
720
1927
  | **`version`** | <code>string</code> | Emit when a download fail. | 4.0.0 |
721
1928
 
722
1929
 
723
- ### Type Aliases
1930
+ ##### AppReadyEvent
1931
+
1932
+ | Prop | Type | Description | Since |
1933
+ | ------------ | ------------------------------------------------- | ------------------------------------- | ----- |
1934
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emitted when the app is ready to use. | 5.2.0 |
1935
+ | **`status`** | <code>string</code> | | |
1936
+
724
1937
 
1938
+ ##### ChannelPrivateEvent
725
1939
 
726
- #### BundleStatus
1940
+ | Prop | Type | Description | Since |
1941
+ | ------------- | ------------------- | ----------------------------------------------------------------------------------- | ------ |
1942
+ | **`channel`** | <code>string</code> | Emitted when attempting to set a channel that doesn't allow device self-assignment. | 7.34.0 |
1943
+ | **`message`** | <code>string</code> | | |
727
1944
 
728
- <code>"success" | "error" | "pending" | "downloading"</code>
729
1945
 
1946
+ ##### AutoUpdateAvailable
730
1947
 
731
- #### DelayUntilNext
1948
+ | Prop | Type |
1949
+ | --------------- | -------------------- |
1950
+ | **`available`** | <code>boolean</code> |
732
1951
 
733
- <code>"background" | "kill" | "nativeVersion" | "date"</code>
734
1952
 
1953
+ ##### SetShakeMenuOptions
735
1954
 
736
- #### DownloadChangeListener
1955
+ | Prop | Type |
1956
+ | ------------- | -------------------- |
1957
+ | **`enabled`** | <code>boolean</code> |
737
1958
 
738
- <code>(state: <a href="#downloadevent">DownloadEvent</a>): void</code>
739
1959
 
1960
+ ##### ShakeMenuEnabled
740
1961
 
741
- #### NoNeedListener
1962
+ | Prop | Type |
1963
+ | ------------- | -------------------- |
1964
+ | **`enabled`** | <code>boolean</code> |
742
1965
 
743
- <code>(state: <a href="#noneedevent">noNeedEvent</a>): void</code>
744
1966
 
1967
+ ##### GetAppIdRes
745
1968
 
746
- #### UpdateAvailabledListener
1969
+ | Prop | Type |
1970
+ | ----------- | ------------------- |
1971
+ | **`appId`** | <code>string</code> |
747
1972
 
748
- <code>(state: <a href="#updateavailableevent">updateAvailableEvent</a>): void</code>
749
1973
 
1974
+ ##### SetAppIdOptions
750
1975
 
751
- #### DownloadCompleteListener
1976
+ | Prop | Type |
1977
+ | ----------- | ------------------- |
1978
+ | **`appId`** | <code>string</code> |
752
1979
 
753
- <code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>): void</code>
754
1980
 
1981
+ #### Type Aliases
755
1982
 
756
- #### MajorAvailableListener
757
1983
 
758
- <code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>): void</code>
1984
+ ##### BundleStatus
759
1985
 
1986
+ pending: The bundle is pending to be **SET** as the next bundle.
1987
+ downloading: The bundle is being downloaded.
1988
+ success: The bundle has been downloaded and is ready to be **SET** as the next bundle.
1989
+ error: The bundle has failed to download.
760
1990
 
761
- #### UpdateFailedListener
1991
+ <code>'success' | 'error' | 'pending' | 'downloading'</code>
762
1992
 
763
- <code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>): void</code>
764
1993
 
1994
+ ##### DelayUntilNext
765
1995
 
766
- #### DownloadFailedListener
1996
+ <code>'background' | 'kill' | 'nativeVersion' | 'date'</code>
767
1997
 
768
- <code>(state: <a href="#downloadfailedevent">DownloadFailedEvent</a>): void</code>
769
1998
 
1999
+ ##### BreakingAvailableEvent
770
2000
 
771
- #### AppReloadedListener
2001
+ Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with `breakingAvailable`.
772
2002
 
773
- <code>(state: void): void</code>
2003
+ <code><a href="#majoravailableevent">MajorAvailableEvent</a></code>
774
2004
 
775
2005
  </docgen-api>
776
2006
 
@@ -794,4 +2024,4 @@ On iOS, Apple don't allow you to show a message when the app is updated, so you
794
2024
 
795
2025
  ### Contributors
796
2026
 
797
- [jamesyoung1337](https://github.com/jamesyoung1337) Thanks a lot for your guidance and support, it was impossible to make this plugin work without you.
2027
+ [jamesyoung1337](https://github.com/jamesyoung1337) Thank you so much for your guidance and support, it was impossible to make this plugin work without you.