@capawesome/capacitor-live-update 6.8.0 → 7.0.0-dev.2633ff2.1765953041
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 +3 -3
- package/Package.swift +32 -0
- package/README.md +438 -86
- package/android/build.gradle +12 -12
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdate.java +754 -279
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateConfig.java +29 -27
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdateHttpClient.java +40 -7
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/LiveUpdatePlugin.java +210 -67
- 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/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/{results/GetBundleResult.java → events/NextBundleSetEvent.java} +9 -7
- 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/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 +597 -102
- package/dist/esm/definitions.d.ts +338 -39
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +9 -2
- package/dist/esm/web.js +21 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +22 -3
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +22 -3
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/Classes/Events/DownloadBundleProgressEvent.swift +25 -0
- package/ios/Plugin/Classes/{Results/GetBundleResult.swift → Events/NextBundleSetEvent.swift} +3 -3
- package/ios/Plugin/Classes/Options/SetConfigOptions.swift +14 -0
- package/ios/Plugin/Classes/Options/SyncOptions.swift +4 -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 +365 -149
- package/ios/Plugin/LiveUpdateConfig.swift +4 -4
- package/ios/Plugin/LiveUpdateHttpClient.swift +10 -4
- package/ios/Plugin/LiveUpdatePlugin.swift +136 -34
- package/ios/Plugin/LiveUpdatePreferences.swift +54 -12
- package/ios/Plugin/Protocols/Api/GetLatestBundleResponse.swift +1 -0
- package/package.json +19 -20
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/liveupdate/classes/options/SetBundleOptions.java +0 -18
- package/ios/Plugin/Classes/Options/SetBundleOptions.swift +0 -14
- package/ios/Plugin/LiveUpdatePlugin.h +0 -10
- package/ios/Plugin/LiveUpdatePlugin.m +0 -27
package/README.md
CHANGED
|
@@ -1,21 +1,51 @@
|
|
|
1
1
|
# @capawesome/capacitor-live-update
|
|
2
2
|
|
|
3
|
-
Capacitor plugin to update your app remotely in real-time.
|
|
3
|
+
Capacitor plugin that allows you to update your app remotely in real-time without requiring users to download a new version from the app store, known as Over-the-Air (OTA) updates.
|
|
4
|
+
|
|
5
|
+
<div class="capawesome-z29o10a">
|
|
6
|
+
<a href="https://cloud.capawesome.io/" target="_blank">
|
|
7
|
+
<img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.png?t=1" />
|
|
8
|
+
</a>
|
|
9
|
+
</div>
|
|
4
10
|
|
|
5
11
|
## Features
|
|
6
12
|
|
|
13
|
+
We are proud to offer one of the most complete and feature-rich Capacitor plugins for Over-the-Air (OTA) updates. Here are some of the key features:
|
|
14
|
+
|
|
7
15
|
- 🔋 Supports **Android and iOS**
|
|
8
|
-
- ⚡️ **Capacitor
|
|
16
|
+
- ⚡️ **Capacitor 7** support
|
|
9
17
|
- 📦 **Bundle Management**: Download, set, and delete bundles.
|
|
10
|
-
- ☁️ **Cloud Support**: Use the [Capawesome Cloud](https://capawesome.io/
|
|
18
|
+
- ☁️ **Cloud Support**: Use the [Capawesome Cloud](https://cloud.capawesome.io/) to manage your app updates.
|
|
11
19
|
- 📺 **Channel Support**: Set a channel for the app to manage different versions.
|
|
12
|
-
- 🔄 **Auto Update**: Automatically download and set the latest bundle for the app.
|
|
20
|
+
- 🔄 **Auto Update**: Automatically download and set the latest bundle for the app with configurable background update strategy.
|
|
13
21
|
- 🛟 **Rollback**: Reset the app to the default bundle if an incompatible bundle has been set.
|
|
14
22
|
- 🚀 **Rollout**: Gradually roll out new bundles to gather valuable feedback.
|
|
15
23
|
- 🔁 **Delta Updates**: Make your updates faster by only downloading changed files.
|
|
16
24
|
- 🔒 **Security**: Verify the authenticity and integrity of the bundle using a public key.
|
|
25
|
+
- ⚔️ **Battle-Tested**: Used in more than 1,000 projects to update apps on more than 20,000,000 devices.
|
|
17
26
|
- 🌐 **Open Source**: Licensed under the MIT License.
|
|
18
27
|
|
|
28
|
+
Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!
|
|
29
|
+
|
|
30
|
+
## Compatibility
|
|
31
|
+
|
|
32
|
+
| Plugin Version | Capacitor Version | Status |
|
|
33
|
+
| -------------- | ----------------- | -------------- |
|
|
34
|
+
| 8.x.x | >=8.x.x | Active support |
|
|
35
|
+
| 7.x.x | 7.x.x | Maintenance |
|
|
36
|
+
| 6.x.x | 6.x.x | Deprecated |
|
|
37
|
+
| 5.x.x | 5.x.x | Deprecated |
|
|
38
|
+
|
|
39
|
+
## Guides
|
|
40
|
+
|
|
41
|
+
- [Announcing the Capacitor Live Update Plugin](https://capawesome.io/blog/announcing-the-capacitor-live-update-plugin/)
|
|
42
|
+
- [Exploring the Capacitor Live Update API](https://capawesome.io/blog/exploring-the-capacitor-live-update-api/)
|
|
43
|
+
- [How Live Updates for Capacitor work](https://capawesome.io/blog/how-live-updates-for-capacitor-work/)
|
|
44
|
+
- [How to gradually roll out Capacitor Live Updates](https://capawesome.io/blog/how-to-gradually-roll-out-capacitor-live-updates/#update-a-bundle)
|
|
45
|
+
- [How to restrict Capacitor Live Updates to Native Versions](https://capawesome.io/blog/how-to-restrict-capacitor-live-updates-to-native-versions/)
|
|
46
|
+
- [Live Updates for Nuxt Capacitor Apps with Capawesome Cloud](https://capawesome.io/blog/live-updates-for-nuxt-capacitor/)
|
|
47
|
+
- [Migrating from App Center to Capawesome Cloud](https://capawesome.io/blog/migrating-from-app-center-to-capawesome-cloud/)
|
|
48
|
+
|
|
19
49
|
## Installation
|
|
20
50
|
|
|
21
51
|
```bash
|
|
@@ -27,11 +57,13 @@ npx cap sync
|
|
|
27
57
|
|
|
28
58
|
#### Variables
|
|
29
59
|
|
|
30
|
-
|
|
60
|
+
If needed, you can define the following project variable in your app’s `variables.gradle` file to change the default version of the dependency:
|
|
31
61
|
|
|
32
|
-
- `$okhttp3Version` version of `com.squareup.okhttp3:okhttp` (default: `
|
|
62
|
+
- `$okhttp3Version` version of `com.squareup.okhttp3:okhttp` (default: `5.3.2`)
|
|
33
63
|
- `$zip4jVersion` version of `net.lingala.zip4j:zip4j` (default: `2.11.5`)
|
|
34
64
|
|
|
65
|
+
This can be useful if you encounter dependency conflicts with other plugins in your project.
|
|
66
|
+
|
|
35
67
|
### iOS
|
|
36
68
|
|
|
37
69
|
#### Privacy manifest
|
|
@@ -61,22 +93,41 @@ Add the `NSPrivacyAccessedAPICategoryUserDefaults` dictionary key to your [Priva
|
|
|
61
93
|
|
|
62
94
|
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.
|
|
63
95
|
|
|
96
|
+
#### Minimum Deployment Target
|
|
97
|
+
|
|
98
|
+
The minimum iOS deployment target is set to `16.0` to address several security vulnerabilities related to ZIP file handling in earlier iOS versions. This ensures that apps using this plugin are protected against these vulnerabilities.
|
|
99
|
+
|
|
100
|
+
If you are using **Swift Package Manager**, make sure that your iOS deployment target is set to at least `16.0` in your Xcode project settings (usually in `ios/App/App.xcodeproj`):
|
|
101
|
+
|
|
102
|
+
```diff
|
|
103
|
+
-IPHONEOS_DEPLOYMENT_TARGET = 15.0
|
|
104
|
+
+IPHONEOS_DEPLOYMENT_TARGET = 16.0
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
If you are using **CocoaPods**, make sure that your iOS deployment target is set to at least `16.0` in your `Podfile`:
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
platform :ios, '16.0'
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Note:** iOS 16 was released in 2022 and is supported by the majority of active iOS devices, including iPhone X, iPhone 8, and all newer models.
|
|
114
|
+
|
|
64
115
|
## Configuration
|
|
65
116
|
|
|
66
117
|
<docgen-config>
|
|
67
118
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
68
119
|
|
|
69
|
-
| Prop
|
|
70
|
-
|
|
|
71
|
-
| **`appId`**
|
|
72
|
-
| **`
|
|
73
|
-
| **`
|
|
74
|
-
| **`
|
|
75
|
-
| **`
|
|
76
|
-
| **`
|
|
77
|
-
| **`publicKey`**
|
|
78
|
-
| **`readyTimeout`**
|
|
79
|
-
| **`
|
|
120
|
+
| Prop | Type | Description | Default | Since |
|
|
121
|
+
| -------------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ----- |
|
|
122
|
+
| **`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 |
|
|
123
|
+
| **`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> | 7.3.0 |
|
|
124
|
+
| **`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 |
|
|
125
|
+
| **`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> | 7.3.0 |
|
|
126
|
+
| **`defaultChannel`** | <code>string</code> | The default channel of the app. | | 6.3.0 |
|
|
127
|
+
| **`httpTimeout`** | <code>number</code> | The timeout in milliseconds for HTTP requests. | <code>60000</code> | 6.4.0 |
|
|
128
|
+
| **`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 |
|
|
129
|
+
| **`readyTimeout`** | <code>number</code> | The timeout in milliseconds to wait for the app to be ready before resetting to the default bundle. It is strongly **recommended** to configure this option (e.g. `10000` ms) so that the plugin can roll back to the default bundle in case of problems. If configured, the plugin will wait for the app to call the `ready()` method before resetting to the default bundle. Set to `0` to disable the timeout. | <code>0</code> | 5.0.0 |
|
|
130
|
+
| **`serverDomain`** | <code>string</code> | The API domain of the [Capawesome Cloud](https://cloud.capawesome.io) server **without** scheme or path. | <code>'api.cloud.capawesome.io'</code> | 7.0.0 |
|
|
80
131
|
|
|
81
132
|
### Examples
|
|
82
133
|
|
|
@@ -87,14 +138,14 @@ In `capacitor.config.json`:
|
|
|
87
138
|
"plugins": {
|
|
88
139
|
"LiveUpdate": {
|
|
89
140
|
"appId": '6e351b4f-69a7-415e-a057-4567df7ffe94',
|
|
141
|
+
"autoBlockRolledBackBundles": undefined,
|
|
90
142
|
"autoDeleteBundles": undefined,
|
|
143
|
+
"autoUpdateStrategy": 'background',
|
|
91
144
|
"defaultChannel": 'production',
|
|
92
|
-
"enabled": undefined,
|
|
93
145
|
"httpTimeout": undefined,
|
|
94
|
-
"location": 'eu',
|
|
95
146
|
"publicKey": '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----',
|
|
96
|
-
"readyTimeout":
|
|
97
|
-
"
|
|
147
|
+
"readyTimeout": 10000,
|
|
148
|
+
"serverDomain": 'api.cloud.capawesome.eu'
|
|
98
149
|
}
|
|
99
150
|
}
|
|
100
151
|
}
|
|
@@ -111,14 +162,14 @@ const config: CapacitorConfig = {
|
|
|
111
162
|
plugins: {
|
|
112
163
|
LiveUpdate: {
|
|
113
164
|
appId: '6e351b4f-69a7-415e-a057-4567df7ffe94',
|
|
165
|
+
autoBlockRolledBackBundles: undefined,
|
|
114
166
|
autoDeleteBundles: undefined,
|
|
167
|
+
autoUpdateStrategy: 'background',
|
|
115
168
|
defaultChannel: 'production',
|
|
116
|
-
enabled: undefined,
|
|
117
169
|
httpTimeout: undefined,
|
|
118
|
-
location: 'eu',
|
|
119
170
|
publicKey: '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----',
|
|
120
|
-
readyTimeout:
|
|
121
|
-
|
|
171
|
+
readyTimeout: 10000,
|
|
172
|
+
serverDomain: 'api.cloud.capawesome.eu',
|
|
122
173
|
},
|
|
123
174
|
},
|
|
124
175
|
};
|
|
@@ -128,17 +179,6 @@ export default config;
|
|
|
128
179
|
|
|
129
180
|
</docgen-config>
|
|
130
181
|
|
|
131
|
-
## Starter templates
|
|
132
|
-
|
|
133
|
-
The following starter templates are available:
|
|
134
|
-
|
|
135
|
-
- [Ionstarter Angular Firebase](https://ionstarter.dev/)
|
|
136
|
-
- [Ionstarter Angular SQLite](https://ionstarter.dev/)
|
|
137
|
-
|
|
138
|
-
## Guides
|
|
139
|
-
|
|
140
|
-
- [Announcing the Capacitor Live Update Plugin](https://capawesome.io/blog/announcing-the-capacitor-live-update-plugin/)
|
|
141
|
-
|
|
142
182
|
## Usage
|
|
143
183
|
|
|
144
184
|
```typescript
|
|
@@ -197,7 +237,16 @@ const getVersionName = async () => {
|
|
|
197
237
|
};
|
|
198
238
|
|
|
199
239
|
const ready = async () => {
|
|
200
|
-
await LiveUpdate.ready();
|
|
240
|
+
const result = await LiveUpdate.ready();
|
|
241
|
+
if (result.currentBundleId) {
|
|
242
|
+
console.log(`The app is now using the bundle with the identifier ${result.currentBundleId}.`);
|
|
243
|
+
}
|
|
244
|
+
if (result.previousBundleId) {
|
|
245
|
+
console.log(`The app was using the bundle with the identifier ${result.previousBundleId}.`);
|
|
246
|
+
}
|
|
247
|
+
if (result.rollback) {
|
|
248
|
+
console.log('The app was reset to the default bundle.');
|
|
249
|
+
}
|
|
201
250
|
};
|
|
202
251
|
|
|
203
252
|
const reload = async () => {
|
|
@@ -209,7 +258,7 @@ const reset = async () => {
|
|
|
209
258
|
};
|
|
210
259
|
|
|
211
260
|
const setChannel = async () => {
|
|
212
|
-
await LiveUpdate.setChannel({ channel: '
|
|
261
|
+
await LiveUpdate.setChannel({ channel: 'production-5' });
|
|
213
262
|
};
|
|
214
263
|
|
|
215
264
|
const setCustomId = async () => {
|
|
@@ -217,18 +266,22 @@ const setCustomId = async () => {
|
|
|
217
266
|
};
|
|
218
267
|
|
|
219
268
|
const setNextBundle = async () => {
|
|
220
|
-
await LiveUpdate.setNextBundle({ bundleId: '
|
|
269
|
+
await LiveUpdate.setNextBundle({ bundleId: '7f0b9bf2-dff6-4be2-bcac-b068cc5ea756' });
|
|
221
270
|
};
|
|
222
271
|
|
|
223
272
|
const sync = async () => {
|
|
224
|
-
const result = await LiveUpdate.sync(
|
|
273
|
+
const result = await LiveUpdate.sync({
|
|
274
|
+
channel: 'production-5',
|
|
275
|
+
});
|
|
225
276
|
return result.nextBundleId;
|
|
226
277
|
};
|
|
227
278
|
|
|
228
279
|
const isNewBundleAvailable = async () => {
|
|
229
|
-
const { bundleId: latestBundleId } = await LiveUpdate.fetchLatestBundle(
|
|
280
|
+
const { bundleId: latestBundleId } = await LiveUpdate.fetchLatestBundle({
|
|
281
|
+
channel: 'production-5',
|
|
282
|
+
});
|
|
230
283
|
if (latestBundleId) {
|
|
231
|
-
const { bundleId: currentBundleId } = await LiveUpdate.
|
|
284
|
+
const { bundleId: currentBundleId } = await LiveUpdate.getCurrentBundle();
|
|
232
285
|
return latestBundleId !== currentBundleId;
|
|
233
286
|
} else {
|
|
234
287
|
return false;
|
|
@@ -240,33 +293,61 @@ const isNewBundleAvailable = async () => {
|
|
|
240
293
|
|
|
241
294
|
<docgen-index>
|
|
242
295
|
|
|
296
|
+
* [`clearBlockedBundles()`](#clearblockedbundles)
|
|
243
297
|
* [`deleteBundle(...)`](#deletebundle)
|
|
244
298
|
* [`downloadBundle(...)`](#downloadbundle)
|
|
245
299
|
* [`fetchLatestBundle(...)`](#fetchlatestbundle)
|
|
246
|
-
* [`
|
|
300
|
+
* [`getBlockedBundles()`](#getblockedbundles)
|
|
247
301
|
* [`getBundles()`](#getbundles)
|
|
248
302
|
* [`getChannel()`](#getchannel)
|
|
303
|
+
* [`getConfig()`](#getconfig)
|
|
304
|
+
* [`getDownloadedBundles()`](#getdownloadedbundles)
|
|
249
305
|
* [`getCurrentBundle()`](#getcurrentbundle)
|
|
250
306
|
* [`getCustomId()`](#getcustomid)
|
|
251
307
|
* [`getDeviceId()`](#getdeviceid)
|
|
308
|
+
* [`isSyncing()`](#issyncing)
|
|
252
309
|
* [`getNextBundle()`](#getnextbundle)
|
|
253
310
|
* [`getVersionCode()`](#getversioncode)
|
|
254
311
|
* [`getVersionName()`](#getversionname)
|
|
255
312
|
* [`ready()`](#ready)
|
|
256
313
|
* [`reload()`](#reload)
|
|
257
314
|
* [`reset()`](#reset)
|
|
258
|
-
* [`
|
|
315
|
+
* [`resetConfig()`](#resetconfig)
|
|
259
316
|
* [`setChannel(...)`](#setchannel)
|
|
317
|
+
* [`setConfig(...)`](#setconfig)
|
|
260
318
|
* [`setCustomId(...)`](#setcustomid)
|
|
261
319
|
* [`setNextBundle(...)`](#setnextbundle)
|
|
262
320
|
* [`sync(...)`](#sync)
|
|
321
|
+
* [`addListener('downloadBundleProgress', ...)`](#addlistenerdownloadbundleprogress-)
|
|
322
|
+
* [`addListener('nextBundleSet', ...)`](#addlistenernextbundleset-)
|
|
323
|
+
* [`addListener('reloaded', ...)`](#addlistenerreloaded-)
|
|
324
|
+
* [`removeAllListeners()`](#removealllisteners)
|
|
263
325
|
* [Interfaces](#interfaces)
|
|
326
|
+
* [Type Aliases](#type-aliases)
|
|
264
327
|
|
|
265
328
|
</docgen-index>
|
|
266
329
|
|
|
267
330
|
<docgen-api>
|
|
268
331
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
269
332
|
|
|
333
|
+
### clearBlockedBundles()
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
clearBlockedBundles() => Promise<void>
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Clear all blocked bundles from the blocked list.
|
|
340
|
+
|
|
341
|
+
This removes all bundle identifiers that were automatically blocked
|
|
342
|
+
due to rollbacks when `autoBlockRolledBackBundles` is enabled.
|
|
343
|
+
|
|
344
|
+
Only available on Android and iOS.
|
|
345
|
+
|
|
346
|
+
**Since:** 7.4.0
|
|
347
|
+
|
|
348
|
+
--------------------
|
|
349
|
+
|
|
350
|
+
|
|
270
351
|
### deleteBundle(...)
|
|
271
352
|
|
|
272
353
|
```typescript
|
|
@@ -326,19 +407,22 @@ Only available on Android and iOS.
|
|
|
326
407
|
--------------------
|
|
327
408
|
|
|
328
409
|
|
|
329
|
-
###
|
|
410
|
+
### getBlockedBundles()
|
|
330
411
|
|
|
331
412
|
```typescript
|
|
332
|
-
|
|
413
|
+
getBlockedBundles() => Promise<GetBlockedBundlesResult>
|
|
333
414
|
```
|
|
334
415
|
|
|
335
|
-
Get
|
|
416
|
+
Get all blocked bundle identifiers.
|
|
417
|
+
|
|
418
|
+
Returns the list of bundle identifiers that were automatically blocked
|
|
419
|
+
due to rollbacks when `autoBlockRolledBackBundles` is enabled.
|
|
336
420
|
|
|
337
421
|
Only available on Android and iOS.
|
|
338
422
|
|
|
339
|
-
**Returns:** <code>Promise<<a href="#
|
|
423
|
+
**Returns:** <code>Promise<<a href="#getblockedbundlesresult">GetBlockedBundlesResult</a>></code>
|
|
340
424
|
|
|
341
|
-
**Since:**
|
|
425
|
+
**Since:** 7.4.0
|
|
342
426
|
|
|
343
427
|
--------------------
|
|
344
428
|
|
|
@@ -377,6 +461,43 @@ Only available on Android and iOS.
|
|
|
377
461
|
--------------------
|
|
378
462
|
|
|
379
463
|
|
|
464
|
+
### getConfig()
|
|
465
|
+
|
|
466
|
+
```typescript
|
|
467
|
+
getConfig() => Promise<GetConfigResult>
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Get the runtime configuration.
|
|
471
|
+
|
|
472
|
+
Returns the current plugin configuration including any runtime
|
|
473
|
+
overrides set via `setConfig()`.
|
|
474
|
+
|
|
475
|
+
Only available on Android and iOS.
|
|
476
|
+
|
|
477
|
+
**Returns:** <code>Promise<<a href="#getconfigresult">GetConfigResult</a>></code>
|
|
478
|
+
|
|
479
|
+
**Since:** 7.4.0
|
|
480
|
+
|
|
481
|
+
--------------------
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
### getDownloadedBundles()
|
|
485
|
+
|
|
486
|
+
```typescript
|
|
487
|
+
getDownloadedBundles() => Promise<GetDownloadedBundlesResult>
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
Get all identifiers of bundles that have been downloaded.
|
|
491
|
+
|
|
492
|
+
Only available on Android and iOS.
|
|
493
|
+
|
|
494
|
+
**Returns:** <code>Promise<<a href="#getdownloadedbundlesresult">GetDownloadedBundlesResult</a>></code>
|
|
495
|
+
|
|
496
|
+
**Since:** 7.4.0
|
|
497
|
+
|
|
498
|
+
--------------------
|
|
499
|
+
|
|
500
|
+
|
|
380
501
|
### getCurrentBundle()
|
|
381
502
|
|
|
382
503
|
```typescript
|
|
@@ -429,6 +550,23 @@ Only available on Android and iOS.
|
|
|
429
550
|
--------------------
|
|
430
551
|
|
|
431
552
|
|
|
553
|
+
### isSyncing()
|
|
554
|
+
|
|
555
|
+
```typescript
|
|
556
|
+
isSyncing() => Promise<IsSyncingResult>
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
Check whether a sync operation is currently in progress.
|
|
560
|
+
|
|
561
|
+
Only available on Android and iOS.
|
|
562
|
+
|
|
563
|
+
**Returns:** <code>Promise<<a href="#issyncingresult">IsSyncingResult</a>></code>
|
|
564
|
+
|
|
565
|
+
**Since:** 7.4.0
|
|
566
|
+
|
|
567
|
+
--------------------
|
|
568
|
+
|
|
569
|
+
|
|
432
570
|
### getNextBundle()
|
|
433
571
|
|
|
434
572
|
```typescript
|
|
@@ -456,6 +594,9 @@ getVersionCode() => Promise<GetVersionCodeResult>
|
|
|
456
594
|
|
|
457
595
|
Get the version code of the app.
|
|
458
596
|
|
|
597
|
+
On **Android**, this is the `versionCode` from the `android/app/build.gradle` file.
|
|
598
|
+
On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file.
|
|
599
|
+
|
|
459
600
|
Only available on Android and iOS.
|
|
460
601
|
|
|
461
602
|
**Returns:** <code>Promise<<a href="#getversioncoderesult">GetVersionCodeResult</a>></code>
|
|
@@ -473,6 +614,9 @@ getVersionName() => Promise<GetVersionNameResult>
|
|
|
473
614
|
|
|
474
615
|
Get the version name of the app.
|
|
475
616
|
|
|
617
|
+
On **Android**, this is the `versionName` from the `android/app/build.gradle` file.
|
|
618
|
+
On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file.
|
|
619
|
+
|
|
476
620
|
Only available on Android and iOS.
|
|
477
621
|
|
|
478
622
|
**Returns:** <code>Promise<<a href="#getversionnameresult">GetVersionNameResult</a>></code>
|
|
@@ -485,7 +629,7 @@ Only available on Android and iOS.
|
|
|
485
629
|
### ready()
|
|
486
630
|
|
|
487
631
|
```typescript
|
|
488
|
-
ready() => Promise<
|
|
632
|
+
ready() => Promise<ReadyResult>
|
|
489
633
|
```
|
|
490
634
|
|
|
491
635
|
Notify the plugin that the app is ready to use and no rollback is needed.
|
|
@@ -495,6 +639,8 @@ to prevent the app from being reset to the default bundle.
|
|
|
495
639
|
|
|
496
640
|
Only available on Android and iOS.
|
|
497
641
|
|
|
642
|
+
**Returns:** <code>Promise<<a href="#readyresult">ReadyResult</a>></code>
|
|
643
|
+
|
|
498
644
|
**Since:** 5.0.0
|
|
499
645
|
|
|
500
646
|
--------------------
|
|
@@ -532,23 +678,20 @@ Only available on Android and iOS.
|
|
|
532
678
|
--------------------
|
|
533
679
|
|
|
534
680
|
|
|
535
|
-
###
|
|
681
|
+
### resetConfig()
|
|
536
682
|
|
|
537
683
|
```typescript
|
|
538
|
-
|
|
684
|
+
resetConfig() => Promise<void>
|
|
539
685
|
```
|
|
540
686
|
|
|
541
|
-
|
|
687
|
+
Reset the runtime configuration to the values from the Capacitor config file.
|
|
542
688
|
|
|
543
|
-
|
|
689
|
+
This clears any runtime configuration set via `setConfig()`.
|
|
690
|
+
The changes take effect immediately.
|
|
544
691
|
|
|
545
692
|
Only available on Android and iOS.
|
|
546
693
|
|
|
547
|
-
|
|
548
|
-
| ------------- | ------------------------------------------------------------- |
|
|
549
|
-
| **`options`** | <code><a href="#setbundleoptions">SetBundleOptions</a></code> |
|
|
550
|
-
|
|
551
|
-
**Since:** 5.0.0
|
|
694
|
+
**Since:** 7.4.0
|
|
552
695
|
|
|
553
696
|
--------------------
|
|
554
697
|
|
|
@@ -572,6 +715,32 @@ Only available on Android and iOS.
|
|
|
572
715
|
--------------------
|
|
573
716
|
|
|
574
717
|
|
|
718
|
+
### setConfig(...)
|
|
719
|
+
|
|
720
|
+
```typescript
|
|
721
|
+
setConfig(options: SetConfigOptions) => Promise<void>
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
Set the runtime configuration.
|
|
725
|
+
|
|
726
|
+
This allows updating plugin configuration options at runtime.
|
|
727
|
+
The changes are persisted across app restarts and take effect immediately.
|
|
728
|
+
|
|
729
|
+
**Important:** Runtime configuration is automatically reset to default values
|
|
730
|
+
whenever the native app is updated to a new version. This ensures that
|
|
731
|
+
configuration from previous versions doesn't persist after an app update.
|
|
732
|
+
|
|
733
|
+
Only available on Android and iOS.
|
|
734
|
+
|
|
735
|
+
| Param | Type |
|
|
736
|
+
| ------------- | ------------------------------------------------------------- |
|
|
737
|
+
| **`options`** | <code><a href="#setconfigoptions">SetConfigOptions</a></code> |
|
|
738
|
+
|
|
739
|
+
**Since:** 7.4.0
|
|
740
|
+
|
|
741
|
+
--------------------
|
|
742
|
+
|
|
743
|
+
|
|
575
744
|
### setCustomId(...)
|
|
576
745
|
|
|
577
746
|
```typescript
|
|
@@ -635,6 +804,95 @@ Only available on Android and iOS.
|
|
|
635
804
|
--------------------
|
|
636
805
|
|
|
637
806
|
|
|
807
|
+
### addListener('downloadBundleProgress', ...)
|
|
808
|
+
|
|
809
|
+
```typescript
|
|
810
|
+
addListener(eventName: 'downloadBundleProgress', listenerFunc: DownloadBundleProgressListener) => Promise<PluginListenerHandle>
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
Listen for the download progress of a bundle.
|
|
814
|
+
|
|
815
|
+
Only available on Android and iOS.
|
|
816
|
+
|
|
817
|
+
| Param | Type |
|
|
818
|
+
| ------------------ | ----------------------------------------------------------------------------------------- |
|
|
819
|
+
| **`eventName`** | <code>'downloadBundleProgress'</code> |
|
|
820
|
+
| **`listenerFunc`** | <code><a href="#downloadbundleprogresslistener">DownloadBundleProgressListener</a></code> |
|
|
821
|
+
|
|
822
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
823
|
+
|
|
824
|
+
**Since:** 7.0.0
|
|
825
|
+
|
|
826
|
+
--------------------
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
### addListener('nextBundleSet', ...)
|
|
830
|
+
|
|
831
|
+
```typescript
|
|
832
|
+
addListener(eventName: 'nextBundleSet', listenerFunc: NextBundleSetListener) => Promise<PluginListenerHandle>
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
Listen for when a bundle is set as the next bundle.
|
|
836
|
+
|
|
837
|
+
This event is triggered whenever a bundle is set to be used on the next app restart,
|
|
838
|
+
either through automatic updates or manual calls to `setNextBundle()`.
|
|
839
|
+
|
|
840
|
+
Only available on Android and iOS.
|
|
841
|
+
|
|
842
|
+
| Param | Type |
|
|
843
|
+
| ------------------ | ----------------------------------------------------------------------- |
|
|
844
|
+
| **`eventName`** | <code>'nextBundleSet'</code> |
|
|
845
|
+
| **`listenerFunc`** | <code><a href="#nextbundlesetlistener">NextBundleSetListener</a></code> |
|
|
846
|
+
|
|
847
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
848
|
+
|
|
849
|
+
**Since:** 7.3.0
|
|
850
|
+
|
|
851
|
+
--------------------
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
### addListener('reloaded', ...)
|
|
855
|
+
|
|
856
|
+
```typescript
|
|
857
|
+
addListener(eventName: 'reloaded', listenerFunc: ReloadedListener) => Promise<PluginListenerHandle>
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
Listen for when the app is reloaded.
|
|
861
|
+
|
|
862
|
+
This event is triggered after the `reload()` method is called
|
|
863
|
+
and the app has been reloaded.
|
|
864
|
+
|
|
865
|
+
**Note:** To verify whether an update was successfully applied after a reload,
|
|
866
|
+
use the `ready()` method instead. The `ready()` method provides detailed information
|
|
867
|
+
about the current bundle, previous bundle, and whether a rollback occurred.
|
|
868
|
+
|
|
869
|
+
Only available on Android and iOS.
|
|
870
|
+
|
|
871
|
+
| Param | Type |
|
|
872
|
+
| ------------------ | ------------------------------------------------------------- |
|
|
873
|
+
| **`eventName`** | <code>'reloaded'</code> |
|
|
874
|
+
| **`listenerFunc`** | <code><a href="#reloadedlistener">ReloadedListener</a></code> |
|
|
875
|
+
|
|
876
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
877
|
+
|
|
878
|
+
**Since:** 7.4.0
|
|
879
|
+
|
|
880
|
+
--------------------
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
### removeAllListeners()
|
|
884
|
+
|
|
885
|
+
```typescript
|
|
886
|
+
removeAllListeners() => Promise<void>
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
Remove all listeners for this plugin.
|
|
890
|
+
|
|
891
|
+
**Since:** 7.2.0
|
|
892
|
+
|
|
893
|
+
--------------------
|
|
894
|
+
|
|
895
|
+
|
|
638
896
|
### Interfaces
|
|
639
897
|
|
|
640
898
|
|
|
@@ -647,24 +905,25 @@ Only available on Android and iOS.
|
|
|
647
905
|
|
|
648
906
|
#### DownloadBundleOptions
|
|
649
907
|
|
|
650
|
-
| Prop | Type | Description
|
|
651
|
-
| ------------------ | -------------------------------- |
|
|
652
|
-
| **`artifactType`** | <code>'manifest' \| 'zip'</code> | The artifact type of the bundle.
|
|
653
|
-
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle.
|
|
654
|
-
| **`checksum`** | <code>string</code> | The checksum of the self-hosted bundle as a SHA-256 hash in base64 format to verify the integrity of the bundle. **Attention**: Only supported for the `zip` artifact type.
|
|
655
|
-
| **`signature`** | <code>string</code> | The signature of the self-hosted bundle as a signed SHA-256 hash in base64 format to verify the integrity of the bundle. **Attention**: Only supported for the `zip` artifact type.
|
|
656
|
-
| **`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
|
|
908
|
+
| Prop | Type | Description | Default | Since |
|
|
909
|
+
| ------------------ | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
|
|
910
|
+
| **`artifactType`** | <code>'manifest' \| 'zip'</code> | The artifact type of the bundle. | <code>'zip'</code> | 6.6.0 |
|
|
911
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle. **Attention**: The value `public` is reserved and cannot be used as a bundle identifier. | | 5.0.0 |
|
|
912
|
+
| **`checksum`** | <code>string</code> | The checksum of the self-hosted bundle as a SHA-256 hash in base64 format to verify the integrity of the bundle. **Attention**: Only supported for the `zip` artifact type. | | 7.1.0 |
|
|
913
|
+
| **`signature`** | <code>string</code> | The signature of the self-hosted bundle as a signed SHA-256 hash in base64 format to verify the integrity of the bundle. **Attention**: Only supported for the `zip` artifact type. | | 7.1.0 |
|
|
914
|
+
| **`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 should return a `X-Checksum` header with the SHA-256 hash in base64 format. To **verify the signature** of the file, the server should return a `X-Signature` header with the signed SHA-256 hash in base64 format. | | 5.0.0 |
|
|
657
915
|
|
|
658
916
|
|
|
659
917
|
#### FetchLatestBundleResult
|
|
660
918
|
|
|
661
|
-
| Prop
|
|
662
|
-
|
|
|
663
|
-
| **`artifactType`**
|
|
664
|
-
| **`bundleId`**
|
|
665
|
-
| **`checksum`**
|
|
666
|
-
| **`
|
|
667
|
-
| **`
|
|
919
|
+
| Prop | Type | Description | Since |
|
|
920
|
+
| ---------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
921
|
+
| **`artifactType`** | <code>'manifest' \| 'zip'</code> | The artifact type of the bundle. | 6.7.0 |
|
|
922
|
+
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the latest bundle. If `null`, no bundle is available. | 6.6.0 |
|
|
923
|
+
| **`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. | 7.1.0 |
|
|
924
|
+
| **`customProperties`** | <code>{ [key: string]: string; }</code> | Custom properties that are associated with the latest bundle. | 7.0.0 |
|
|
925
|
+
| **`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 |
|
|
926
|
+
| **`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. | 7.1.0 |
|
|
668
927
|
|
|
669
928
|
|
|
670
929
|
#### FetchLatestBundleOptions
|
|
@@ -674,11 +933,11 @@ Only available on Android and iOS.
|
|
|
674
933
|
| **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 6.7.0 |
|
|
675
934
|
|
|
676
935
|
|
|
677
|
-
####
|
|
936
|
+
#### GetBlockedBundlesResult
|
|
678
937
|
|
|
679
|
-
| Prop
|
|
680
|
-
|
|
|
681
|
-
| **`
|
|
938
|
+
| Prop | Type | Description | Since |
|
|
939
|
+
| --------------- | --------------------- | ------------------------------------------------------ | ----- |
|
|
940
|
+
| **`bundleIds`** | <code>string[]</code> | An array of unique identifiers of all blocked bundles. | 7.4.0 |
|
|
682
941
|
|
|
683
942
|
|
|
684
943
|
#### GetBundlesResult
|
|
@@ -695,6 +954,21 @@ Only available on Android and iOS.
|
|
|
695
954
|
| **`channel`** | <code>string \| null</code> | The channel name. If `null`, the app is using the default channel. | 5.0.0 |
|
|
696
955
|
|
|
697
956
|
|
|
957
|
+
#### GetConfigResult
|
|
958
|
+
|
|
959
|
+
| Prop | Type | Description | Since |
|
|
960
|
+
| ------------------------ | ----------------------------------- | ------------------------------------------------------------------------ | ----- |
|
|
961
|
+
| **`appId`** | <code>string \| null</code> | The app ID used to identify the app. If `null`, no app ID is configured. | 7.4.0 |
|
|
962
|
+
| **`autoUpdateStrategy`** | <code>'none' \| 'background'</code> | The auto-update strategy for live updates. | 7.4.0 |
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
#### GetDownloadedBundlesResult
|
|
966
|
+
|
|
967
|
+
| Prop | Type | Description | Since |
|
|
968
|
+
| --------------- | --------------------- | --------------------------------------------------------- | ----- |
|
|
969
|
+
| **`bundleIds`** | <code>string[]</code> | An array of unique identifiers of all downloaded bundles. | 7.4.0 |
|
|
970
|
+
|
|
971
|
+
|
|
698
972
|
#### GetCurrentBundleResult
|
|
699
973
|
|
|
700
974
|
| Prop | Type | Description | Since |
|
|
@@ -716,6 +990,13 @@ Only available on Android and iOS.
|
|
|
716
990
|
| **`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
991
|
|
|
718
992
|
|
|
993
|
+
#### IsSyncingResult
|
|
994
|
+
|
|
995
|
+
| Prop | Type | Description | Since |
|
|
996
|
+
| ------------- | -------------------- | -------------------------------------------------- | ----- |
|
|
997
|
+
| **`syncing`** | <code>boolean</code> | Whether a sync operation is currently in progress. | 7.4.0 |
|
|
998
|
+
|
|
999
|
+
|
|
719
1000
|
#### GetNextBundleResult
|
|
720
1001
|
|
|
721
1002
|
| Prop | Type | Description | Since |
|
|
@@ -737,11 +1018,13 @@ Only available on Android and iOS.
|
|
|
737
1018
|
| **`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
1019
|
|
|
739
1020
|
|
|
740
|
-
####
|
|
1021
|
+
#### ReadyResult
|
|
741
1022
|
|
|
742
|
-
| Prop
|
|
743
|
-
|
|
|
744
|
-
| **`
|
|
1023
|
+
| Prop | Type | Description | Since |
|
|
1024
|
+
| ---------------------- | --------------------------- | --------------------------------------------------------------------------------------- | ----- |
|
|
1025
|
+
| **`previousBundleId`** | <code>string \| null</code> | The identifier of the previous bundle used. If `null`, the default bundle was used. | 7.0.0 |
|
|
1026
|
+
| **`currentBundleId`** | <code>string \| null</code> | The identifier of the current bundle used. If `null`, the default bundle is being used. | 7.0.0 |
|
|
1027
|
+
| **`rollback`** | <code>boolean</code> | Whether or not the app was reset to the default bundle. | 7.0.0 |
|
|
745
1028
|
|
|
746
1029
|
|
|
747
1030
|
#### SetChannelOptions
|
|
@@ -751,6 +1034,13 @@ Only available on Android and iOS.
|
|
|
751
1034
|
| **`channel`** | <code>string \| null</code> | The channel name. Set `null` to remove the channel. | 5.0.0 |
|
|
752
1035
|
|
|
753
1036
|
|
|
1037
|
+
#### SetConfigOptions
|
|
1038
|
+
|
|
1039
|
+
| Prop | Type | Description | Since |
|
|
1040
|
+
| ----------- | --------------------------- | ----------------------------------------------------------------------------------------------------- | ----- |
|
|
1041
|
+
| **`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. | 7.4.0 |
|
|
1042
|
+
|
|
1043
|
+
|
|
754
1044
|
#### SetCustomIdOptions
|
|
755
1045
|
|
|
756
1046
|
| Prop | Type | Description | Since |
|
|
@@ -778,11 +1068,63 @@ Only available on Android and iOS.
|
|
|
778
1068
|
| ------------- | ------------------- | ---------------------------------------------------------------- | ----- |
|
|
779
1069
|
| **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 6.7.0 |
|
|
780
1070
|
|
|
1071
|
+
|
|
1072
|
+
#### PluginListenerHandle
|
|
1073
|
+
|
|
1074
|
+
| Prop | Type |
|
|
1075
|
+
| ------------ | ----------------------------------------- |
|
|
1076
|
+
| **`remove`** | <code>() => Promise<void></code> |
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
#### DownloadBundleProgressEvent
|
|
1080
|
+
|
|
1081
|
+
Event that is triggered when the download progress of a bundle changes.
|
|
1082
|
+
|
|
1083
|
+
| Prop | Type | Description | Since |
|
|
1084
|
+
| --------------------- | ------------------- | ----------------------------------------------------------------------- | ----- |
|
|
1085
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle that is being downloaded. | 7.0.0 |
|
|
1086
|
+
| **`downloadedBytes`** | <code>number</code> | The number of bytes that have been downloaded. | 7.0.0 |
|
|
1087
|
+
| **`progress`** | <code>number</code> | The progress of the download in percent as a value between `0` and `1`. | 7.0.0 |
|
|
1088
|
+
| **`totalBytes`** | <code>number</code> | The total number of bytes to download. | 7.0.0 |
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
#### NextBundleSetEvent
|
|
1092
|
+
|
|
1093
|
+
Event that is triggered when a bundle is set as the next bundle.
|
|
1094
|
+
|
|
1095
|
+
| Prop | Type | Description | Since |
|
|
1096
|
+
| -------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------- | ----- |
|
|
1097
|
+
| **`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. | 7.3.0 |
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
### Type Aliases
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
#### DownloadBundleProgressListener
|
|
1104
|
+
|
|
1105
|
+
Listener for the download progress of a bundle.
|
|
1106
|
+
|
|
1107
|
+
<code>(event: <a href="#downloadbundleprogressevent">DownloadBundleProgressEvent</a>): void</code>
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
#### NextBundleSetListener
|
|
1111
|
+
|
|
1112
|
+
Listener for when a bundle is set as the next bundle.
|
|
1113
|
+
|
|
1114
|
+
<code>(event: <a href="#nextbundlesetevent">NextBundleSetEvent</a>): void</code>
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
#### ReloadedListener
|
|
1118
|
+
|
|
1119
|
+
Listener for when the app is reloaded.
|
|
1120
|
+
|
|
1121
|
+
<code>(): void</code>
|
|
1122
|
+
|
|
781
1123
|
</docgen-api>
|
|
782
1124
|
|
|
783
1125
|
## Testing
|
|
784
1126
|
|
|
785
|
-
When testing the plugin, you must make sure that you do not use the [Live Reload](https://ionicframework.com/docs/cli/livereload) option, as in this case a development server is used to load the bundle.
|
|
1127
|
+
When testing the plugin, you must make sure that you do not use the [Live Reload](https://ionicframework.com/docs/cli/livereload) option, as in this case a development server is used to load the bundle and not the local file system.
|
|
786
1128
|
|
|
787
1129
|
Therefore, simply start your app without the live reload option, for example with the following command:
|
|
788
1130
|
|
|
@@ -790,7 +1132,17 @@ Therefore, simply start your app without the live reload option, for example wit
|
|
|
790
1132
|
npx ionic cap run android --open
|
|
791
1133
|
```
|
|
792
1134
|
|
|
793
|
-
If you want to
|
|
1135
|
+
If you want to **not** receive live updates to test other parts of your app, you can simply set a non-existent channel, for example:
|
|
1136
|
+
|
|
1137
|
+
```typescript
|
|
1138
|
+
import { LiveUpdate } from '@capawesome/capacitor-live-update';
|
|
1139
|
+
|
|
1140
|
+
const sync = async () => {
|
|
1141
|
+
await LiveUpdate.sync({ channel: 'non-existent-channel' });
|
|
1142
|
+
};
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
This way, the app will check for updates, but no updates will be found.
|
|
794
1146
|
|
|
795
1147
|
## Limitations
|
|
796
1148
|
|
|
@@ -807,10 +1159,10 @@ So if you make local changes to your app and execute `npx cap run`, for example,
|
|
|
807
1159
|
You then have three options to get back to the default bundle:
|
|
808
1160
|
|
|
809
1161
|
1. **Reset**: Call the [`reset()`](#reset) method to reset the app to the default bundle.
|
|
810
|
-
2. **Reinstall**: Reinstall the app to
|
|
811
|
-
3. **Update**: Increase the
|
|
1162
|
+
2. **Reinstall**: Reinstall the app to remove the live update bundle.
|
|
1163
|
+
3. **Update**: Increase the native version code of your app so that Capacitor automatically resets to the default bundle.
|
|
812
1164
|
|
|
813
|
-
However, this is only a problem during development. It is not a problem in production as
|
|
1165
|
+
However, this is only a problem during development. It is not a problem in production, as Capacitor automatically resets to the default bundle after a native update.
|
|
814
1166
|
|
|
815
1167
|
## Changelog
|
|
816
1168
|
|