@capgo/capacitor-updater 8.0.0 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CapgoCapacitorUpdater.podspec +2 -2
  2. package/Package.swift +35 -0
  3. package/README.md +667 -206
  4. package/android/build.gradle +16 -11
  5. package/android/proguard-rules.pro +28 -0
  6. package/android/src/main/AndroidManifest.xml +0 -1
  7. package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +134 -194
  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/CapacitorUpdater.java +967 -1027
  11. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1283 -1180
  12. package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipherV2.java +276 -0
  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 +45 -48
  15. package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +4 -4
  16. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +440 -113
  17. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +101 -0
  18. package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +32 -0
  19. package/dist/docs.json +1316 -473
  20. package/dist/esm/definitions.d.ts +518 -248
  21. package/dist/esm/definitions.js.map +1 -1
  22. package/dist/esm/index.d.ts +2 -2
  23. package/dist/esm/index.js +4 -4
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/web.d.ts +25 -41
  26. package/dist/esm/web.js +67 -35
  27. package/dist/esm/web.js.map +1 -1
  28. package/dist/plugin.cjs.js +67 -35
  29. package/dist/plugin.cjs.js.map +1 -1
  30. package/dist/plugin.js +67 -35
  31. package/dist/plugin.js.map +1 -1
  32. package/ios/Plugin/CapacitorUpdater.swift +736 -361
  33. package/ios/Plugin/CapacitorUpdaterPlugin.swift +436 -136
  34. package/ios/Plugin/CryptoCipherV2.swift +310 -0
  35. package/ios/Plugin/InternalUtils.swift +258 -0
  36. package/package.json +33 -29
  37. package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +0 -153
  38. package/ios/Plugin/CapacitorUpdaterPlugin.h +0 -10
  39. package/ios/Plugin/CapacitorUpdaterPlugin.m +0 -27
  40. package/ios/Plugin/CryptoCipher.swift +0 -240
package/README.md CHANGED
@@ -15,11 +15,16 @@
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
+ <div align="center">
19
+ <h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo 🚀</a></h2>
20
+ <h2><a href="https://capgo.app/consulting/?ref=plugin"> Fix your annoying bug now, Hire a Capacitor expert 💪</a></h2>
21
+ </div>
22
+
18
23
  Update Ionic Capacitor apps without App/Play Store review (Code-push / hot-code updates).
19
24
 
20
25
  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
26
+ - Use [capgo.app](https://capgo.app) a full featured auto-update system in 5 min Setup, to manage version, update, revert and see stats.
27
+ - Use your own server update with auto-update system
23
28
  - Use manual methods to zip, upload, download, from JS to do it when you want.
24
29
 
25
30
 
@@ -27,7 +32,52 @@ You have 3 ways possible :
27
32
  Join the [discord](https://discord.gg/VnYRvBfgA6) to get help.
28
33
 
29
34
  ## Documentation
30
- I maintain a more user friendly and complete [documentation here](https://docs.capgo.app/).
35
+ I maintain a more user-friendly and complete [documentation here](https://capgo.app/docs/).
36
+
37
+ ## Migration to v7
38
+
39
+ - `privateKey` is not available anymore, it was used for the old encryption method. to migrate foolow this guide : [https://capgo.app/docs/plugin/cloud-mode/getting-started/](https://capgo.app/docs/cli/migrations/encryption/)
40
+ - To capacitor v7 : [https://capacitorjs.com/docs/updating/7-0](https://capacitorjs.com/docs/updating/7-0)
41
+
42
+ ## Compatibility
43
+
44
+ | Plugin version | Capacitor compatibility | Maintained |
45
+ | -------------- | ----------------------- | ----------------- |
46
+ | v7.\*.\* | v7.\*.\* | ✅ |
47
+ | v6.\*.\* | v6.\*.\* | Critical bug only |
48
+ | v5.\*.\* | v5.\*.\* | Critical bug only |
49
+ | v4.\*.\* | v4.\*.\* | ⚠️ Deprecated |
50
+ | v3.\*.\* | v3.\*.\* | ⚠️ Deprecated |
51
+ | > 7 | v4.\*.\* | ⚠️ Deprecated, our CI got crazy and bumped too much version |
52
+
53
+ ### iOS
54
+
55
+ #### Privacy manifest
56
+
57
+ Add the `NSPrivacyAccessedAPICategoryUserDefaults` dictionary key to your [Privacy Manifest](https://capacitorjs.com/docs/ios/privacy-manifest) (usually `ios/App/PrivacyInfo.xcprivacy`):
58
+
59
+ ```xml
60
+ <?xml version="1.0" encoding="UTF-8"?>
61
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
62
+ <plist version="1.0">
63
+ <dict>
64
+ <key>NSPrivacyAccessedAPITypes</key>
65
+ <array>
66
+ <!-- Add this dict entry to the array if the file already exists. -->
67
+ <dict>
68
+ <key>NSPrivacyAccessedAPIType</key>
69
+ <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
70
+ <key>NSPrivacyAccessedAPITypeReasons</key>
71
+ <array>
72
+ <string>CA92.1</string>
73
+ </array>
74
+ </dict>
75
+ </array>
76
+ </dict>
77
+ </plist>
78
+ ```
79
+
80
+ 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
81
 
32
82
  ## Installation
33
83
 
@@ -38,16 +88,16 @@ npx cap sync
38
88
 
39
89
  ## Auto-update setup
40
90
 
41
- Create your account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/app/apikeys)
91
+ Create your account in [capgo.app](https://capgo.app) and get your [API key](https://web.capgo.app/dashboard/apikeys)
42
92
  - Login to CLI `npx @capgo/cli@latest init API_KEY`
43
93
  And follow the steps by step to setup your app.
44
94
 
45
- See more there in the [Auto update documentation](https://docs.capgo.app/plugin/auto-update).
95
+ For detailed instructions on the auto-update setup, refer to the [Auto update documentation](https://capgo.app/docs/plugin/cloud-mode/getting-started/).
46
96
 
47
97
 
48
98
  ## Manual setup
49
99
 
50
- Download update distribution zipfiles from a custom url. Manually control the entire update process.
100
+ Download update distribution zipfiles from a custom URL. Manually control the entire update process.
51
101
 
52
102
  - Edit your `capacitor.config.json` like below, set `autoUpdate` to false.
53
103
  ```json
@@ -67,7 +117,7 @@ Download update distribution zipfiles from a custom url. Manually control the en
67
117
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
68
118
  CapacitorUpdater.notifyAppReady()
69
119
  ```
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).
120
+ This informs Capacitor Updater 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).
71
121
  - Add this to your application.
72
122
  ```javascript
73
123
  const version = await CapacitorUpdater.download({
@@ -106,47 +156,199 @@ You might also consider performing auto-update when application state changes, a
106
156
 
107
157
  ```
108
158
 
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.
159
+ 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.
160
+
161
+ ### Store Guideline Compliance
162
+
163
+ 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.
164
+
165
+ #### Google play
166
+
167
+ 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.
168
+ > 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).
169
+
170
+ That fully allow Capacitor-updater as it updates just JS bundles and can't update native code part.
171
+
172
+ #### App Store
173
+
174
+ 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.
175
+
176
+ And in its latest version (20170605) [downloadable here](https://developer.apple.com/terms/) this ruling is even broader:
177
+
178
+ > Interpreted code may be downloaded to an Application, but only so long as such code:
179
+ - (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
180
+ - (b) does not create a store or storefront for other code or applications
181
+ - (c) does not bypass signing, sandbox, or other security features of the OS.
182
+
183
+ 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.
184
+
185
+ 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:
186
+
187
+ > 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.
188
+
189
+ 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
190
 
111
191
  ### Packaging `dist.zip` update bundles
112
192
 
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:
193
+ 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
194
 
115
195
  - 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
196
  - Do not password encrypt the bundle zip file, or it will fail to unpack.
117
197
  - Make sure the bundle does not contain any extra hidden files or folders, or it may fail to unpack.
118
198
 
199
+ ## Updater Plugin Config
200
+
201
+ <docgen-config>
202
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
203
+
204
+ CapacitorUpdater can be configured with these options:
205
+
206
+ | Prop | Type | Description | Default | Since |
207
+ | ---------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ------- |
208
+ | **`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> | |
209
+ | **`responseTimeout`** | <code>number</code> | Configure the number of milliseconds the native plugin should wait before considering API timeout. Only available for Android and iOS. | <code>20 // (20 second)</code> | |
210
+ | **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS. | <code>true</code> | |
211
+ | **`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> | |
212
+ | **`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> | |
213
+ | **`resetWhenUpdate`** | <code>boolean</code> | Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device. Only available for Android and iOS. | <code>true</code> | |
214
+ | **`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> | |
215
+ | **`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> | |
216
+ | **`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> | |
217
+ | **`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 |
218
+ | **`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 |
219
+ | **`directUpdate`** | <code>boolean</code> | Make the plugin direct install the update when the app what just updated/installed. Only for autoUpdate mode. Only available for Android and iOS. | <code>undefined</code> | 5.1.0 |
220
+ | **`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>600 // (10 minutes)</code> | |
221
+ | **`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 |
222
+ | **`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 |
223
+ | **`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 |
224
+ | **`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 |
225
+ | **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing. | <code>undefined</code> | 4.17.48 |
226
+ | **`localApi`** | <code>string</code> | Configure the CLI to use a local api for testing. | <code>undefined</code> | 6.3.3 |
227
+ | **`localApiFiles`** | <code>string</code> | Configure the CLI to use a local file api for testing. | <code>undefined</code> | 6.3.3 |
228
+ | **`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 |
229
+ | **`defaultChannel`** | <code>string</code> | Set the default channel for the app in the config. | <code>undefined</code> | 5.5.0 |
230
+ | **`appId`** | <code>string</code> | Configure the app id for the app in the config. | <code>undefined</code> | 6.0.0 |
231
+ | **`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 |
232
+
233
+ ### Examples
234
+
235
+ In `capacitor.config.json`:
236
+
237
+ ```json
238
+ {
239
+ "plugins": {
240
+ "CapacitorUpdater": {
241
+ "appReadyTimeout": 1000 // (1 second),
242
+ "responseTimeout": 10 // (10 second),
243
+ "autoDeleteFailed": false,
244
+ "autoDeletePrevious": false,
245
+ "autoUpdate": false,
246
+ "resetWhenUpdate": false,
247
+ "updateUrl": https://example.com/api/auto_update,
248
+ "channelUrl": https://example.com/api/channel,
249
+ "statsUrl": https://example.com/api/stats,
250
+ "publicKey": undefined,
251
+ "version": undefined,
252
+ "directUpdate": undefined,
253
+ "periodCheckDelay": undefined,
254
+ "localS3": undefined,
255
+ "localHost": undefined,
256
+ "localWebHost": undefined,
257
+ "localSupa": undefined,
258
+ "localSupaAnon": undefined,
259
+ "localApi": undefined,
260
+ "localApiFiles": undefined,
261
+ "allowModifyUrl": undefined,
262
+ "defaultChannel": undefined,
263
+ "appId": undefined,
264
+ "keepUrlPathAfterReload": undefined
265
+ }
266
+ }
267
+ }
268
+ ```
269
+
270
+ In `capacitor.config.ts`:
271
+
272
+ ```ts
273
+ /// <reference types="@capgo/capacitor-updater" />
274
+
275
+ import { CapacitorConfig } from '@capacitor/cli';
276
+
277
+ const config: CapacitorConfig = {
278
+ plugins: {
279
+ CapacitorUpdater: {
280
+ appReadyTimeout: 1000 // (1 second),
281
+ responseTimeout: 10 // (10 second),
282
+ autoDeleteFailed: false,
283
+ autoDeletePrevious: false,
284
+ autoUpdate: false,
285
+ resetWhenUpdate: false,
286
+ updateUrl: https://example.com/api/auto_update,
287
+ channelUrl: https://example.com/api/channel,
288
+ statsUrl: https://example.com/api/stats,
289
+ publicKey: undefined,
290
+ version: undefined,
291
+ directUpdate: undefined,
292
+ periodCheckDelay: undefined,
293
+ localS3: undefined,
294
+ localHost: undefined,
295
+ localWebHost: undefined,
296
+ localSupa: undefined,
297
+ localSupaAnon: undefined,
298
+ localApi: undefined,
299
+ localApiFiles: undefined,
300
+ allowModifyUrl: undefined,
301
+ defaultChannel: undefined,
302
+ appId: undefined,
303
+ keepUrlPathAfterReload: undefined,
304
+ },
305
+ },
306
+ };
307
+
308
+ export default config;
309
+ ```
310
+
311
+ </docgen-config>
312
+
119
313
  ## API
120
314
 
121
315
  <docgen-index>
122
316
 
123
317
  * [`notifyAppReady()`](#notifyappready)
318
+ * [`setUpdateUrl(...)`](#setupdateurl)
319
+ * [`setStatsUrl(...)`](#setstatsurl)
320
+ * [`setChannelUrl(...)`](#setchannelurl)
124
321
  * [`download(...)`](#download)
125
322
  * [`next(...)`](#next)
126
323
  * [`set(...)`](#set)
127
324
  * [`delete(...)`](#delete)
128
- * [`list()`](#list)
325
+ * [`list(...)`](#list)
129
326
  * [`reset(...)`](#reset)
130
327
  * [`current()`](#current)
131
328
  * [`reload()`](#reload)
132
329
  * [`setMultiDelay(...)`](#setmultidelay)
133
330
  * [`cancelDelay()`](#canceldelay)
134
- * [`getLatest()`](#getlatest)
331
+ * [`getLatest(...)`](#getlatest)
135
332
  * [`setChannel(...)`](#setchannel)
333
+ * [`unsetChannel(...)`](#unsetchannel)
136
334
  * [`getChannel()`](#getchannel)
137
335
  * [`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)
336
+ * [`getBuiltinVersion()`](#getbuiltinversion)
146
337
  * [`getDeviceId()`](#getdeviceid)
147
338
  * [`getPluginVersion()`](#getpluginversion)
148
339
  * [`isAutoUpdateEnabled()`](#isautoupdateenabled)
149
340
  * [`removeAllListeners()`](#removealllisteners)
341
+ * [`addListener('download', ...)`](#addlistenerdownload-)
342
+ * [`addListener('noNeedUpdate', ...)`](#addlistenernoneedupdate-)
343
+ * [`addListener('updateAvailable', ...)`](#addlistenerupdateavailable-)
344
+ * [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete-)
345
+ * [`addListener('majorAvailable', ...)`](#addlistenermajoravailable-)
346
+ * [`addListener('updateFailed', ...)`](#addlistenerupdatefailed-)
347
+ * [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed-)
348
+ * [`addListener('appReloaded', ...)`](#addlistenerappreloaded-)
349
+ * [`addListener('appReady', ...)`](#addlistenerappready-)
350
+ * [`isAutoUpdateAvailable()`](#isautoupdateavailable)
351
+ * [`getNextBundle()`](#getnextbundle)
150
352
  * [Interfaces](#interfaces)
151
353
  * [Type Aliases](#type-aliases)
152
354
 
@@ -158,14 +360,65 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
158
360
  ### notifyAppReady()
159
361
 
160
362
  ```typescript
161
- notifyAppReady() => Promise<BundleInfo>
363
+ notifyAppReady() => Promise<AppReadyResult>
162
364
  ```
163
365
 
164
- Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
366
+ Notify Capacitor Updater that the current bundle is working (a rollback will occur if this method is not called on every app launch)
165
367
  By default this method should be called in the first 10 sec after app launch, otherwise a rollback will occur.
166
368
  Change this behaviour with {@link appReadyTimeout}
167
369
 
168
- **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
370
+ **Returns:** <code>Promise&lt;<a href="#appreadyresult">AppReadyResult</a>&gt;</code>
371
+
372
+ --------------------
373
+
374
+
375
+ ### setUpdateUrl(...)
376
+
377
+ ```typescript
378
+ setUpdateUrl(options: UpdateUrl) => Promise<void>
379
+ ```
380
+
381
+ Set the updateUrl for the app, this will be used to check for updates.
382
+
383
+ | Param | Type | Description |
384
+ | ------------- | ----------------------------------------------- | ------------------------------------------------- |
385
+ | **`options`** | <code><a href="#updateurl">UpdateUrl</a></code> | contains the URL to use for checking for updates. |
386
+
387
+ **Since:** 5.4.0
388
+
389
+ --------------------
390
+
391
+
392
+ ### setStatsUrl(...)
393
+
394
+ ```typescript
395
+ setStatsUrl(options: StatsUrl) => Promise<void>
396
+ ```
397
+
398
+ Set the statsUrl for the app, this will be used to send statistics. Passing an empty string will disable statistics gathering.
399
+
400
+ | Param | Type | Description |
401
+ | ------------- | --------------------------------------------- | ----------------------------------------------- |
402
+ | **`options`** | <code><a href="#statsurl">StatsUrl</a></code> | contains the URL to use for sending statistics. |
403
+
404
+ **Since:** 5.4.0
405
+
406
+ --------------------
407
+
408
+
409
+ ### setChannelUrl(...)
410
+
411
+ ```typescript
412
+ setChannelUrl(options: ChannelUrl) => Promise<void>
413
+ ```
414
+
415
+ Set the channelUrl for the app, this will be used to set the channel.
416
+
417
+ | Param | Type | Description |
418
+ | ------------- | ------------------------------------------------- | ------------------------------------------------ |
419
+ | **`options`** | <code><a href="#channelurl">ChannelUrl</a></code> | contains the URL to use for setting the channel. |
420
+
421
+ **Since:** 5.4.0
169
422
 
170
423
  --------------------
171
424
 
@@ -173,14 +426,14 @@ Change this behaviour with {@link appReadyTimeout}
173
426
  ### download(...)
174
427
 
175
428
  ```typescript
176
- download(options: { url: string; version: string; sessionKey?: string; checksum?: string; }) => Promise<BundleInfo>
429
+ download(options: DownloadOptions) => Promise<BundleInfo>
177
430
  ```
178
431
 
179
432
  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
180
433
 
181
- | Param | Type |
182
- | ------------- | -------------------------------------------------------------------------------------- |
183
- | **`options`** | <code>{ url: string; version: string; sessionKey?: string; checksum?: string; }</code> |
434
+ | Param | Type | Description |
435
+ | ------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
436
+ | **`options`** | <code><a href="#downloadoptions">DownloadOptions</a></code> | The {@link <a href="#downloadoptions">DownloadOptions</a>} for downloading a new bundle zip. |
184
437
 
185
438
  **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
186
439
 
@@ -190,14 +443,14 @@ Download a new bundle from the provided URL, it should be a zip file, with files
190
443
  ### next(...)
191
444
 
192
445
  ```typescript
193
- next(options: { id: string; }) => Promise<BundleInfo>
446
+ next(options: BundleId) => Promise<BundleInfo>
194
447
  ```
195
448
 
196
449
  Set the next bundle to be used when the app is reloaded.
197
450
 
198
- | Param | Type |
199
- | ------------- | ---------------------------- |
200
- | **`options`** | <code>{ id: string; }</code> |
451
+ | Param | Type | Description |
452
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
453
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | Contains the ID of the next Bundle to set on next app launch. {@link <a href="#bundleinfo">BundleInfo.id</a>} |
201
454
 
202
455
  **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
203
456
 
@@ -207,14 +460,14 @@ Set the next bundle to be used when the app is reloaded.
207
460
  ### set(...)
208
461
 
209
462
  ```typescript
210
- set(options: { id: string; }) => Promise<void>
463
+ set(options: BundleId) => Promise<void>
211
464
  ```
212
465
 
213
466
  Set the current bundle and immediately reloads the app.
214
467
 
215
- | Param | Type |
216
- | ------------- | ---------------------------- |
217
- | **`options`** | <code>{ id: string; }</code> |
468
+ | Param | Type | Description |
469
+ | ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
470
+ | **`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. |
218
471
 
219
472
  --------------------
220
473
 
@@ -222,27 +475,31 @@ Set the current bundle and immediately reloads the app.
222
475
  ### delete(...)
223
476
 
224
477
  ```typescript
225
- delete(options: { id: string; }) => Promise<void>
478
+ delete(options: BundleId) => Promise<void>
226
479
  ```
227
480
 
228
- Delete bundle in storage
481
+ Deletes the specified bundle from the native app storage. Use with {@link list} to get the stored Bundle IDs.
229
482
 
230
- | Param | Type |
231
- | ------------- | ---------------------------- |
232
- | **`options`** | <code>{ id: string; }</code> |
483
+ | Param | Type | Description |
484
+ | ------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
485
+ | **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the ID of a bundle to delete (note, this is the bundle id, NOT the version name) |
233
486
 
234
487
  --------------------
235
488
 
236
489
 
237
- ### list()
490
+ ### list(...)
238
491
 
239
492
  ```typescript
240
- list() => Promise<{ bundles: BundleInfo[]; }>
493
+ list(options?: ListOptions | undefined) => Promise<BundleListResult>
241
494
  ```
242
495
 
243
- Get all available bundles
496
+ Get all locally downloaded bundles in your app
497
+
498
+ | Param | Type | Description |
499
+ | ------------- | --------------------------------------------------- | ---------------------------------------------------------------------- |
500
+ | **`options`** | <code><a href="#listoptions">ListOptions</a></code> | The {@link <a href="#listoptions">ListOptions</a>} for listing bundles |
244
501
 
245
- **Returns:** <code>Promise&lt;{ bundles: BundleInfo[]; }&gt;</code>
502
+ **Returns:** <code>Promise&lt;<a href="#bundlelistresult">BundleListResult</a>&gt;</code>
246
503
 
247
504
  --------------------
248
505
 
@@ -250,14 +507,14 @@ Get all available bundles
250
507
  ### reset(...)
251
508
 
252
509
  ```typescript
253
- reset(options?: { toLastSuccessful?: boolean | undefined; } | undefined) => Promise<void>
510
+ reset(options?: ResetOptions | undefined) => Promise<void>
254
511
  ```
255
512
 
256
- Set the `builtin` bundle (the one sent to Apple store / Google play store ) as current bundle
513
+ Reset the app to the `builtin` bundle (the one sent to Apple App Store / Google Play Store ) or the last successfully loaded bundle.
257
514
 
258
- | Param | Type |
259
- | ------------- | -------------------------------------------- |
260
- | **`options`** | <code>{ toLastSuccessful?: boolean; }</code> |
515
+ | Param | Type | Description |
516
+ | ------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
517
+ | **`options`** | <code><a href="#resetoptions">ResetOptions</a></code> | Containing {@link <a href="#resetoptions">ResetOptions.toLastSuccessful</a>}, `true` resets to the builtin bundle and `false` will reset to the last successfully loaded bundle. |
261
518
 
262
519
  --------------------
263
520
 
@@ -265,12 +522,12 @@ Set the `builtin` bundle (the one sent to Apple store / Google play store ) as c
265
522
  ### current()
266
523
 
267
524
  ```typescript
268
- current() => Promise<{ bundle: BundleInfo; native: string; }>
525
+ current() => Promise<CurrentBundleResult>
269
526
  ```
270
527
 
271
- Get the current bundle, if none are set it returns `builtin`, currentNative is the original bundle installed on the device
528
+ Get the current bundle, if none are set it returns `builtin`. currentNative is the original bundle installed on the device
272
529
 
273
- **Returns:** <code>Promise&lt;{ bundle: <a href="#bundleinfo">BundleInfo</a>; native: string; }&gt;</code>
530
+ **Returns:** <code>Promise&lt;<a href="#currentbundleresult">CurrentBundleResult</a>&gt;</code>
274
531
 
275
532
  --------------------
276
533
 
@@ -289,14 +546,20 @@ Reload the view
289
546
  ### setMultiDelay(...)
290
547
 
291
548
  ```typescript
292
- setMultiDelay(options: { delayConditions: DelayCondition[]; }) => Promise<void>
549
+ setMultiDelay(options: MultiDelayConditions) => Promise<void>
293
550
  ```
294
551
 
295
- Set <a href="#delaycondition">DelayCondition</a>, skip updates until one of the conditions is met
552
+ Sets a {@link <a href="#delaycondition">DelayCondition</a>} array containing conditions that the Plugin will use to delay the update.
553
+ After all conditions are met, the update process will run start again as usual, so update will be installed after a backgrounding or killing the app.
554
+ For the `date` kind, the value should be an iso8601 date string.
555
+ For the `background` kind, the value should be a number in milliseconds.
556
+ For the `nativeVersion` kind, the value should be the version number.
557
+ For the `kill` kind, the value is not used.
558
+ The function has unconsistent behavior the option kill do trigger the update after the first kill and not after the next background like other options. This will be fixed in a future major release.
296
559
 
297
- | Param | Type | Description |
298
- | ------------- | --------------------------------------------------- | ------------------------------------------------------------------------ |
299
- | **`options`** | <code>{ delayConditions: DelayCondition[]; }</code> | are the {@link <a href="#delaycondition">DelayCondition</a>} list to set |
560
+ | Param | Type | Description |
561
+ | ------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
562
+ | **`options`** | <code><a href="#multidelayconditions">MultiDelayConditions</a></code> | Containing the {@link <a href="#multidelayconditions">MultiDelayConditions</a>} array of conditions to set |
300
563
 
301
564
  **Since:** 4.3.0
302
565
 
@@ -309,22 +572,26 @@ Set <a href="#delaycondition">DelayCondition</a>, skip updates until one of the
309
572
  cancelDelay() => Promise<void>
310
573
  ```
311
574
 
312
- Cancel delay to updates as usual
575
+ Cancels a {@link <a href="#delaycondition">DelayCondition</a>} to process an update immediately.
313
576
 
314
577
  **Since:** 4.0.0
315
578
 
316
579
  --------------------
317
580
 
318
581
 
319
- ### getLatest()
582
+ ### getLatest(...)
320
583
 
321
584
  ```typescript
322
- getLatest() => Promise<latestVersion>
585
+ getLatest(options?: GetLatestOptions | undefined) => Promise<LatestVersion>
323
586
  ```
324
587
 
325
588
  Get Latest bundle available from update Url
326
589
 
327
- **Returns:** <code>Promise&lt;<a href="#latestversion">latestVersion</a>&gt;</code>
590
+ | Param | Type |
591
+ | ------------- | ------------------------------------------------------------- |
592
+ | **`options`** | <code><a href="#getlatestoptions">GetLatestOptions</a></code> |
593
+
594
+ **Returns:** <code>Promise&lt;<a href="#latestversion">LatestVersion</a>&gt;</code>
328
595
 
329
596
  **Since:** 4.0.0
330
597
 
@@ -334,16 +601,36 @@ Get Latest bundle available from update Url
334
601
  ### setChannel(...)
335
602
 
336
603
  ```typescript
337
- setChannel(options: SetChannelOptions) => Promise<channelRes>
604
+ setChannel(options: SetChannelOptions) => Promise<ChannelRes>
338
605
  ```
339
606
 
340
- Set Channel for this device
607
+ Sets the channel for this device. The channel has to allow for self assignment for this to work.
608
+ Do not use this method to set the channel at boot when `autoUpdate` is enabled in the {@link PluginsConfig}.
609
+ This method is to set the channel after the app is ready.
610
+ This methods send to Capgo backend a request to link the device ID to the channel. Capgo can accept or refuse depending of the setting of your channel.
341
611
 
342
612
  | Param | Type | Description |
343
613
  | ------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------- |
344
- | **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> | is the {@link <a href="#setchanneloptions">SetChannelOptions</a>} channel to set |
614
+ | **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> | Is the {@link <a href="#setchanneloptions">SetChannelOptions</a>} channel to set |
345
615
 
346
- **Returns:** <code>Promise&lt;<a href="#channelres">channelRes</a>&gt;</code>
616
+ **Returns:** <code>Promise&lt;<a href="#channelres">ChannelRes</a>&gt;</code>
617
+
618
+ **Since:** 4.7.0
619
+
620
+ --------------------
621
+
622
+
623
+ ### unsetChannel(...)
624
+
625
+ ```typescript
626
+ unsetChannel(options: UnsetChannelOptions) => Promise<void>
627
+ ```
628
+
629
+ Unset the channel for this device. The device will then return to the default channel
630
+
631
+ | Param | Type |
632
+ | ------------- | ------------------------------------------------------------------- |
633
+ | **`options`** | <code><a href="#unsetchanneloptions">UnsetChannelOptions</a></code> |
347
634
 
348
635
  **Since:** 4.7.0
349
636
 
@@ -353,12 +640,12 @@ Set Channel for this device
353
640
  ### getChannel()
354
641
 
355
642
  ```typescript
356
- getChannel() => Promise<getChannelRes>
643
+ getChannel() => Promise<GetChannelRes>
357
644
  ```
358
645
 
359
- get Channel for this device
646
+ Get the channel for this device
360
647
 
361
- **Returns:** <code>Promise&lt;<a href="#getchannelres">getChannelRes</a>&gt;</code>
648
+ **Returns:** <code>Promise&lt;<a href="#getchannelres">GetChannelRes</a>&gt;</code>
362
649
 
363
650
  **Since:** 4.8.0
364
651
 
@@ -371,7 +658,7 @@ get Channel for this device
371
658
  setCustomId(options: SetCustomIdOptions) => Promise<void>
372
659
  ```
373
660
 
374
- Set Channel for this device
661
+ Set a custom ID for this device
375
662
 
376
663
  | Param | Type | Description |
377
664
  | ------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
@@ -382,20 +669,87 @@ Set Channel for this device
382
669
  --------------------
383
670
 
384
671
 
672
+ ### getBuiltinVersion()
673
+
674
+ ```typescript
675
+ getBuiltinVersion() => Promise<BuiltinVersion>
676
+ ```
677
+
678
+ Get the native app version or the builtin version if set in config
679
+
680
+ **Returns:** <code>Promise&lt;<a href="#builtinversion">BuiltinVersion</a>&gt;</code>
681
+
682
+ **Since:** 5.2.0
683
+
684
+ --------------------
685
+
686
+
687
+ ### getDeviceId()
688
+
689
+ ```typescript
690
+ getDeviceId() => Promise<DeviceId>
691
+ ```
692
+
693
+ Get unique ID used to identify device (sent to auto update server)
694
+
695
+ **Returns:** <code>Promise&lt;<a href="#deviceid">DeviceId</a>&gt;</code>
696
+
697
+ --------------------
698
+
699
+
700
+ ### getPluginVersion()
701
+
702
+ ```typescript
703
+ getPluginVersion() => Promise<PluginVersion>
704
+ ```
705
+
706
+ Get the native Capacitor Updater plugin version (sent to auto update server)
707
+
708
+ **Returns:** <code>Promise&lt;<a href="#pluginversion">PluginVersion</a>&gt;</code>
709
+
710
+ --------------------
711
+
712
+
713
+ ### isAutoUpdateEnabled()
714
+
715
+ ```typescript
716
+ isAutoUpdateEnabled() => Promise<AutoUpdateEnabled>
717
+ ```
718
+
719
+ Get the state of auto update config.
720
+
721
+ **Returns:** <code>Promise&lt;<a href="#autoupdateenabled">AutoUpdateEnabled</a>&gt;</code>
722
+
723
+ --------------------
724
+
725
+
726
+ ### removeAllListeners()
727
+
728
+ ```typescript
729
+ removeAllListeners() => Promise<void>
730
+ ```
731
+
732
+ Remove all listeners for this plugin.
733
+
734
+ **Since:** 1.0.0
735
+
736
+ --------------------
737
+
738
+
385
739
  ### addListener('download', ...)
386
740
 
387
741
  ```typescript
388
- addListener(eventName: "download", listenerFunc: DownloadChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
742
+ addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void) => Promise<PluginListenerHandle>
389
743
  ```
390
744
 
391
- Listen for download event in the App, let you know when the download is started, loading and finished
745
+ Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.
392
746
 
393
- | Param | Type |
394
- | ------------------ | ------------------------------------------------------------------------- |
395
- | **`eventName`** | <code>'download'</code> |
396
- | **`listenerFunc`** | <code><a href="#downloadchangelistener">DownloadChangeListener</a></code> |
747
+ | Param | Type |
748
+ | ------------------ | --------------------------------------------------------------------------- |
749
+ | **`eventName`** | <code>'download'</code> |
750
+ | **`listenerFunc`** | <code>(state: <a href="#downloadevent">DownloadEvent</a>) =&gt; void</code> |
397
751
 
398
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
752
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
399
753
 
400
754
  **Since:** 2.0.11
401
755
 
@@ -405,17 +759,17 @@ Listen for download event in the App, let you know when the download is started,
405
759
  ### addListener('noNeedUpdate', ...)
406
760
 
407
761
  ```typescript
408
- addListener(eventName: "noNeedUpdate", listenerFunc: NoNeedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
762
+ addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void) => Promise<PluginListenerHandle>
409
763
  ```
410
764
 
411
- Listen for no need to update event, usefull when you want force check every time the app is launched
765
+ Listen for no need to update event, useful when you want force check every time the app is launched
412
766
 
413
- | Param | Type |
414
- | ------------------ | --------------------------------------------------------- |
415
- | **`eventName`** | <code>'noNeedUpdate'</code> |
416
- | **`listenerFunc`** | <code><a href="#noneedlistener">NoNeedListener</a></code> |
767
+ | Param | Type |
768
+ | ------------------ | ----------------------------------------------------------------------- |
769
+ | **`eventName`** | <code>'noNeedUpdate'</code> |
770
+ | **`listenerFunc`** | <code>(state: <a href="#noneedevent">NoNeedEvent</a>) =&gt; void</code> |
417
771
 
418
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
772
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
419
773
 
420
774
  **Since:** 4.0.0
421
775
 
@@ -425,17 +779,17 @@ Listen for no need to update event, usefull when you want force check every time
425
779
  ### addListener('updateAvailable', ...)
426
780
 
427
781
  ```typescript
428
- addListener(eventName: "updateAvailable", listenerFunc: UpdateAvailabledListener) => Promise<PluginListenerHandle> & PluginListenerHandle
782
+ addListener(eventName: 'updateAvailable', listenerFunc: (state: UpdateAvailableEvent) => void) => Promise<PluginListenerHandle>
429
783
  ```
430
784
 
431
- Listen for availbale update event, usefull when you want to force check every time the app is launched
785
+ Listen for available update event, useful when you want to force check every time the app is launched
432
786
 
433
- | Param | Type |
434
- | ------------------ | ----------------------------------------------------------------------------- |
435
- | **`eventName`** | <code>'updateAvailable'</code> |
436
- | **`listenerFunc`** | <code><a href="#updateavailabledlistener">UpdateAvailabledListener</a></code> |
787
+ | Param | Type |
788
+ | ------------------ | ----------------------------------------------------------------------------------------- |
789
+ | **`eventName`** | <code>'updateAvailable'</code> |
790
+ | **`listenerFunc`** | <code>(state: <a href="#updateavailableevent">UpdateAvailableEvent</a>) =&gt; void</code> |
437
791
 
438
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
792
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
439
793
 
440
794
  **Since:** 4.0.0
441
795
 
@@ -445,17 +799,17 @@ Listen for availbale update event, usefull when you want to force check every ti
445
799
  ### addListener('downloadComplete', ...)
446
800
 
447
801
  ```typescript
448
- addListener(eventName: "downloadComplete", listenerFunc: DownloadCompleteListener) => Promise<PluginListenerHandle> & PluginListenerHandle
802
+ addListener(eventName: 'downloadComplete', listenerFunc: (state: DownloadCompleteEvent) => void) => Promise<PluginListenerHandle>
449
803
  ```
450
804
 
451
- Listen for download event in the App, let you know when the download is started, loading and finished
805
+ Listen for downloadComplete events.
452
806
 
453
- | Param | Type |
454
- | ------------------ | ----------------------------------------------------------------------------- |
455
- | **`eventName`** | <code>'downloadComplete'</code> |
456
- | **`listenerFunc`** | <code><a href="#downloadcompletelistener">DownloadCompleteListener</a></code> |
807
+ | Param | Type |
808
+ | ------------------ | ------------------------------------------------------------------------------------------- |
809
+ | **`eventName`** | <code>'downloadComplete'</code> |
810
+ | **`listenerFunc`** | <code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>) =&gt; void</code> |
457
811
 
458
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
812
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
459
813
 
460
814
  **Since:** 4.0.0
461
815
 
@@ -465,17 +819,17 @@ Listen for download event in the App, let you know when the download is started,
465
819
  ### addListener('majorAvailable', ...)
466
820
 
467
821
  ```typescript
468
- addListener(eventName: "majorAvailable", listenerFunc: MajorAvailableListener) => Promise<PluginListenerHandle> & PluginListenerHandle
822
+ addListener(eventName: 'majorAvailable', listenerFunc: (state: MajorAvailableEvent) => void) => Promise<PluginListenerHandle>
469
823
  ```
470
824
 
471
825
  Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
472
826
 
473
- | Param | Type |
474
- | ------------------ | ------------------------------------------------------------------------- |
475
- | **`eventName`** | <code>'majorAvailable'</code> |
476
- | **`listenerFunc`** | <code><a href="#majoravailablelistener">MajorAvailableListener</a></code> |
827
+ | Param | Type |
828
+ | ------------------ | --------------------------------------------------------------------------------------- |
829
+ | **`eventName`** | <code>'majorAvailable'</code> |
830
+ | **`listenerFunc`** | <code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>) =&gt; void</code> |
477
831
 
478
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
832
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
479
833
 
480
834
  **Since:** 2.3.0
481
835
 
@@ -485,17 +839,17 @@ Listen for Major update event in the App, let you know when major update is bloc
485
839
  ### addListener('updateFailed', ...)
486
840
 
487
841
  ```typescript
488
- addListener(eventName: "updateFailed", listenerFunc: UpdateFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
842
+ addListener(eventName: 'updateFailed', listenerFunc: (state: UpdateFailedEvent) => void) => Promise<PluginListenerHandle>
489
843
  ```
490
844
 
491
845
  Listen for update fail event in the App, let you know when update has fail to install at next app start
492
846
 
493
- | Param | Type |
494
- | ------------------ | --------------------------------------------------------------------- |
495
- | **`eventName`** | <code>'updateFailed'</code> |
496
- | **`listenerFunc`** | <code><a href="#updatefailedlistener">UpdateFailedListener</a></code> |
847
+ | Param | Type |
848
+ | ------------------ | ----------------------------------------------------------------------------------- |
849
+ | **`eventName`** | <code>'updateFailed'</code> |
850
+ | **`listenerFunc`** | <code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>) =&gt; void</code> |
497
851
 
498
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
852
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
499
853
 
500
854
  **Since:** 2.3.0
501
855
 
@@ -505,17 +859,17 @@ Listen for update fail event in the App, let you know when update has fail to in
505
859
  ### addListener('downloadFailed', ...)
506
860
 
507
861
  ```typescript
508
- addListener(eventName: "downloadFailed", listenerFunc: DownloadFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
862
+ addListener(eventName: 'downloadFailed', listenerFunc: (state: DownloadFailedEvent) => void) => Promise<PluginListenerHandle>
509
863
  ```
510
864
 
511
- Listen for download fail event in the App, let you know when download has fail finished
865
+ Listen for download fail event in the App, let you know when a bundle download has failed
512
866
 
513
- | Param | Type |
514
- | ------------------ | ------------------------------------------------------------------------- |
515
- | **`eventName`** | <code>'downloadFailed'</code> |
516
- | **`listenerFunc`** | <code><a href="#downloadfailedlistener">DownloadFailedListener</a></code> |
867
+ | Param | Type |
868
+ | ------------------ | --------------------------------------------------------------------------------------- |
869
+ | **`eventName`** | <code>'downloadFailed'</code> |
870
+ | **`listenerFunc`** | <code>(state: <a href="#downloadfailedevent">DownloadFailedEvent</a>) =&gt; void</code> |
517
871
 
518
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
872
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
519
873
 
520
874
  **Since:** 4.0.0
521
875
 
@@ -525,71 +879,68 @@ Listen for download fail event in the App, let you know when download has fail f
525
879
  ### addListener('appReloaded', ...)
526
880
 
527
881
  ```typescript
528
- addListener(eventName: "appReloaded", listenerFunc: AppReloadedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
882
+ addListener(eventName: 'appReloaded', listenerFunc: () => void) => Promise<PluginListenerHandle>
529
883
  ```
530
884
 
531
- Listen for download fail event in the App, let you know when download has fail finished
885
+ Listen for reload event in the App, let you know when reload has happened
532
886
 
533
- | Param | Type |
534
- | ------------------ | ------------------------------------------------------------------- |
535
- | **`eventName`** | <code>'appReloaded'</code> |
536
- | **`listenerFunc`** | <code><a href="#appreloadedlistener">AppReloadedListener</a></code> |
887
+ | Param | Type |
888
+ | ------------------ | -------------------------- |
889
+ | **`eventName`** | <code>'appReloaded'</code> |
890
+ | **`listenerFunc`** | <code>() =&gt; void</code> |
537
891
 
538
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
892
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
539
893
 
540
894
  **Since:** 4.3.0
541
895
 
542
896
  --------------------
543
897
 
544
898
 
545
- ### getDeviceId()
899
+ ### addListener('appReady', ...)
546
900
 
547
901
  ```typescript
548
- getDeviceId() => Promise<{ deviceId: string; }>
902
+ addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void) => Promise<PluginListenerHandle>
549
903
  ```
550
904
 
551
- Get unique ID used to identify device (sent to auto update server)
905
+ Listen for app ready event in the App, let you know when app is ready to use
552
906
 
553
- **Returns:** <code>Promise&lt;{ deviceId: string; }&gt;</code>
907
+ | Param | Type |
908
+ | ------------------ | --------------------------------------------------------------------------- |
909
+ | **`eventName`** | <code>'appReady'</code> |
910
+ | **`listenerFunc`** | <code>(state: <a href="#appreadyevent">AppReadyEvent</a>) =&gt; void</code> |
554
911
 
555
- --------------------
912
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
556
913
 
557
-
558
- ### getPluginVersion()
559
-
560
- ```typescript
561
- getPluginVersion() => Promise<{ version: string; }>
562
- ```
563
-
564
- Get the native Capacitor Updater plugin version (sent to auto update server)
565
-
566
- **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
914
+ **Since:** 5.1.0
567
915
 
568
916
  --------------------
569
917
 
570
918
 
571
- ### isAutoUpdateEnabled()
919
+ ### isAutoUpdateAvailable()
572
920
 
573
921
  ```typescript
574
- isAutoUpdateEnabled() => Promise<{ enabled: boolean; }>
922
+ isAutoUpdateAvailable() => Promise<AutoUpdateAvailable>
575
923
  ```
576
924
 
577
- Get the state of auto update config. This will return `false` in manual mode.
925
+ Get if auto update is available (not disabled by serverUrl).
578
926
 
579
- **Returns:** <code>Promise&lt;{ enabled: boolean; }&gt;</code>
927
+ **Returns:** <code>Promise&lt;<a href="#autoupdateavailable">AutoUpdateAvailable</a>&gt;</code>
580
928
 
581
929
  --------------------
582
930
 
583
931
 
584
- ### removeAllListeners()
932
+ ### getNextBundle()
585
933
 
586
934
  ```typescript
587
- removeAllListeners() => Promise<void>
935
+ getNextBundle() => Promise<BundleInfo | null>
588
936
  ```
589
937
 
590
- Remove all listeners for this plugin.
938
+ Get the next bundle that will be used when the app reloads.
939
+ Returns null if no next bundle is set.
591
940
 
592
- **Since:** 1.0.0
941
+ **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a> | null&gt;</code>
942
+
943
+ **Since:** 6.8.0
593
944
 
594
945
  --------------------
595
946
 
@@ -597,6 +948,13 @@ Remove all listeners for this plugin.
597
948
  ### Interfaces
598
949
 
599
950
 
951
+ #### AppReadyResult
952
+
953
+ | Prop | Type |
954
+ | ------------ | ------------------------------------------------- |
955
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> |
956
+
957
+
600
958
  #### BundleInfo
601
959
 
602
960
  | Prop | Type |
@@ -608,6 +966,80 @@ Remove all listeners for this plugin.
608
966
  | **`status`** | <code><a href="#bundlestatus">BundleStatus</a></code> |
609
967
 
610
968
 
969
+ #### UpdateUrl
970
+
971
+ | Prop | Type |
972
+ | --------- | ------------------- |
973
+ | **`url`** | <code>string</code> |
974
+
975
+
976
+ #### StatsUrl
977
+
978
+ | Prop | Type |
979
+ | --------- | ------------------- |
980
+ | **`url`** | <code>string</code> |
981
+
982
+
983
+ #### ChannelUrl
984
+
985
+ | Prop | Type |
986
+ | --------- | ------------------- |
987
+ | **`url`** | <code>string</code> |
988
+
989
+
990
+ #### DownloadOptions
991
+
992
+ | Prop | Type | Description | Default | Since |
993
+ | ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- |
994
+ | **`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.) | | |
995
+ | **`version`** | <code>string</code> | The version code/name of this bundle/version | | |
996
+ | **`sessionKey`** | <code>string</code> | The session key for the update | <code>undefined</code> | 4.0.0 |
997
+ | **`checksum`** | <code>string</code> | The checksum for the update | <code>undefined</code> | 4.0.0 |
998
+
999
+
1000
+ #### BundleId
1001
+
1002
+ | Prop | Type |
1003
+ | -------- | ------------------- |
1004
+ | **`id`** | <code>string</code> |
1005
+
1006
+
1007
+ #### BundleListResult
1008
+
1009
+ | Prop | Type |
1010
+ | ------------- | ------------------------- |
1011
+ | **`bundles`** | <code>BundleInfo[]</code> |
1012
+
1013
+
1014
+ #### ListOptions
1015
+
1016
+ | Prop | Type | Description | Default | Since |
1017
+ | --------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ------ |
1018
+ | **`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 |
1019
+
1020
+
1021
+ #### ResetOptions
1022
+
1023
+ | Prop | Type |
1024
+ | ---------------------- | -------------------- |
1025
+ | **`toLastSuccessful`** | <code>boolean</code> |
1026
+
1027
+
1028
+ #### CurrentBundleResult
1029
+
1030
+ | Prop | Type |
1031
+ | ------------ | ------------------------------------------------- |
1032
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> |
1033
+ | **`native`** | <code>string</code> |
1034
+
1035
+
1036
+ #### MultiDelayConditions
1037
+
1038
+ | Prop | Type |
1039
+ | --------------------- | ----------------------------- |
1040
+ | **`delayConditions`** | <code>DelayCondition[]</code> |
1041
+
1042
+
611
1043
  #### DelayCondition
612
1044
 
613
1045
  | Prop | Type | Description |
@@ -616,42 +1048,68 @@ Remove all listeners for this plugin.
616
1048
  | **`value`** | <code>string</code> | |
617
1049
 
618
1050
 
619
- #### latestVersion
1051
+ #### LatestVersion
1052
+
1053
+ | Prop | Type | Description | Since |
1054
+ | ---------------- | ---------------------------- | -------------------------- | ----- |
1055
+ | **`version`** | <code>string</code> | Result of getLatest method | 4.0.0 |
1056
+ | **`checksum`** | <code>string</code> | | 6 |
1057
+ | **`major`** | <code>boolean</code> | | |
1058
+ | **`message`** | <code>string</code> | | |
1059
+ | **`sessionKey`** | <code>string</code> | | |
1060
+ | **`error`** | <code>string</code> | | |
1061
+ | **`old`** | <code>string</code> | | |
1062
+ | **`url`** | <code>string</code> | | |
1063
+ | **`manifest`** | <code>ManifestEntry[]</code> | | 6.1 |
1064
+
1065
+
1066
+ #### ManifestEntry
1067
+
1068
+ | Prop | Type |
1069
+ | ------------------ | --------------------------- |
1070
+ | **`file_name`** | <code>string \| null</code> |
1071
+ | **`file_hash`** | <code>string \| null</code> |
1072
+ | **`download_url`** | <code>string \| null</code> |
1073
+
620
1074
 
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> | | |
1075
+ #### GetLatestOptions
630
1076
 
1077
+ | Prop | Type | Description | Default | Since |
1078
+ | ------------- | ------------------- | ----------------------------------------------------------------------------------------------- | ---------------------- | ----- |
1079
+ | **`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 |
631
1080
 
632
- #### channelRes
1081
+
1082
+ #### ChannelRes
633
1083
 
634
1084
  | Prop | Type | Description | Since |
635
1085
  | ------------- | ------------------- | ----------------------------- | ----- |
636
1086
  | **`status`** | <code>string</code> | Current status of set channel | 4.7.0 |
637
- | **`error`** | <code>any</code> | | |
638
- | **`message`** | <code>any</code> | | |
1087
+ | **`error`** | <code>string</code> | | |
1088
+ | **`message`** | <code>string</code> | | |
639
1089
 
640
1090
 
641
1091
  #### SetChannelOptions
642
1092
 
643
- | Prop | Type |
644
- | ------------- | ------------------- |
645
- | **`channel`** | <code>string</code> |
1093
+ | Prop | Type |
1094
+ | ----------------------- | -------------------- |
1095
+ | **`channel`** | <code>string</code> |
1096
+ | **`triggerAutoUpdate`** | <code>boolean</code> |
1097
+
646
1098
 
1099
+ #### UnsetChannelOptions
647
1100
 
648
- #### getChannelRes
1101
+ | Prop | Type |
1102
+ | ----------------------- | -------------------- |
1103
+ | **`triggerAutoUpdate`** | <code>boolean</code> |
1104
+
1105
+
1106
+ #### GetChannelRes
649
1107
 
650
1108
  | Prop | Type | Description | Since |
651
1109
  | -------------- | -------------------- | ----------------------------- | ----- |
652
1110
  | **`channel`** | <code>string</code> | Current status of get channel | 4.8.0 |
653
- | **`error`** | <code>any</code> | | |
654
- | **`message`** | <code>any</code> | | |
1111
+ | **`error`** | <code>string</code> | | |
1112
+ | **`message`** | <code>string</code> | | |
655
1113
  | **`status`** | <code>string</code> | | |
656
1114
  | **`allowSet`** | <code>boolean</code> | | |
657
1115
 
@@ -663,6 +1121,34 @@ Remove all listeners for this plugin.
663
1121
  | **`customId`** | <code>string</code> |
664
1122
 
665
1123
 
1124
+ #### BuiltinVersion
1125
+
1126
+ | Prop | Type |
1127
+ | ------------- | ------------------- |
1128
+ | **`version`** | <code>string</code> |
1129
+
1130
+
1131
+ #### DeviceId
1132
+
1133
+ | Prop | Type |
1134
+ | -------------- | ------------------- |
1135
+ | **`deviceId`** | <code>string</code> |
1136
+
1137
+
1138
+ #### PluginVersion
1139
+
1140
+ | Prop | Type |
1141
+ | ------------- | ------------------- |
1142
+ | **`version`** | <code>string</code> |
1143
+
1144
+
1145
+ #### AutoUpdateEnabled
1146
+
1147
+ | Prop | Type |
1148
+ | ------------- | -------------------- |
1149
+ | **`enabled`** | <code>boolean</code> |
1150
+
1151
+
666
1152
  #### PluginListenerHandle
667
1153
 
668
1154
  | Prop | Type |
@@ -678,14 +1164,14 @@ Remove all listeners for this plugin.
678
1164
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | | |
679
1165
 
680
1166
 
681
- #### noNeedEvent
1167
+ #### NoNeedEvent
682
1168
 
683
1169
  | Prop | Type | Description | Since |
684
1170
  | ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
685
1171
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current status of download, between 0 and 100. | 4.0.0 |
686
1172
 
687
1173
 
688
- #### updateAvailableEvent
1174
+ #### UpdateAvailableEvent
689
1175
 
690
1176
  | Prop | Type | Description | Since |
691
1177
  | ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
@@ -720,57 +1206,32 @@ Remove all listeners for this plugin.
720
1206
  | **`version`** | <code>string</code> | Emit when a download fail. | 4.0.0 |
721
1207
 
722
1208
 
723
- ### Type Aliases
724
-
725
-
726
- #### BundleStatus
727
-
728
- <code>"success" | "error" | "pending" | "downloading"</code>
729
-
730
-
731
- #### DelayUntilNext
732
-
733
- <code>"background" | "kill" | "nativeVersion" | "date"</code>
734
-
735
-
736
- #### DownloadChangeListener
737
-
738
- <code>(state: <a href="#downloadevent">DownloadEvent</a>): void</code>
739
-
740
-
741
- #### NoNeedListener
742
-
743
- <code>(state: <a href="#noneedevent">noNeedEvent</a>): void</code>
744
-
745
-
746
- #### UpdateAvailabledListener
747
-
748
- <code>(state: <a href="#updateavailableevent">updateAvailableEvent</a>): void</code>
749
-
750
-
751
- #### DownloadCompleteListener
752
-
753
- <code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>): void</code>
1209
+ #### AppReadyEvent
754
1210
 
1211
+ | Prop | Type | Description | Since |
1212
+ | ------------ | ------------------------------------------------- | ------------------------------------- | ----- |
1213
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emitted when the app is ready to use. | 5.2.0 |
1214
+ | **`status`** | <code>string</code> | | |
755
1215
 
756
- #### MajorAvailableListener
757
1216
 
758
- <code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>): void</code>
1217
+ #### AutoUpdateAvailable
759
1218
 
1219
+ | Prop | Type |
1220
+ | --------------- | -------------------- |
1221
+ | **`available`** | <code>boolean</code> |
760
1222
 
761
- #### UpdateFailedListener
762
1223
 
763
- <code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>): void</code>
1224
+ ### Type Aliases
764
1225
 
765
1226
 
766
- #### DownloadFailedListener
1227
+ #### BundleStatus
767
1228
 
768
- <code>(state: <a href="#downloadfailedevent">DownloadFailedEvent</a>): void</code>
1229
+ <code>'success' | 'error' | 'pending' | 'downloading'</code>
769
1230
 
770
1231
 
771
- #### AppReloadedListener
1232
+ #### DelayUntilNext
772
1233
 
773
- <code>(state: void): void</code>
1234
+ <code>'background' | 'kill' | 'nativeVersion' | 'date'</code>
774
1235
 
775
1236
  </docgen-api>
776
1237
 
@@ -794,4 +1255,4 @@ On iOS, Apple don't allow you to show a message when the app is updated, so you
794
1255
 
795
1256
  ### Contributors
796
1257
 
797
- [jamesyoung1337](https://github.com/jamesyoung1337) Thanks a lot for your guidance and support, it was impossible to make this plugin work without you.
1258
+ [jamesyoung1337](https://github.com/jamesyoung1337) Thank you so much for your guidance and support, it was impossible to make this plugin work without you.