@capawesome/capacitor-live-update 6.8.0 → 6.9.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.
- package/CapawesomeCapacitorLiveUpdate.podspec +2 -2
- package/README.md +429 -20
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +894 -279
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateConfig.java +35 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateHttpClient.java +56 -11
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +274 -38
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePreferences.java +52 -3
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetChannelsResponseItem.java +28 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +11 -2
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/events/DownloadBundleProgressEvent.java +32 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/events/NextBundleSetEvent.java +26 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/FetchChannelsOptions.java +38 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetConfigOptions.java +19 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SyncOptions.java +4 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/ChannelResult.java +28 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/FetchChannelsResult.java +28 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/FetchLatestBundleResult.java +8 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetBlockedBundlesResult.java +27 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetConfigResult.java +40 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/GetDownloadedBundlesResult.java +27 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/IsSyncingResult.java +26 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/results/ReadyResult.java +32 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/interfaces/DownloadProgressCallback.java +5 -0
- package/dist/docs.json +853 -50
- package/dist/esm/definitions.d.ts +411 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +10 -2
- package/dist/esm/web.js +24 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +24 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +24 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/Classes/Events/DownloadBundleProgressEvent.swift +25 -0
- package/ios/Plugin/Classes/Events/NextBundleSetEvent.swift +16 -0
- package/ios/Plugin/Classes/Options/FetchChannelsOptions.swift +26 -0
- package/ios/Plugin/Classes/Options/SetConfigOptions.swift +14 -0
- package/ios/Plugin/Classes/Options/SyncOptions.swift +4 -0
- package/ios/Plugin/Classes/Results/ChannelResult.swift +19 -0
- package/ios/Plugin/Classes/Results/FetchChannelsResult.swift +16 -0
- package/ios/Plugin/Classes/Results/{FetchLatestBundle.swift → FetchLatestBundleResult.swift} +6 -1
- package/ios/Plugin/Classes/Results/GetBlockedBundlesResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetConfigResult.swift +19 -0
- package/ios/Plugin/Classes/Results/GetDownloadedBundlesResult.swift +16 -0
- package/ios/Plugin/Classes/Results/IsSyncingResult.swift +16 -0
- package/ios/Plugin/Classes/Results/ReadyResult.swift +22 -0
- package/ios/Plugin/LiveUpdate.swift +456 -152
- package/ios/Plugin/LiveUpdateConfig.swift +3 -0
- package/ios/Plugin/LiveUpdateHttpClient.swift +21 -4
- package/ios/Plugin/LiveUpdatePlugin.swift +174 -14
- package/ios/Plugin/LiveUpdatePreferences.swift +54 -12
- package/ios/Plugin/Protocols/Api/GetChannelsResponseItem.swift +4 -0
- package/ios/Plugin/Protocols/Api/GetLatestBundleResponse.swift +1 -0
- package/package.json +5 -5
- package/ios/Plugin/LiveUpdatePlugin.h +0 -10
- package/ios/Plugin/LiveUpdatePlugin.m +0 -27
|
@@ -13,8 +13,8 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '13.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'Alamofire', '~> 5.9
|
|
17
|
-
s.dependency '
|
|
16
|
+
s.dependency 'Alamofire', '~> 5.9'
|
|
17
|
+
s.dependency 'ZIPFoundation', '~> 0.9.0'
|
|
18
18
|
s.swift_version = '5.1'
|
|
19
19
|
s.static_framework = true
|
|
20
20
|
end
|
package/README.md
CHANGED
|
@@ -66,17 +66,20 @@ We recommend to declare [`CA92.1`](https://developer.apple.com/documentation/bun
|
|
|
66
66
|
<docgen-config>
|
|
67
67
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
68
68
|
|
|
69
|
-
| Prop
|
|
70
|
-
|
|
|
71
|
-
| **`appId`**
|
|
72
|
-
| **`
|
|
73
|
-
| **`
|
|
74
|
-
| **`
|
|
75
|
-
| **`
|
|
76
|
-
| **`
|
|
77
|
-
| **`
|
|
78
|
-
| **`
|
|
79
|
-
| **`
|
|
69
|
+
| Prop | Type | Description | Default | Since |
|
|
70
|
+
| -------------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ----- |
|
|
71
|
+
| **`appId`** | <code>string</code> | The app ID is used to identify the app when using [Capawesome Cloud](https://capawesome.io/cloud). This is **NOT** the same as the app identifier (e.g. `com.example.app`). This is a unique identifier generated by Capawesome Cloud (e.g. `6e351b4f-69a7-415e-a057-4567df7ffe94`). | | 5.0.0 |
|
|
72
|
+
| **`autoBlockRolledBackBundles`** | <code>boolean</code> | Whether or not to automatically block bundles that have been rolled back. When enabled, the plugin will automatically block bundles that caused a rollback (up to 100 bundles). When the limit is reached, the oldest blocked bundle is unblocked. Blocked bundles will be skipped in future sync operations. **Attention**: This option has no effect if `readyTimeout` is set to `0`. Only available on Android and iOS. | <code>false</code> | 6.9.0 |
|
|
73
|
+
| **`autoDeleteBundles`** | <code>boolean</code> | Whether or not to automatically delete unused bundles. When enabled, the plugin will automatically delete unused bundles after calling `ready()`. | <code>false</code> | 5.0.0 |
|
|
74
|
+
| **`autoUpdateStrategy`** | <code>'none' \| 'background'</code> | The auto-update strategy for live updates. - `none`: Live updates will not be applied automatically. - `background`: Live updates will be automatically downloaded and applied in the background at app startup and when the app resumes (if the last check was more than 15 minutes ago). Only available on Android and iOS. | <code>'none'</code> | 6.9.0 |
|
|
75
|
+
| **`defaultChannel`** | <code>string</code> | The default channel of the app. This can be overridden by `setChannel()`, the `channel` parameter of `sync()`, or the native channel configuration (`CapawesomeLiveUpdateDefaultChannel` in `Info.plist` on iOS or `capawesome_live_update_default_channel` in `strings.xml` on Android). | | 6.3.0 |
|
|
76
|
+
| **`enabled`** | <code>boolean</code> | Whether or not the plugin is enabled. | <code>true</code> | 5.0.0 |
|
|
77
|
+
| **`httpTimeout`** | <code>number</code> | The timeout in milliseconds for HTTP requests. | <code>60000</code> | 6.4.0 |
|
|
78
|
+
| **`location`** | <code>'us' \| 'eu'</code> | The location of the server to use when using [Capawesome Cloud](https://capawesome.io/cloud). | <code>'us'</code> | 6.2.0 |
|
|
79
|
+
| **`publicKey`** | <code>string</code> | The public key to verify the integrity of the bundle. The public key must be a PEM-encoded RSA public key. | | 6.1.0 |
|
|
80
|
+
| **`readyTimeout`** | <code>number</code> | The timeout in milliseconds to wait for the app to be ready before resetting to the default bundle. | <code>10000</code> | 5.0.0 |
|
|
81
|
+
| **`resetOnUpdate`** | <code>boolean</code> | Whether or not the app should be reset to the default bundle during an update. | <code>true</code> | 5.0.0 |
|
|
82
|
+
| **`serverDomain`** | <code>string</code> | The API domain of the [Capawesome Cloud](https://cloud.capawesome.io) server **without** scheme or path. This option takes precedence over the `location` configuration option. | <code>'api.cloud.capawesome.io'</code> | 6.9.0 |
|
|
80
83
|
|
|
81
84
|
### Examples
|
|
82
85
|
|
|
@@ -87,14 +90,17 @@ In `capacitor.config.json`:
|
|
|
87
90
|
"plugins": {
|
|
88
91
|
"LiveUpdate": {
|
|
89
92
|
"appId": '6e351b4f-69a7-415e-a057-4567df7ffe94',
|
|
93
|
+
"autoBlockRolledBackBundles": undefined,
|
|
90
94
|
"autoDeleteBundles": undefined,
|
|
95
|
+
"autoUpdateStrategy": 'background',
|
|
91
96
|
"defaultChannel": 'production',
|
|
92
97
|
"enabled": undefined,
|
|
93
98
|
"httpTimeout": undefined,
|
|
94
99
|
"location": 'eu',
|
|
95
100
|
"publicKey": '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----',
|
|
96
101
|
"readyTimeout": undefined,
|
|
97
|
-
"resetOnUpdate": undefined
|
|
102
|
+
"resetOnUpdate": undefined,
|
|
103
|
+
"serverDomain": 'api.cloud.capawesome.eu'
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
106
|
}
|
|
@@ -111,7 +117,9 @@ const config: CapacitorConfig = {
|
|
|
111
117
|
plugins: {
|
|
112
118
|
LiveUpdate: {
|
|
113
119
|
appId: '6e351b4f-69a7-415e-a057-4567df7ffe94',
|
|
120
|
+
autoBlockRolledBackBundles: undefined,
|
|
114
121
|
autoDeleteBundles: undefined,
|
|
122
|
+
autoUpdateStrategy: 'background',
|
|
115
123
|
defaultChannel: 'production',
|
|
116
124
|
enabled: undefined,
|
|
117
125
|
httpTimeout: undefined,
|
|
@@ -119,6 +127,7 @@ const config: CapacitorConfig = {
|
|
|
119
127
|
publicKey: '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----',
|
|
120
128
|
readyTimeout: undefined,
|
|
121
129
|
resetOnUpdate: undefined,
|
|
130
|
+
serverDomain: 'api.cloud.capawesome.eu',
|
|
122
131
|
},
|
|
123
132
|
},
|
|
124
133
|
};
|
|
@@ -240,33 +249,64 @@ const isNewBundleAvailable = async () => {
|
|
|
240
249
|
|
|
241
250
|
<docgen-index>
|
|
242
251
|
|
|
252
|
+
* [`clearBlockedBundles()`](#clearblockedbundles)
|
|
243
253
|
* [`deleteBundle(...)`](#deletebundle)
|
|
244
254
|
* [`downloadBundle(...)`](#downloadbundle)
|
|
255
|
+
* [`fetchChannels(...)`](#fetchchannels)
|
|
245
256
|
* [`fetchLatestBundle(...)`](#fetchlatestbundle)
|
|
257
|
+
* [`getBlockedBundles()`](#getblockedbundles)
|
|
246
258
|
* [`getBundle()`](#getbundle)
|
|
247
259
|
* [`getBundles()`](#getbundles)
|
|
248
260
|
* [`getChannel()`](#getchannel)
|
|
261
|
+
* [`getConfig()`](#getconfig)
|
|
249
262
|
* [`getCurrentBundle()`](#getcurrentbundle)
|
|
250
263
|
* [`getCustomId()`](#getcustomid)
|
|
251
264
|
* [`getDeviceId()`](#getdeviceid)
|
|
265
|
+
* [`getDownloadedBundles()`](#getdownloadedbundles)
|
|
252
266
|
* [`getNextBundle()`](#getnextbundle)
|
|
253
267
|
* [`getVersionCode()`](#getversioncode)
|
|
254
268
|
* [`getVersionName()`](#getversionname)
|
|
269
|
+
* [`isSyncing()`](#issyncing)
|
|
255
270
|
* [`ready()`](#ready)
|
|
256
271
|
* [`reload()`](#reload)
|
|
257
272
|
* [`reset()`](#reset)
|
|
273
|
+
* [`resetConfig()`](#resetconfig)
|
|
258
274
|
* [`setBundle(...)`](#setbundle)
|
|
259
275
|
* [`setChannel(...)`](#setchannel)
|
|
276
|
+
* [`setConfig(...)`](#setconfig)
|
|
260
277
|
* [`setCustomId(...)`](#setcustomid)
|
|
261
278
|
* [`setNextBundle(...)`](#setnextbundle)
|
|
262
279
|
* [`sync(...)`](#sync)
|
|
280
|
+
* [`addListener('downloadBundleProgress', ...)`](#addlistenerdownloadbundleprogress-)
|
|
281
|
+
* [`addListener('nextBundleSet', ...)`](#addlistenernextbundleset-)
|
|
282
|
+
* [`addListener('reloaded', ...)`](#addlistenerreloaded-)
|
|
283
|
+
* [`removeAllListeners()`](#removealllisteners)
|
|
263
284
|
* [Interfaces](#interfaces)
|
|
285
|
+
* [Type Aliases](#type-aliases)
|
|
264
286
|
|
|
265
287
|
</docgen-index>
|
|
266
288
|
|
|
267
289
|
<docgen-api>
|
|
268
290
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
269
291
|
|
|
292
|
+
### clearBlockedBundles()
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
clearBlockedBundles() => Promise<void>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Clear all blocked bundles from the blocked list.
|
|
299
|
+
|
|
300
|
+
This removes all bundle identifiers that were automatically blocked
|
|
301
|
+
due to rollbacks when `autoBlockRolledBackBundles` is enabled.
|
|
302
|
+
|
|
303
|
+
Only available on Android and iOS.
|
|
304
|
+
|
|
305
|
+
**Since:** 6.9.0
|
|
306
|
+
|
|
307
|
+
--------------------
|
|
308
|
+
|
|
309
|
+
|
|
270
310
|
### deleteBundle(...)
|
|
271
311
|
|
|
272
312
|
```typescript
|
|
@@ -305,6 +345,35 @@ Only available on Android and iOS.
|
|
|
305
345
|
--------------------
|
|
306
346
|
|
|
307
347
|
|
|
348
|
+
### fetchChannels(...)
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
fetchChannels(options?: FetchChannelsOptions | undefined) => Promise<FetchChannelsResult>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Fetch channels from [Capawesome Cloud](https://capawesome.io/cloud/).
|
|
355
|
+
|
|
356
|
+
This is primarily intended for development and QA purposes.
|
|
357
|
+
It allows you to retrieve a list of available channels so you can
|
|
358
|
+
dynamically switch between them using `setChannel(...)`.
|
|
359
|
+
|
|
360
|
+
**Attention**: Only works for apps with public channels enabled.
|
|
361
|
+
If channels are private, they can still be set using `setChannel(...)`
|
|
362
|
+
but won't be returned by this method.
|
|
363
|
+
|
|
364
|
+
Only available on Android and iOS.
|
|
365
|
+
|
|
366
|
+
| Param | Type |
|
|
367
|
+
| ------------- | --------------------------------------------------------------------- |
|
|
368
|
+
| **`options`** | <code><a href="#fetchchannelsoptions">FetchChannelsOptions</a></code> |
|
|
369
|
+
|
|
370
|
+
**Returns:** <code>Promise<<a href="#fetchchannelsresult">FetchChannelsResult</a>></code>
|
|
371
|
+
|
|
372
|
+
**Since:** 6.9.0
|
|
373
|
+
|
|
374
|
+
--------------------
|
|
375
|
+
|
|
376
|
+
|
|
308
377
|
### fetchLatestBundle(...)
|
|
309
378
|
|
|
310
379
|
```typescript
|
|
@@ -326,6 +395,26 @@ Only available on Android and iOS.
|
|
|
326
395
|
--------------------
|
|
327
396
|
|
|
328
397
|
|
|
398
|
+
### getBlockedBundles()
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
getBlockedBundles() => Promise<GetBlockedBundlesResult>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Get all blocked bundle identifiers.
|
|
405
|
+
|
|
406
|
+
Returns the list of bundle identifiers that were automatically blocked
|
|
407
|
+
due to rollbacks when `autoBlockRolledBackBundles` is enabled.
|
|
408
|
+
|
|
409
|
+
Only available on Android and iOS.
|
|
410
|
+
|
|
411
|
+
**Returns:** <code>Promise<<a href="#getblockedbundlesresult">GetBlockedBundlesResult</a>></code>
|
|
412
|
+
|
|
413
|
+
**Since:** 6.9.0
|
|
414
|
+
|
|
415
|
+
--------------------
|
|
416
|
+
|
|
417
|
+
|
|
329
418
|
### getBundle()
|
|
330
419
|
|
|
331
420
|
```typescript
|
|
@@ -368,6 +457,15 @@ getChannel() => Promise<GetChannelResult>
|
|
|
368
457
|
|
|
369
458
|
Get the channel that is used for the update.
|
|
370
459
|
|
|
460
|
+
The channel is resolved in the following order (highest priority first):
|
|
461
|
+
1. `setChannel()` (SharedPreferences on Android / UserDefaults on iOS)
|
|
462
|
+
2. Capacitor config `defaultChannel`
|
|
463
|
+
3. Native config (`CapawesomeLiveUpdateDefaultChannel` in `Info.plist` on iOS or
|
|
464
|
+
`capawesome_live_update_default_channel` in `strings.xml` on Android)
|
|
465
|
+
|
|
466
|
+
**Note**: The `channel` parameter of `sync()` takes the highest priority
|
|
467
|
+
but is not persisted and therefore not returned by this method.
|
|
468
|
+
|
|
371
469
|
Only available on Android and iOS.
|
|
372
470
|
|
|
373
471
|
**Returns:** <code>Promise<<a href="#getchannelresult">GetChannelResult</a>></code>
|
|
@@ -377,6 +475,26 @@ Only available on Android and iOS.
|
|
|
377
475
|
--------------------
|
|
378
476
|
|
|
379
477
|
|
|
478
|
+
### getConfig()
|
|
479
|
+
|
|
480
|
+
```typescript
|
|
481
|
+
getConfig() => Promise<GetConfigResult>
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
Get the runtime configuration.
|
|
485
|
+
|
|
486
|
+
Returns the current plugin configuration including any runtime
|
|
487
|
+
overrides set via `setConfig()`.
|
|
488
|
+
|
|
489
|
+
Only available on Android and iOS.
|
|
490
|
+
|
|
491
|
+
**Returns:** <code>Promise<<a href="#getconfigresult">GetConfigResult</a>></code>
|
|
492
|
+
|
|
493
|
+
**Since:** 6.9.0
|
|
494
|
+
|
|
495
|
+
--------------------
|
|
496
|
+
|
|
497
|
+
|
|
380
498
|
### getCurrentBundle()
|
|
381
499
|
|
|
382
500
|
```typescript
|
|
@@ -429,6 +547,23 @@ Only available on Android and iOS.
|
|
|
429
547
|
--------------------
|
|
430
548
|
|
|
431
549
|
|
|
550
|
+
### getDownloadedBundles()
|
|
551
|
+
|
|
552
|
+
```typescript
|
|
553
|
+
getDownloadedBundles() => Promise<GetDownloadedBundlesResult>
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
Get all identifiers of bundles that have been downloaded.
|
|
557
|
+
|
|
558
|
+
Only available on Android and iOS.
|
|
559
|
+
|
|
560
|
+
**Returns:** <code>Promise<<a href="#getdownloadedbundlesresult">GetDownloadedBundlesResult</a>></code>
|
|
561
|
+
|
|
562
|
+
**Since:** 6.9.0
|
|
563
|
+
|
|
564
|
+
--------------------
|
|
565
|
+
|
|
566
|
+
|
|
432
567
|
### getNextBundle()
|
|
433
568
|
|
|
434
569
|
```typescript
|
|
@@ -482,10 +617,27 @@ Only available on Android and iOS.
|
|
|
482
617
|
--------------------
|
|
483
618
|
|
|
484
619
|
|
|
620
|
+
### isSyncing()
|
|
621
|
+
|
|
622
|
+
```typescript
|
|
623
|
+
isSyncing() => Promise<IsSyncingResult>
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
Check whether a sync operation is currently in progress.
|
|
627
|
+
|
|
628
|
+
Only available on Android and iOS.
|
|
629
|
+
|
|
630
|
+
**Returns:** <code>Promise<<a href="#issyncingresult">IsSyncingResult</a>></code>
|
|
631
|
+
|
|
632
|
+
**Since:** 6.9.0
|
|
633
|
+
|
|
634
|
+
--------------------
|
|
635
|
+
|
|
636
|
+
|
|
485
637
|
### ready()
|
|
486
638
|
|
|
487
639
|
```typescript
|
|
488
|
-
ready() => Promise<
|
|
640
|
+
ready() => Promise<ReadyResult>
|
|
489
641
|
```
|
|
490
642
|
|
|
491
643
|
Notify the plugin that the app is ready to use and no rollback is needed.
|
|
@@ -495,6 +647,8 @@ to prevent the app from being reset to the default bundle.
|
|
|
495
647
|
|
|
496
648
|
Only available on Android and iOS.
|
|
497
649
|
|
|
650
|
+
**Returns:** <code>Promise<<a href="#readyresult">ReadyResult</a>></code>
|
|
651
|
+
|
|
498
652
|
**Since:** 5.0.0
|
|
499
653
|
|
|
500
654
|
--------------------
|
|
@@ -532,6 +686,24 @@ Only available on Android and iOS.
|
|
|
532
686
|
--------------------
|
|
533
687
|
|
|
534
688
|
|
|
689
|
+
### resetConfig()
|
|
690
|
+
|
|
691
|
+
```typescript
|
|
692
|
+
resetConfig() => Promise<void>
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
Reset the runtime configuration to the values from the Capacitor config file.
|
|
696
|
+
|
|
697
|
+
This clears any runtime configuration set via `setConfig()`.
|
|
698
|
+
The changes take effect immediately.
|
|
699
|
+
|
|
700
|
+
Only available on Android and iOS.
|
|
701
|
+
|
|
702
|
+
**Since:** 6.9.0
|
|
703
|
+
|
|
704
|
+
--------------------
|
|
705
|
+
|
|
706
|
+
|
|
535
707
|
### setBundle(...)
|
|
536
708
|
|
|
537
709
|
```typescript
|
|
@@ -572,6 +744,32 @@ Only available on Android and iOS.
|
|
|
572
744
|
--------------------
|
|
573
745
|
|
|
574
746
|
|
|
747
|
+
### setConfig(...)
|
|
748
|
+
|
|
749
|
+
```typescript
|
|
750
|
+
setConfig(options: SetConfigOptions) => Promise<void>
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
Set the runtime configuration.
|
|
754
|
+
|
|
755
|
+
This allows updating plugin configuration options at runtime.
|
|
756
|
+
The changes are persisted across app restarts and take effect immediately.
|
|
757
|
+
|
|
758
|
+
**Important:** Runtime configuration is automatically reset to default values
|
|
759
|
+
whenever the native app is updated to a new version. This ensures that
|
|
760
|
+
configuration from previous versions doesn't persist after an app update.
|
|
761
|
+
|
|
762
|
+
Only available on Android and iOS.
|
|
763
|
+
|
|
764
|
+
| Param | Type |
|
|
765
|
+
| ------------- | ------------------------------------------------------------- |
|
|
766
|
+
| **`options`** | <code><a href="#setconfigoptions">SetConfigOptions</a></code> |
|
|
767
|
+
|
|
768
|
+
**Since:** 6.9.0
|
|
769
|
+
|
|
770
|
+
--------------------
|
|
771
|
+
|
|
772
|
+
|
|
575
773
|
### setCustomId(...)
|
|
576
774
|
|
|
577
775
|
```typescript
|
|
@@ -635,6 +833,95 @@ Only available on Android and iOS.
|
|
|
635
833
|
--------------------
|
|
636
834
|
|
|
637
835
|
|
|
836
|
+
### addListener('downloadBundleProgress', ...)
|
|
837
|
+
|
|
838
|
+
```typescript
|
|
839
|
+
addListener(eventName: 'downloadBundleProgress', listenerFunc: DownloadBundleProgressListener) => Promise<PluginListenerHandle>
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
Listen for the download progress of a bundle.
|
|
843
|
+
|
|
844
|
+
Only available on Android and iOS.
|
|
845
|
+
|
|
846
|
+
| Param | Type |
|
|
847
|
+
| ------------------ | ----------------------------------------------------------------------------------------- |
|
|
848
|
+
| **`eventName`** | <code>'downloadBundleProgress'</code> |
|
|
849
|
+
| **`listenerFunc`** | <code><a href="#downloadbundleprogresslistener">DownloadBundleProgressListener</a></code> |
|
|
850
|
+
|
|
851
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
852
|
+
|
|
853
|
+
**Since:** 6.9.0
|
|
854
|
+
|
|
855
|
+
--------------------
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
### addListener('nextBundleSet', ...)
|
|
859
|
+
|
|
860
|
+
```typescript
|
|
861
|
+
addListener(eventName: 'nextBundleSet', listenerFunc: NextBundleSetListener) => Promise<PluginListenerHandle>
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
Listen for when a bundle is set as the next bundle.
|
|
865
|
+
|
|
866
|
+
This event is triggered whenever a bundle is set to be used on the next app restart,
|
|
867
|
+
either through automatic updates or manual calls to `setNextBundle()`.
|
|
868
|
+
|
|
869
|
+
Only available on Android and iOS.
|
|
870
|
+
|
|
871
|
+
| Param | Type |
|
|
872
|
+
| ------------------ | ----------------------------------------------------------------------- |
|
|
873
|
+
| **`eventName`** | <code>'nextBundleSet'</code> |
|
|
874
|
+
| **`listenerFunc`** | <code><a href="#nextbundlesetlistener">NextBundleSetListener</a></code> |
|
|
875
|
+
|
|
876
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
877
|
+
|
|
878
|
+
**Since:** 6.9.0
|
|
879
|
+
|
|
880
|
+
--------------------
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
### addListener('reloaded', ...)
|
|
884
|
+
|
|
885
|
+
```typescript
|
|
886
|
+
addListener(eventName: 'reloaded', listenerFunc: ReloadedListener) => Promise<PluginListenerHandle>
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
Listen for when the app is reloaded.
|
|
890
|
+
|
|
891
|
+
This event is triggered after the `reload()` method is called
|
|
892
|
+
and the app has been reloaded.
|
|
893
|
+
|
|
894
|
+
**Note:** To verify whether an update was successfully applied after a reload,
|
|
895
|
+
use the `ready()` method instead. The `ready()` method provides detailed information
|
|
896
|
+
about the current bundle, previous bundle, and whether a rollback occurred.
|
|
897
|
+
|
|
898
|
+
Only available on Android and iOS.
|
|
899
|
+
|
|
900
|
+
| Param | Type |
|
|
901
|
+
| ------------------ | ------------------------------------------------------------- |
|
|
902
|
+
| **`eventName`** | <code>'reloaded'</code> |
|
|
903
|
+
| **`listenerFunc`** | <code><a href="#reloadedlistener">ReloadedListener</a></code> |
|
|
904
|
+
|
|
905
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
906
|
+
|
|
907
|
+
**Since:** 6.9.0
|
|
908
|
+
|
|
909
|
+
--------------------
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
### removeAllListeners()
|
|
913
|
+
|
|
914
|
+
```typescript
|
|
915
|
+
removeAllListeners() => Promise<void>
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
Remove all listeners for this plugin.
|
|
919
|
+
|
|
920
|
+
**Since:** 6.9.0
|
|
921
|
+
|
|
922
|
+
--------------------
|
|
923
|
+
|
|
924
|
+
|
|
638
925
|
### Interfaces
|
|
639
926
|
|
|
640
927
|
|
|
@@ -656,15 +943,40 @@ Only available on Android and iOS.
|
|
|
656
943
|
| **`url`** | <code>string</code> | The URL of the bundle to download. For the `zip` artifact type, the URL must point to a ZIP file. For the `manifest` artifact type, the URL serves as the base URL to download the individual files. For example, if the URL is `https://example.com/download`, the plugin will download the file with the href `index.html` from `https://example.com/download?href=index.html`. To **verify the integrity** of the file, the server must return a `X-Checksum` header with the SHA-256 hash in base64 format. To **verify the signature** of the file, the server must return a `X-Signature` header with the signed SHA-256 hash in base64 format. | | 5.0.0 |
|
|
657
944
|
|
|
658
945
|
|
|
946
|
+
#### FetchChannelsResult
|
|
947
|
+
|
|
948
|
+
| Prop | Type | Description | Since |
|
|
949
|
+
| -------------- | ---------------------- | --------------------- | ----- |
|
|
950
|
+
| **`channels`** | <code>Channel[]</code> | The list of channels. | 6.9.0 |
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
#### Channel
|
|
954
|
+
|
|
955
|
+
| Prop | Type | Description | Since |
|
|
956
|
+
| ---------- | ------------------- | ------------------------------------- | ----- |
|
|
957
|
+
| **`id`** | <code>string</code> | The unique identifier of the channel. | 6.9.0 |
|
|
958
|
+
| **`name`** | <code>string</code> | The name of the channel. | 6.9.0 |
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
#### FetchChannelsOptions
|
|
962
|
+
|
|
963
|
+
| Prop | Type | Description | Default | Since |
|
|
964
|
+
| ------------ | ------------------- | ----------------------------------------- | --------------- | ----- |
|
|
965
|
+
| **`limit`** | <code>number</code> | The maximum number of channels to return. | <code>50</code> | 6.9.0 |
|
|
966
|
+
| **`offset`** | <code>number</code> | The number of channels to skip. | <code>0</code> | 6.9.0 |
|
|
967
|
+
| **`query`** | <code>string</code> | The query to filter channels by name. | | 6.9.0 |
|
|
968
|
+
|
|
969
|
+
|
|
659
970
|
#### FetchLatestBundleResult
|
|
660
971
|
|
|
661
|
-
| Prop
|
|
662
|
-
|
|
|
663
|
-
| **`artifactType`**
|
|
664
|
-
| **`bundleId`**
|
|
665
|
-
| **`checksum`**
|
|
666
|
-
| **`
|
|
667
|
-
| **`
|
|
972
|
+
| Prop | Type | Description | Since |
|
|
973
|
+
| ---------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
974
|
+
| **`artifactType`** | <code>'manifest' \| 'zip'</code> | The artifact type of the bundle. | 6.7.0 |
|
|
975
|
+
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the latest bundle. If `null`, no bundle is available. | 6.6.0 |
|
|
976
|
+
| **`checksum`** | <code>string</code> | The checksum of the latest bundle if the bundle is self-hosted. If the bundle is hosted on Capawesome Cloud, the checksum will be returned as response header when downloading the bundle. | 6.8.0 |
|
|
977
|
+
| **`customProperties`** | <code>{ [key: string]: string; }</code> | Custom properties that are associated with the latest bundle. | 6.9.0 |
|
|
978
|
+
| **`downloadUrl`** | <code>string</code> | The URL of the latest bundle to download. Pass this URL to the `downloadBundle(...)` method to download the bundle. | 6.7.0 |
|
|
979
|
+
| **`signature`** | <code>string</code> | The signature of the latest bundle if the bundle is self-hosted. If the bundle is hosted on Capawesome Cloud, the signature will be returned as response header when downloading the bundle. | 6.8.0 |
|
|
668
980
|
|
|
669
981
|
|
|
670
982
|
#### FetchLatestBundleOptions
|
|
@@ -674,6 +986,13 @@ Only available on Android and iOS.
|
|
|
674
986
|
| **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 6.7.0 |
|
|
675
987
|
|
|
676
988
|
|
|
989
|
+
#### GetBlockedBundlesResult
|
|
990
|
+
|
|
991
|
+
| Prop | Type | Description | Since |
|
|
992
|
+
| --------------- | --------------------- | ------------------------------------------------------ | ----- |
|
|
993
|
+
| **`bundleIds`** | <code>string[]</code> | An array of unique identifiers of all blocked bundles. | 6.9.0 |
|
|
994
|
+
|
|
995
|
+
|
|
677
996
|
#### GetBundleResult
|
|
678
997
|
|
|
679
998
|
| Prop | Type | Description | Since |
|
|
@@ -695,6 +1014,14 @@ Only available on Android and iOS.
|
|
|
695
1014
|
| **`channel`** | <code>string \| null</code> | The channel name. If `null`, the app is using the default channel. | 5.0.0 |
|
|
696
1015
|
|
|
697
1016
|
|
|
1017
|
+
#### GetConfigResult
|
|
1018
|
+
|
|
1019
|
+
| Prop | Type | Description | Since |
|
|
1020
|
+
| ------------------------ | ----------------------------------- | ------------------------------------------------------------------------ | ----- |
|
|
1021
|
+
| **`appId`** | <code>string \| null</code> | The app ID used to identify the app. If `null`, no app ID is configured. | 6.9.0 |
|
|
1022
|
+
| **`autoUpdateStrategy`** | <code>'none' \| 'background'</code> | The auto-update strategy for live updates. | 6.9.0 |
|
|
1023
|
+
|
|
1024
|
+
|
|
698
1025
|
#### GetCurrentBundleResult
|
|
699
1026
|
|
|
700
1027
|
| Prop | Type | Description | Since |
|
|
@@ -716,6 +1043,13 @@ Only available on Android and iOS.
|
|
|
716
1043
|
| **`deviceId`** | <code>string</code> | The unique identifier of the device. On iOS, [`identifierForVendor`](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor) is used. The value of this property is the same for apps that come from the same vendor running on the same device. | 5.0.0 |
|
|
717
1044
|
|
|
718
1045
|
|
|
1046
|
+
#### GetDownloadedBundlesResult
|
|
1047
|
+
|
|
1048
|
+
| Prop | Type | Description | Since |
|
|
1049
|
+
| --------------- | --------------------- | --------------------------------------------------------- | ----- |
|
|
1050
|
+
| **`bundleIds`** | <code>string[]</code> | An array of unique identifiers of all downloaded bundles. | 6.9.0 |
|
|
1051
|
+
|
|
1052
|
+
|
|
719
1053
|
#### GetNextBundleResult
|
|
720
1054
|
|
|
721
1055
|
| Prop | Type | Description | Since |
|
|
@@ -737,6 +1071,22 @@ Only available on Android and iOS.
|
|
|
737
1071
|
| **`versionName`** | <code>string</code> | The version name of the app. On **Android**, this is the `versionName` from the `android/app/build.gradle` file. On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file. | 5.0.0 |
|
|
738
1072
|
|
|
739
1073
|
|
|
1074
|
+
#### IsSyncingResult
|
|
1075
|
+
|
|
1076
|
+
| Prop | Type | Description | Since |
|
|
1077
|
+
| ------------- | -------------------- | -------------------------------------------------- | ----- |
|
|
1078
|
+
| **`syncing`** | <code>boolean</code> | Whether a sync operation is currently in progress. | 6.9.0 |
|
|
1079
|
+
|
|
1080
|
+
|
|
1081
|
+
#### ReadyResult
|
|
1082
|
+
|
|
1083
|
+
| Prop | Type | Description | Since |
|
|
1084
|
+
| ---------------------- | --------------------------- | --------------------------------------------------------------------------------------- | ----- |
|
|
1085
|
+
| **`previousBundleId`** | <code>string \| null</code> | The identifier of the previous bundle used. If `null`, the default bundle was used. | 6.9.0 |
|
|
1086
|
+
| **`currentBundleId`** | <code>string \| null</code> | The identifier of the current bundle used. If `null`, the default bundle is being used. | 6.9.0 |
|
|
1087
|
+
| **`rollback`** | <code>boolean</code> | Whether or not the app was reset to the default bundle. | 6.9.0 |
|
|
1088
|
+
|
|
1089
|
+
|
|
740
1090
|
#### SetBundleOptions
|
|
741
1091
|
|
|
742
1092
|
| Prop | Type | Description | Since |
|
|
@@ -751,6 +1101,13 @@ Only available on Android and iOS.
|
|
|
751
1101
|
| **`channel`** | <code>string \| null</code> | The channel name. Set `null` to remove the channel. | 5.0.0 |
|
|
752
1102
|
|
|
753
1103
|
|
|
1104
|
+
#### SetConfigOptions
|
|
1105
|
+
|
|
1106
|
+
| Prop | Type | Description | Since |
|
|
1107
|
+
| ----------- | --------------------------- | ----------------------------------------------------------------------------------------------------- | ----- |
|
|
1108
|
+
| **`appId`** | <code>string \| null</code> | The app ID used to identify the app. Set `null` to reset to the value from the Capacitor config file. | 6.9.0 |
|
|
1109
|
+
|
|
1110
|
+
|
|
754
1111
|
#### SetCustomIdOptions
|
|
755
1112
|
|
|
756
1113
|
| Prop | Type | Description | Since |
|
|
@@ -778,6 +1135,58 @@ Only available on Android and iOS.
|
|
|
778
1135
|
| ------------- | ------------------- | ---------------------------------------------------------------- | ----- |
|
|
779
1136
|
| **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 6.7.0 |
|
|
780
1137
|
|
|
1138
|
+
|
|
1139
|
+
#### PluginListenerHandle
|
|
1140
|
+
|
|
1141
|
+
| Prop | Type |
|
|
1142
|
+
| ------------ | ----------------------------------------- |
|
|
1143
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
#### DownloadBundleProgressEvent
|
|
1147
|
+
|
|
1148
|
+
Event that is triggered when the download progress of a bundle changes.
|
|
1149
|
+
|
|
1150
|
+
| Prop | Type | Description | Since |
|
|
1151
|
+
| --------------------- | ------------------- | ----------------------------------------------------------------------- | ----- |
|
|
1152
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle that is being downloaded. | 6.9.0 |
|
|
1153
|
+
| **`downloadedBytes`** | <code>number</code> | The number of bytes that have been downloaded. | 6.9.0 |
|
|
1154
|
+
| **`progress`** | <code>number</code> | The progress of the download in percent as a value between `0` and `1`. | 6.9.0 |
|
|
1155
|
+
| **`totalBytes`** | <code>number</code> | The total number of bytes to download. | 6.9.0 |
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
#### NextBundleSetEvent
|
|
1159
|
+
|
|
1160
|
+
Event that is triggered when a bundle is set as the next bundle.
|
|
1161
|
+
|
|
1162
|
+
| Prop | Type | Description | Since |
|
|
1163
|
+
| -------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------- | ----- |
|
|
1164
|
+
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the bundle that is set as the next bundle. If `null`, the default bundle will be used. | 6.9.0 |
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
### Type Aliases
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
#### DownloadBundleProgressListener
|
|
1171
|
+
|
|
1172
|
+
Listener for the download progress of a bundle.
|
|
1173
|
+
|
|
1174
|
+
<code>(event: <a href="#downloadbundleprogressevent">DownloadBundleProgressEvent</a>): void</code>
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
#### NextBundleSetListener
|
|
1178
|
+
|
|
1179
|
+
Listener for when a bundle is set as the next bundle.
|
|
1180
|
+
|
|
1181
|
+
<code>(event: <a href="#nextbundlesetevent">NextBundleSetEvent</a>): void</code>
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
#### ReloadedListener
|
|
1185
|
+
|
|
1186
|
+
Listener for when the app is reloaded.
|
|
1187
|
+
|
|
1188
|
+
<code>(): void</code>
|
|
1189
|
+
|
|
781
1190
|
</docgen-api>
|
|
782
1191
|
|
|
783
1192
|
## Testing
|