@capgo/capacitor-updater 5.0.0-alpha.0 → 7.0.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 (38) hide show
  1. package/CapgoCapacitorUpdater.podspec +1 -1
  2. package/LICENCE +373 -661
  3. package/README.md +339 -75
  4. package/android/build.gradle +13 -12
  5. package/android/src/main/AndroidManifest.xml +4 -2
  6. package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +205 -121
  7. package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +32 -24
  8. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +1041 -441
  9. package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1217 -536
  10. package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +153 -0
  11. package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +62 -0
  12. package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +14 -0
  13. package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +126 -0
  14. package/dist/docs.json +727 -171
  15. package/dist/esm/definitions.d.ts +234 -45
  16. package/dist/esm/definitions.js +5 -0
  17. package/dist/esm/definitions.js.map +1 -1
  18. package/dist/esm/index.d.ts +2 -2
  19. package/dist/esm/index.js +9 -4
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/web.d.ts +12 -6
  22. package/dist/esm/web.js +64 -20
  23. package/dist/esm/web.js.map +1 -1
  24. package/dist/plugin.cjs.js +70 -23
  25. package/dist/plugin.cjs.js.map +1 -1
  26. package/dist/plugin.js +70 -23
  27. package/dist/plugin.js.map +1 -1
  28. package/ios/Plugin/BundleInfo.swift +38 -19
  29. package/ios/Plugin/BundleStatus.swift +11 -4
  30. package/ios/Plugin/CapacitorUpdater.swift +520 -192
  31. package/ios/Plugin/CapacitorUpdaterPlugin.m +8 -1
  32. package/ios/Plugin/CapacitorUpdaterPlugin.swift +447 -190
  33. package/ios/Plugin/CryptoCipher.swift +240 -0
  34. package/ios/Plugin/DelayCondition.swift +74 -0
  35. package/ios/Plugin/DelayUntilNext.swift +30 -0
  36. package/ios/Plugin/UserDefaultsExtension.swift +48 -0
  37. package/package.json +26 -20
  38. package/ios/Plugin/ObjectPreferences.swift +0 -97
package/README.md CHANGED
@@ -1,18 +1,33 @@
1
- # capacitor-updater
1
+ # Capacitor updater
2
+ <a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
3
+ [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.com/invite/VnYRvBfgA6)
4
+ <a href="https://discord.com/invite/VnYRvBfgA6"><img src="https://img.shields.io/discord/912707985829163099?color=%237289DA&label=Discord" alt="Discord">
5
+ [![npm](https://img.shields.io/npm/dm/@capgo/capacitor-updater)](https://www.npmjs.com/package/@capgo/capacitor-updater)
6
+ [![GitHub latest commit](https://badgen.net/github/last-commit/Cap-go/capacitor-updater/main)](https://GitHub.com/Cap-go/capacitor-updater/commit/)
7
+ [![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)
8
+ [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=Cap-go_capacitor-updater&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=Cap-go_capacitor-updater)
9
+ [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=Cap-go_capacitor-updater&metric=bugs)](https://sonarcloud.io/summary/new_code?id=Cap-go_capacitor-updater)
10
+ [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=Cap-go_capacitor-updater&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=Cap-go_capacitor-updater)
11
+ [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=Cap-go_capacitor-updater&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=Cap-go_capacitor-updater)
12
+ [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=Cap-go_capacitor-updater&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=Cap-go_capacitor-updater)
13
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Cap-go_capacitor-updater&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Cap-go_capacitor-updater)
14
+ [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=Cap-go_capacitor-updater&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=Cap-go_capacitor-updater)
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
+ [![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)
2
17
 
3
18
  Update Ionic Capacitor apps without App/Play Store review (Code-push / hot-code updates).
4
19
 
5
- Usage options:
6
- - use [capgo.app](https://capgo.app), a full featured auto update system. (5 min Setup, easily manage versions, update, revert, and see detailed stats.)
7
- - integrate your own API with this plugin's auto update system.
8
- - use manual methods to zip, upload, download, from application code - you have full control.
20
+ 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
23
+ - Use manual methods to zip, upload, download, from JS to do it when you want.
9
24
 
10
25
 
11
26
  ## Community
12
27
  Join the [discord](https://discord.gg/VnYRvBfgA6) to get help.
13
28
 
14
29
  ## Documentation
15
- I maintain a more user friendly and complete [documentation](https://github.com/Cap-go/capacitor-updater/wiki) in GitHub wiki.
30
+ I maintain a more user friendly and complete [documentation here](https://docs.capgo.app/).
16
31
 
17
32
  ## Installation
18
33
 
@@ -23,12 +38,18 @@ npx cap sync
23
38
 
24
39
  ## Auto-update setup
25
40
 
26
- Create account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/app/apikeys)
27
- - Download the CLI `npm i -g @capgo/cli`
28
- - Add app from CLI `capgo add -a API_KEY`
29
- - Upload app `capgo upload -a API_KEY`
30
- - Upload app `capgo set -a API_KEY -s public`
31
- - Edit your `capacitor.config.json` like below, set `autoUpdate` to true.
41
+ Create your account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/app/apikeys)
42
+ - Login to CLI `npx @capgo/cli@latest init API_KEY`
43
+ And follow the steps by step to setup your app.
44
+
45
+ See more there in the [Auto update documentation](https://docs.capgo.app/plugin/auto-update).
46
+
47
+
48
+ ## Manual setup
49
+
50
+ Download update distribution zipfiles from a custom url. Manually control the entire update process.
51
+
52
+ - Edit your `capacitor.config.json` like below, set `autoUpdate` to false.
32
53
  ```json
33
54
  // capacitor.config.json
34
55
  {
@@ -36,29 +57,11 @@ Create account in [capgo.app](https://capgo.app) and get your [API key](https://
36
57
  "appName": "Name",
37
58
  "plugins": {
38
59
  "CapacitorUpdater": {
39
- "autoUpdate": true,
60
+ "autoUpdate": false,
40
61
  }
41
62
  }
42
63
  }
43
64
  ```
44
- - Add to your main code
45
- ```javascript
46
- import { CapacitorUpdater } from '@capgo/capacitor-updater'
47
- CapacitorUpdater.notifyAppReady()
48
- ```
49
- This tells 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).
50
-
51
- - Do `npm run build && npx cap copy` to copy the build to capacitor.
52
- - Run the app and see app auto update after each backgrounding.
53
- - Failed updates will automatically roll back to the last successful version.
54
-
55
- See more details in the [Auto update](https://github.com/Cap-go/capacitor-updater/wiki) documentation.
56
-
57
-
58
- ## Manual setup
59
-
60
- Download update distribution zipfiles from a custom url. Manually control the entire update process.
61
-
62
65
  - Add to your main code
63
66
  ```javascript
64
67
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
@@ -126,15 +129,23 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
126
129
  * [`reset(...)`](#reset)
127
130
  * [`current()`](#current)
128
131
  * [`reload()`](#reload)
129
- * [`setDelay(...)`](#setdelay)
132
+ * [`setMultiDelay(...)`](#setmultidelay)
133
+ * [`cancelDelay()`](#canceldelay)
134
+ * [`getLatest()`](#getlatest)
135
+ * [`setChannel(...)`](#setchannel)
136
+ * [`getChannel()`](#getchannel)
137
+ * [`setCustomId(...)`](#setcustomid)
130
138
  * [`addListener('download', ...)`](#addlistenerdownload)
139
+ * [`addListener('noNeedUpdate', ...)`](#addlistenernoneedupdate)
140
+ * [`addListener('updateAvailable', ...)`](#addlistenerupdateavailable)
131
141
  * [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete)
132
142
  * [`addListener('majorAvailable', ...)`](#addlistenermajoravailable)
133
143
  * [`addListener('updateFailed', ...)`](#addlistenerupdatefailed)
134
- * [`getId()`](#getid)
144
+ * [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed)
145
+ * [`addListener('appReloaded', ...)`](#addlistenerappreloaded)
146
+ * [`getDeviceId()`](#getdeviceid)
135
147
  * [`getPluginVersion()`](#getpluginversion)
136
148
  * [`isAutoUpdateEnabled()`](#isautoupdateenabled)
137
- * [`addListener(string, ...)`](#addlistenerstring)
138
149
  * [`removeAllListeners()`](#removealllisteners)
139
150
  * [Interfaces](#interfaces)
140
151
  * [Type Aliases](#type-aliases)
@@ -151,6 +162,8 @@ notifyAppReady() => Promise<BundleInfo>
151
162
  ```
152
163
 
153
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}
154
167
 
155
168
  **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
156
169
 
@@ -160,14 +173,14 @@ Notify Capacitor Updater that the current bundle is working (a rollback will occ
160
173
  ### download(...)
161
174
 
162
175
  ```typescript
163
- download(options: { url: string; version?: string; }) => Promise<BundleInfo>
176
+ download(options: { url: string; version: string; sessionKey?: string; checksum?: string; }) => Promise<BundleInfo>
164
177
  ```
165
178
 
166
- Download a new version from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
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
167
180
 
168
- | Param | Type |
169
- | ------------- | ----------------------------------------------- |
170
- | **`options`** | <code>{ url: string; version?: string; }</code> |
181
+ | Param | Type |
182
+ | ------------- | -------------------------------------------------------------------------------------- |
183
+ | **`options`** | <code>{ url: string; version: string; sessionKey?: string; checksum?: string; }</code> |
171
184
 
172
185
  **Returns:** <code>Promise&lt;<a href="#bundleinfo">BundleInfo</a>&gt;</code>
173
186
 
@@ -227,7 +240,7 @@ Delete bundle in storage
227
240
  list() => Promise<{ bundles: BundleInfo[]; }>
228
241
  ```
229
242
 
230
- Get all available versions
243
+ Get all available bundles
231
244
 
232
245
  **Returns:** <code>Promise&lt;{ bundles: BundleInfo[]; }&gt;</code>
233
246
 
@@ -240,7 +253,7 @@ Get all available versions
240
253
  reset(options?: { toLastSuccessful?: boolean | undefined; } | undefined) => Promise<void>
241
254
  ```
242
255
 
243
- Set the `builtin` version (the one sent to Apple store / Google play store ) as current version
256
+ Set the `builtin` bundle (the one sent to Apple store / Google play store ) as current bundle
244
257
 
245
258
  | Param | Type |
246
259
  | ------------- | -------------------------------------------- |
@@ -273,17 +286,98 @@ Reload the view
273
286
  --------------------
274
287
 
275
288
 
276
- ### setDelay(...)
289
+ ### setMultiDelay(...)
290
+
291
+ ```typescript
292
+ setMultiDelay(options: { delayConditions: DelayCondition[]; }) => Promise<void>
293
+ ```
294
+
295
+ Set <a href="#delaycondition">DelayCondition</a>, skip updates until one of the conditions is met
296
+
297
+ | Param | Type | Description |
298
+ | ------------- | --------------------------------------------------- | ------------------------------------------------------------------------ |
299
+ | **`options`** | <code>{ delayConditions: DelayCondition[]; }</code> | are the {@link <a href="#delaycondition">DelayCondition</a>} list to set |
300
+
301
+ **Since:** 4.3.0
302
+
303
+ --------------------
304
+
305
+
306
+ ### cancelDelay()
277
307
 
278
308
  ```typescript
279
- setDelay(options: { delay: boolean; }) => Promise<void>
309
+ cancelDelay() => Promise<void>
280
310
  ```
281
311
 
282
- Set delay to skip updates in the next time the app goes into the background
312
+ Cancel delay to updates as usual
283
313
 
284
- | Param | Type |
285
- | ------------- | -------------------------------- |
286
- | **`options`** | <code>{ delay: boolean; }</code> |
314
+ **Since:** 4.0.0
315
+
316
+ --------------------
317
+
318
+
319
+ ### getLatest()
320
+
321
+ ```typescript
322
+ getLatest() => Promise<latestVersion>
323
+ ```
324
+
325
+ Get Latest bundle available from update Url
326
+
327
+ **Returns:** <code>Promise&lt;<a href="#latestversion">latestVersion</a>&gt;</code>
328
+
329
+ **Since:** 4.0.0
330
+
331
+ --------------------
332
+
333
+
334
+ ### setChannel(...)
335
+
336
+ ```typescript
337
+ setChannel(options: SetChannelOptions) => Promise<channelRes>
338
+ ```
339
+
340
+ Set Channel for this device
341
+
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 |
345
+
346
+ **Returns:** <code>Promise&lt;<a href="#channelres">channelRes</a>&gt;</code>
347
+
348
+ **Since:** 4.7.0
349
+
350
+ --------------------
351
+
352
+
353
+ ### getChannel()
354
+
355
+ ```typescript
356
+ getChannel() => Promise<getChannelRes>
357
+ ```
358
+
359
+ get Channel for this device
360
+
361
+ **Returns:** <code>Promise&lt;<a href="#getchannelres">getChannelRes</a>&gt;</code>
362
+
363
+ **Since:** 4.8.0
364
+
365
+ --------------------
366
+
367
+
368
+ ### setCustomId(...)
369
+
370
+ ```typescript
371
+ setCustomId(options: SetCustomIdOptions) => Promise<void>
372
+ ```
373
+
374
+ Set Channel for this device
375
+
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 |
379
+
380
+ **Since:** 4.9.0
287
381
 
288
382
  --------------------
289
383
 
@@ -291,7 +385,7 @@ Set delay to skip updates in the next time the app goes into the background
291
385
  ### addListener('download', ...)
292
386
 
293
387
  ```typescript
294
- addListener(eventName: 'download', listenerFunc: DownloadChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
388
+ addListener(eventName: "download", listenerFunc: DownloadChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
295
389
  ```
296
390
 
297
391
  Listen for download event in the App, let you know when the download is started, loading and finished
@@ -308,10 +402,50 @@ Listen for download event in the App, let you know when the download is started,
308
402
  --------------------
309
403
 
310
404
 
405
+ ### addListener('noNeedUpdate', ...)
406
+
407
+ ```typescript
408
+ addListener(eventName: "noNeedUpdate", listenerFunc: NoNeedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
409
+ ```
410
+
411
+ Listen for no need to update event, usefull when you want force check every time the app is launched
412
+
413
+ | Param | Type |
414
+ | ------------------ | --------------------------------------------------------- |
415
+ | **`eventName`** | <code>'noNeedUpdate'</code> |
416
+ | **`listenerFunc`** | <code><a href="#noneedlistener">NoNeedListener</a></code> |
417
+
418
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
419
+
420
+ **Since:** 4.0.0
421
+
422
+ --------------------
423
+
424
+
425
+ ### addListener('updateAvailable', ...)
426
+
427
+ ```typescript
428
+ addListener(eventName: "updateAvailable", listenerFunc: UpdateAvailabledListener) => Promise<PluginListenerHandle> & PluginListenerHandle
429
+ ```
430
+
431
+ Listen for availbale update event, usefull when you want to force check every time the app is launched
432
+
433
+ | Param | Type |
434
+ | ------------------ | ----------------------------------------------------------------------------- |
435
+ | **`eventName`** | <code>'updateAvailable'</code> |
436
+ | **`listenerFunc`** | <code><a href="#updateavailabledlistener">UpdateAvailabledListener</a></code> |
437
+
438
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
439
+
440
+ **Since:** 4.0.0
441
+
442
+ --------------------
443
+
444
+
311
445
  ### addListener('downloadComplete', ...)
312
446
 
313
447
  ```typescript
314
- addListener(eventName: 'downloadComplete', listenerFunc: DownloadCompleteListener) => Promise<PluginListenerHandle> & PluginListenerHandle
448
+ addListener(eventName: "downloadComplete", listenerFunc: DownloadCompleteListener) => Promise<PluginListenerHandle> & PluginListenerHandle
315
449
  ```
316
450
 
317
451
  Listen for download event in the App, let you know when the download is started, loading and finished
@@ -331,7 +465,7 @@ Listen for download event in the App, let you know when the download is started,
331
465
  ### addListener('majorAvailable', ...)
332
466
 
333
467
  ```typescript
334
- addListener(eventName: 'majorAvailable', listenerFunc: MajorAvailableListener) => Promise<PluginListenerHandle> & PluginListenerHandle
468
+ addListener(eventName: "majorAvailable", listenerFunc: MajorAvailableListener) => Promise<PluginListenerHandle> & PluginListenerHandle
335
469
  ```
336
470
 
337
471
  Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
@@ -351,10 +485,10 @@ Listen for Major update event in the App, let you know when major update is bloc
351
485
  ### addListener('updateFailed', ...)
352
486
 
353
487
  ```typescript
354
- addListener(eventName: 'updateFailed', listenerFunc: UpdateFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
488
+ addListener(eventName: "updateFailed", listenerFunc: UpdateFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
355
489
  ```
356
490
 
357
- Listen for update event in the App, let you know when update is ready to install at next app start
491
+ Listen for update fail event in the App, let you know when update has fail to install at next app start
358
492
 
359
493
  | Param | Type |
360
494
  | ------------------ | --------------------------------------------------------------------- |
@@ -368,57 +502,81 @@ Listen for update event in the App, let you know when update is ready to install
368
502
  --------------------
369
503
 
370
504
 
371
- ### getId()
505
+ ### addListener('downloadFailed', ...)
372
506
 
373
507
  ```typescript
374
- getId() => Promise<{ id: string; }>
508
+ addListener(eventName: "downloadFailed", listenerFunc: DownloadFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
375
509
  ```
376
510
 
377
- Get unique ID used to identify device (sent to auto update server)
511
+ Listen for download fail event in the App, let you know when download has fail finished
378
512
 
379
- **Returns:** <code>Promise&lt;{ id: string; }&gt;</code>
513
+ | Param | Type |
514
+ | ------------------ | ------------------------------------------------------------------------- |
515
+ | **`eventName`** | <code>'downloadFailed'</code> |
516
+ | **`listenerFunc`** | <code><a href="#downloadfailedlistener">DownloadFailedListener</a></code> |
517
+
518
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
519
+
520
+ **Since:** 4.0.0
380
521
 
381
522
  --------------------
382
523
 
383
524
 
384
- ### getPluginVersion()
525
+ ### addListener('appReloaded', ...)
385
526
 
386
527
  ```typescript
387
- getPluginVersion() => Promise<{ version: string; }>
528
+ addListener(eventName: "appReloaded", listenerFunc: AppReloadedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
388
529
  ```
389
530
 
390
- Get the native Capacitor Updater plugin version (sent to auto update server)
531
+ Listen for download fail event in the App, let you know when download has fail finished
391
532
 
392
- **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
533
+ | Param | Type |
534
+ | ------------------ | ------------------------------------------------------------------- |
535
+ | **`eventName`** | <code>'appReloaded'</code> |
536
+ | **`listenerFunc`** | <code><a href="#appreloadedlistener">AppReloadedListener</a></code> |
537
+
538
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
539
+
540
+ **Since:** 4.3.0
393
541
 
394
542
  --------------------
395
543
 
396
544
 
397
- ### isAutoUpdateEnabled()
545
+ ### getDeviceId()
398
546
 
399
547
  ```typescript
400
- isAutoUpdateEnabled() => Promise<{ enabled: boolean; }>
548
+ getDeviceId() => Promise<{ deviceId: string; }>
401
549
  ```
402
550
 
403
- Get the state of auto update config. This will return `false` in manual mode.
551
+ Get unique ID used to identify device (sent to auto update server)
404
552
 
405
- **Returns:** <code>Promise&lt;{ enabled: boolean; }&gt;</code>
553
+ **Returns:** <code>Promise&lt;{ deviceId: string; }&gt;</code>
406
554
 
407
555
  --------------------
408
556
 
409
557
 
410
- ### addListener(string, ...)
558
+ ### getPluginVersion()
411
559
 
412
560
  ```typescript
413
- addListener(eventName: string, listenerFunc: (...args: any[]) => any) => Promise<PluginListenerHandle>
561
+ getPluginVersion() => Promise<{ version: string; }>
414
562
  ```
415
563
 
416
- | Param | Type |
417
- | ------------------ | --------------------------------------- |
418
- | **`eventName`** | <code>string</code> |
419
- | **`listenerFunc`** | <code>(...args: any[]) =&gt; any</code> |
564
+ Get the native Capacitor Updater plugin version (sent to auto update server)
420
565
 
421
- **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
566
+ **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
567
+
568
+ --------------------
569
+
570
+
571
+ ### isAutoUpdateEnabled()
572
+
573
+ ```typescript
574
+ isAutoUpdateEnabled() => Promise<{ enabled: boolean; }>
575
+ ```
576
+
577
+ Get the state of auto update config. This will return `false` in manual mode.
578
+
579
+ **Returns:** <code>Promise&lt;{ enabled: boolean; }&gt;</code>
422
580
 
423
581
  --------------------
424
582
 
@@ -429,6 +587,10 @@ addListener(eventName: string, listenerFunc: (...args: any[]) => any) => Promise
429
587
  removeAllListeners() => Promise<void>
430
588
  ```
431
589
 
590
+ Remove all listeners for this plugin.
591
+
592
+ **Since:** 1.0.0
593
+
432
594
  --------------------
433
595
 
434
596
 
@@ -442,9 +604,65 @@ removeAllListeners() => Promise<void>
442
604
  | **`id`** | <code>string</code> |
443
605
  | **`version`** | <code>string</code> |
444
606
  | **`downloaded`** | <code>string</code> |
607
+ | **`checksum`** | <code>string</code> |
445
608
  | **`status`** | <code><a href="#bundlestatus">BundleStatus</a></code> |
446
609
 
447
610
 
611
+ #### DelayCondition
612
+
613
+ | Prop | Type | Description |
614
+ | ----------- | --------------------------------------------------------- | ---------------------------------------- |
615
+ | **`kind`** | <code><a href="#delayuntilnext">DelayUntilNext</a></code> | Set up delay conditions in setMultiDelay |
616
+ | **`value`** | <code>string</code> | |
617
+
618
+
619
+ #### latestVersion
620
+
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> | | |
630
+
631
+
632
+ #### channelRes
633
+
634
+ | Prop | Type | Description | Since |
635
+ | ------------- | ------------------- | ----------------------------- | ----- |
636
+ | **`status`** | <code>string</code> | Current status of set channel | 4.7.0 |
637
+ | **`error`** | <code>any</code> | | |
638
+ | **`message`** | <code>any</code> | | |
639
+
640
+
641
+ #### SetChannelOptions
642
+
643
+ | Prop | Type |
644
+ | ------------- | ------------------- |
645
+ | **`channel`** | <code>string</code> |
646
+
647
+
648
+ #### getChannelRes
649
+
650
+ | Prop | Type | Description | Since |
651
+ | -------------- | -------------------- | ----------------------------- | ----- |
652
+ | **`channel`** | <code>string</code> | Current status of get channel | 4.8.0 |
653
+ | **`error`** | <code>any</code> | | |
654
+ | **`message`** | <code>any</code> | | |
655
+ | **`status`** | <code>string</code> | | |
656
+ | **`allowSet`** | <code>boolean</code> | | |
657
+
658
+
659
+ #### SetCustomIdOptions
660
+
661
+ | Prop | Type |
662
+ | -------------- | ------------------- |
663
+ | **`customId`** | <code>string</code> |
664
+
665
+
448
666
  #### PluginListenerHandle
449
667
 
450
668
  | Prop | Type |
@@ -460,6 +678,20 @@ removeAllListeners() => Promise<void>
460
678
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | | |
461
679
 
462
680
 
681
+ #### noNeedEvent
682
+
683
+ | Prop | Type | Description | Since |
684
+ | ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
685
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current status of download, between 0 and 100. | 4.0.0 |
686
+
687
+
688
+ #### updateAvailableEvent
689
+
690
+ | Prop | Type | Description | Since |
691
+ | ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
692
+ | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current status of download, between 0 and 100. | 4.0.0 |
693
+
694
+
463
695
  #### DownloadCompleteEvent
464
696
 
465
697
  | Prop | Type | Description | Since |
@@ -469,9 +701,9 @@ removeAllListeners() => Promise<void>
469
701
 
470
702
  #### MajorAvailableEvent
471
703
 
472
- | Prop | Type | Description | Since |
473
- | ------------- | ------------------- | ------------------------------------------- | ----- |
474
- | **`version`** | <code>string</code> | Emit when a new major version is available. | 4.0.0 |
704
+ | Prop | Type | Description | Since |
705
+ | ------------- | ------------------- | ------------------------------------------ | ----- |
706
+ | **`version`** | <code>string</code> | Emit when a new major bundle is available. | 4.0.0 |
475
707
 
476
708
 
477
709
  #### UpdateFailedEvent
@@ -481,12 +713,24 @@ removeAllListeners() => Promise<void>
481
713
  | **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a update failed to install. | 4.0.0 |
482
714
 
483
715
 
716
+ #### DownloadFailedEvent
717
+
718
+ | Prop | Type | Description | Since |
719
+ | ------------- | ------------------- | -------------------------- | ----- |
720
+ | **`version`** | <code>string</code> | Emit when a download fail. | 4.0.0 |
721
+
722
+
484
723
  ### Type Aliases
485
724
 
486
725
 
487
726
  #### BundleStatus
488
727
 
489
- <code>'success' | 'error' | 'pending' | 'downloading'</code>
728
+ <code>"success" | "error" | "pending" | "downloading"</code>
729
+
730
+
731
+ #### DelayUntilNext
732
+
733
+ <code>"background" | "kill" | "nativeVersion" | "date"</code>
490
734
 
491
735
 
492
736
  #### DownloadChangeListener
@@ -494,6 +738,16 @@ removeAllListeners() => Promise<void>
494
738
  <code>(state: <a href="#downloadevent">DownloadEvent</a>): void</code>
495
739
 
496
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
+
497
751
  #### DownloadCompleteListener
498
752
 
499
753
  <code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>): void</code>
@@ -508,6 +762,16 @@ removeAllListeners() => Promise<void>
508
762
 
509
763
  <code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>): void</code>
510
764
 
765
+
766
+ #### DownloadFailedListener
767
+
768
+ <code>(state: <a href="#downloadfailedevent">DownloadFailedEvent</a>): void</code>
769
+
770
+
771
+ #### AppReloadedListener
772
+
773
+ <code>(state: void): void</code>
774
+
511
775
  </docgen-api>
512
776
 
513
777
  ### Listen to download events