@capawesome/cordova-live-update 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1113 -0
- package/dist/docs.json +1654 -0
- package/dist/esm/definitions.d.ts +788 -0
- package/dist/esm/definitions.js +7 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/exec.d.ts +1 -0
- package/dist/esm/exec.js +8 -0
- package/dist/esm/exec.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +46 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/plugin.js +56 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +93 -0
- package/plugin.xml +268 -0
- package/src/android/capawesome-cordova-live-update.gradle +12 -0
- package/src/android/capawesome-live-update.xml +5 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdate.java +1480 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdateConfig.java +105 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdateHttpClient.java +114 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdatePathHandler.java +96 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdatePlugin.java +550 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/LiveUpdatePreferences.java +151 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/Manifest.java +58 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/ManifestItem.java +37 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/api/GetChannelsResponseItem.java +28 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/api/GetLatestBundleResponse.java +74 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/events/DownloadBundleProgressEvent.java +33 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/events/NextBundleSetEvent.java +26 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/DeleteBundleOptions.java +18 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/DownloadBundleOptions.java +66 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/FetchChannelsOptions.java +39 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/FetchLatestBundleOptions.java +25 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetChannelOptions.java +18 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetConfigOptions.java +20 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetCustomIdOptions.java +18 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SetNextBundleOptions.java +21 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/options/SyncOptions.java +25 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/ChannelResult.java +29 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/FetchChannelsResult.java +29 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/FetchLatestBundleResult.java +69 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetBlockedBundlesResult.java +28 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetBundlesResult.java +28 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetChannelResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetConfigResult.java +40 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetCurrentBundleResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetCustomIdResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetDeviceIdResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetDownloadedBundlesResult.java +28 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetNextBundleResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetVersionCodeResult.java +21 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/GetVersionNameResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/IsSyncingResult.java +27 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/ReadyResult.java +32 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/classes/results/SyncResult.java +22 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/enums/ArtifactType.java +6 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/Callback.java +5 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/DownloadProgressCallback.java +5 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/EmptyCallback.java +5 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/NonEmptyCallback.java +7 -0
- package/src/android/io/capawesome/cordova/plugins/liveupdate/interfaces/Result.java +8 -0
- package/src/ios/LiveUpdate.swift +895 -0
- package/src/ios/LiveUpdateArtifactType.swift +4 -0
- package/src/ios/LiveUpdateChannelResult.swift +18 -0
- package/src/ios/LiveUpdateConfig.swift +11 -0
- package/src/ios/LiveUpdateDeleteBundleOptions.swift +13 -0
- package/src/ios/LiveUpdateDownloadBundleOptions.swift +41 -0
- package/src/ios/LiveUpdateDownloadBundleProgressEvent.swift +24 -0
- package/src/ios/LiveUpdateError.swift +62 -0
- package/src/ios/LiveUpdateFetchChannelsOptions.swift +25 -0
- package/src/ios/LiveUpdateFetchChannelsResult.swift +15 -0
- package/src/ios/LiveUpdateFetchLatestBundleOptions.swift +17 -0
- package/src/ios/LiveUpdateFetchLatestBundleResult.swift +42 -0
- package/src/ios/LiveUpdateGetBlockedBundlesResult.swift +15 -0
- package/src/ios/LiveUpdateGetBundlesResult.swift +15 -0
- package/src/ios/LiveUpdateGetChannelResult.swift +15 -0
- package/src/ios/LiveUpdateGetChannelsResponseItem.swift +4 -0
- package/src/ios/LiveUpdateGetConfigResult.swift +18 -0
- package/src/ios/LiveUpdateGetCurrentBundleResult.swift +15 -0
- package/src/ios/LiveUpdateGetCustomIdResult.swift +15 -0
- package/src/ios/LiveUpdateGetDeviceIdResult.swift +15 -0
- package/src/ios/LiveUpdateGetDownloadedBundlesResult.swift +15 -0
- package/src/ios/LiveUpdateGetLatestBundleResponse.swift +8 -0
- package/src/ios/LiveUpdateGetNextBundleResult.swift +15 -0
- package/src/ios/LiveUpdateGetVersionCodeResult.swift +15 -0
- package/src/ios/LiveUpdateGetVersionNameResult.swift +15 -0
- package/src/ios/LiveUpdateHttpClient.swift +58 -0
- package/src/ios/LiveUpdateIsSyncingResult.swift +15 -0
- package/src/ios/LiveUpdateManifest.swift +19 -0
- package/src/ios/LiveUpdateManifestItem.swift +5 -0
- package/src/ios/LiveUpdateNextBundleSetEvent.swift +15 -0
- package/src/ios/LiveUpdatePlugin.swift +521 -0
- package/src/ios/LiveUpdatePreferences.swift +116 -0
- package/src/ios/LiveUpdateReadyResult.swift +21 -0
- package/src/ios/LiveUpdateResult.swift +5 -0
- package/src/ios/LiveUpdateSchemeHandler.swift +286 -0
- package/src/ios/LiveUpdateSetChannelOptions.swift +13 -0
- package/src/ios/LiveUpdateSetConfigOptions.swift +13 -0
- package/src/ios/LiveUpdateSetCustomIdOptions.swift +13 -0
- package/src/ios/LiveUpdateSetNextBundleOptions.swift +13 -0
- package/src/ios/LiveUpdateSyncOptions.swift +17 -0
- package/src/ios/LiveUpdateSyncResult.swift +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,1113 @@
|
|
|
1
|
+
# @capawesome/cordova-live-update
|
|
2
|
+
|
|
3
|
+
Cordova plugin that allows you to update your app remotely in real-time without requiring users to download a new version from the app store, also known as Over-the-Air (OTA) updates.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔋 Supports **Android and iOS**
|
|
8
|
+
- ⚡️ Works with **stock Cordova WebView** — does **not** require `cordova-plugin-ionic-webview`
|
|
9
|
+
- 📦 **Bundle Management** — download, set, and delete bundles
|
|
10
|
+
- ☁️ **Cloud Support** — manage updates via [Capawesome Cloud](https://cloud.capawesome.io/)
|
|
11
|
+
- 📺 **Channel Support** — set a channel for the app to manage different versions
|
|
12
|
+
- 🔄 **Auto Update** — background update strategy with 15-minute throttle
|
|
13
|
+
- 🛟 **Rollback** — automatic revert to the default bundle on failed updates
|
|
14
|
+
- 🔁 **Delta Updates** — manifest mode downloads only changed files
|
|
15
|
+
- ⚙️ **Runtime Configuration** — update plugin configuration at runtime
|
|
16
|
+
- 📡 **Update Lifecycle Events** — track download progress, react to bundle changes, detect reloads
|
|
17
|
+
- 🏷️ **Custom Properties** — associate custom key-value metadata with bundles via Capawesome Cloud
|
|
18
|
+
- 🔒 **Security** — verify authenticity and integrity of bundles via RSA signature
|
|
19
|
+
- 🌐 **Open Source** — MIT licensed
|
|
20
|
+
|
|
21
|
+
## Newsletter
|
|
22
|
+
|
|
23
|
+
Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
|
|
24
|
+
|
|
25
|
+
## Compatibility
|
|
26
|
+
|
|
27
|
+
| Plugin Version | Cordova Android Version | Cordova iOS Version | Status |
|
|
28
|
+
| -------------- | ----------------------- | ------------------- | -------------- |
|
|
29
|
+
| 0.1.x | >=13.0.0 | >=7.0.0 | Active support |
|
|
30
|
+
|
|
31
|
+
## ⚠️ WebView Scheme Requirement
|
|
32
|
+
|
|
33
|
+
This plugin replaces files served to the WebView by hooking into Cordova's official plugin extension points (`CordovaPluginPathHandler` on Android, `CDVPluginSchemeHandler` on iOS). These hooks only fire when the WebView is loading via a custom scheme — which is the **default** for modern Cordova:
|
|
34
|
+
|
|
35
|
+
- **Android (cordova-android ≥10):** loads from `https://localhost/` via `WebViewAssetLoader`. ✅ Supported by default.
|
|
36
|
+
- **iOS (cordova-ios ≥6):** loads from `app://localhost/` via `WKURLSchemeHandler`. ✅ Supported by default.
|
|
37
|
+
|
|
38
|
+
The plugin **will not work** if your app overrides these to use the legacy file scheme:
|
|
39
|
+
|
|
40
|
+
- ❌ `<preference name="AndroidInsecureFileModeEnabled" value="true" />`
|
|
41
|
+
- ❌ `<preference name="Scheme" value="file" />`
|
|
42
|
+
|
|
43
|
+
If you require these settings, this plugin is not for you.
|
|
44
|
+
|
|
45
|
+
## Guides
|
|
46
|
+
|
|
47
|
+
- [Getting Started with Capawesome Cloud Live Updates](https://capawesome.io/cloud/live-updates/setup/)
|
|
48
|
+
- [Migrating from Ionic Appflow to Capawesome Cloud](https://capawesome.io/blog/migrating-from-ionic-appflow-to-capawesome-cloud/)
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
Install the plugin by running the following command and follow the platform-specific instructions below:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
cordova plugin add @capawesome/cordova-live-update --variable APP_ID=<your-app-id>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Android
|
|
59
|
+
|
|
60
|
+
#### Channel
|
|
61
|
+
|
|
62
|
+
For a **static** default channel, use the [`DEFAULT_CHANNEL`](#plugin-variables) plugin variable — no native config required.
|
|
63
|
+
|
|
64
|
+
If you are using [Versioned Channels](https://capawesome.io/cloud/live-updates/guides/best-practices/#versioned-channels), the channel value needs to be interpolated from the build's `versionCode`, which can't be expressed via a plugin variable. Use Cordova's `build-extras.gradle` mechanism instead. In your app's `config.xml`, add:
|
|
65
|
+
|
|
66
|
+
```xml
|
|
67
|
+
<platform name="android">
|
|
68
|
+
<resource-file src="build-extras.gradle" target="app/build-extras.gradle"/>
|
|
69
|
+
</platform>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Then create `build-extras.gradle` next to `config.xml`:
|
|
73
|
+
|
|
74
|
+
```groovy
|
|
75
|
+
android {
|
|
76
|
+
applicationVariants.all { variant ->
|
|
77
|
+
variant.resValue "string", "capawesome_live_update_default_channel", "production-${variant.versionCode}"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### iOS
|
|
83
|
+
|
|
84
|
+
#### Channel
|
|
85
|
+
|
|
86
|
+
For a **static** default channel, use the [`DEFAULT_CHANNEL`](#plugin-variables) plugin variable — no native config required.
|
|
87
|
+
|
|
88
|
+
If you are using [Versioned Channels](https://capawesome.io/cloud/live-updates/guides/best-practices/#versioned-channels), use Cordova's `<config-file>` mechanism in your app's `config.xml`:
|
|
89
|
+
|
|
90
|
+
```xml
|
|
91
|
+
<platform name="ios">
|
|
92
|
+
<config-file target="*-Info.plist" parent="CapawesomeLiveUpdateDefaultChannel">
|
|
93
|
+
<string>production-$(CURRENT_PROJECT_VERSION)</string>
|
|
94
|
+
</config-file>
|
|
95
|
+
</platform>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Xcode resolves `$(CURRENT_PROJECT_VERSION)` at build time.
|
|
99
|
+
|
|
100
|
+
#### Privacy manifest
|
|
101
|
+
|
|
102
|
+
Starting with [cordova-ios 7.1.0](https://cordova.apache.org/announcements/2024/04/03/cordova-ios-7.1.0.html), the iOS [Privacy Manifest](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files) is configured via a `<privacy-manifest>` element inside the `<platform name="ios">` section of your app's `config.xml`. Add an `NSPrivacyAccessedAPICategoryUserDefaults` entry for this plugin:
|
|
103
|
+
|
|
104
|
+
```xml
|
|
105
|
+
<platform name="ios">
|
|
106
|
+
<privacy-manifest>
|
|
107
|
+
<key>NSPrivacyAccessedAPITypes</key>
|
|
108
|
+
<array>
|
|
109
|
+
<!-- Add this dict entry to the array if the key already exists. -->
|
|
110
|
+
<dict>
|
|
111
|
+
<key>NSPrivacyAccessedAPIType</key>
|
|
112
|
+
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
|
113
|
+
<key>NSPrivacyAccessedAPITypeReasons</key>
|
|
114
|
+
<array>
|
|
115
|
+
<string>CA92.1</string>
|
|
116
|
+
</array>
|
|
117
|
+
</dict>
|
|
118
|
+
</array>
|
|
119
|
+
</privacy-manifest>
|
|
120
|
+
</platform>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
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.
|
|
124
|
+
|
|
125
|
+
## Plugin Variables
|
|
126
|
+
|
|
127
|
+
These map to Cordova `<preference>` entries in `config.xml`. Set them at install time with `--variable`, or edit `config.xml` directly:
|
|
128
|
+
|
|
129
|
+
| Variable | Default | Description |
|
|
130
|
+
| -------------------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
131
|
+
| `APP_ID` | *(empty)* | Capawesome Cloud app ID (a UUID). |
|
|
132
|
+
| `DEFAULT_CHANNEL` | *(empty)* | Default channel name. Overridden by native config or `setChannel()`. |
|
|
133
|
+
| `AUTO_UPDATE_STRATEGY` | `none` | `none` or `background`. `background` runs `sync()` on cold start and foreground (15-minute throttle). |
|
|
134
|
+
| `HTTP_TIMEOUT` | `60000` | HTTP request timeout in milliseconds. |
|
|
135
|
+
| `PUBLIC_KEY` | *(empty)* | PEM-encoded RSA public key for signature verification. When set, all bundle downloads must include a valid signature. |
|
|
136
|
+
| `READY_TIMEOUT` | `0` | Milliseconds to wait for `ready()` before automatic rollback. Set to e.g. `10000` to enable rollback. `0` disables it. |
|
|
137
|
+
| `SERVER_DOMAIN` | `api.cloud.capawesome.io` | Capawesome Cloud API host (no scheme/path). |
|
|
138
|
+
| `AUTO_DELETE_BUNDLES` | `false` | Whether to delete unused bundles when `ready()` is called. |
|
|
139
|
+
| `AUTO_BLOCK_ROLLED_BACK_BUNDLES` | `false` | Whether to block bundles that caused a rollback. No effect if `READY_TIMEOUT=0`. |
|
|
140
|
+
|
|
141
|
+
### Example
|
|
142
|
+
|
|
143
|
+
```xml
|
|
144
|
+
<plugin name="@capawesome/cordova-live-update" spec="0.1.0">
|
|
145
|
+
<variable name="APP_ID" value="6e351b4f-69a7-415e-a057-4567df7ffe94" />
|
|
146
|
+
<variable name="AUTO_UPDATE_STRATEGY" value="background" />
|
|
147
|
+
<variable name="DEFAULT_CHANNEL" value="production" />
|
|
148
|
+
<variable name="READY_TIMEOUT" value="10000" />
|
|
149
|
+
<variable name="PUBLIC_KEY" value="-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDodf1SD0OOn6hIlDuKBza0Ed0OqtwyVJwiyjmE9BJaZ7y8ZUfcF+SKmd0l2cDPM45XIg2tAFux5n29uoKyHwSt+6tCi5CJA5Z1/1eZruRRqABLonV77KS3HUtvOgqRLDnKSV89dYZkM++NwmzOPgIF422mvc+VukcVOBfc8/AHQIDAQAB-----END PUBLIC KEY-----" />
|
|
150
|
+
</plugin>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Usage
|
|
154
|
+
|
|
155
|
+
The plugin attaches to `cordova.plugins.LiveUpdate` once `deviceready` fires.
|
|
156
|
+
|
|
157
|
+
If you use TypeScript, type definitions are available from the npm package:
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
import type { LiveUpdatePlugin } from '@capawesome/cordova-live-update';
|
|
161
|
+
|
|
162
|
+
declare const cordova: { plugins: { LiveUpdate: LiveUpdatePlugin } };
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
const { LiveUpdate } = cordova.plugins;
|
|
167
|
+
|
|
168
|
+
const deleteBundle = async () => {
|
|
169
|
+
await LiveUpdate.deleteBundle({ bundleId: 'my-bundle' });
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const downloadBundle = async () => {
|
|
173
|
+
await LiveUpdate.downloadBundle({ url: 'https://example.com/1.0.0.zip', bundleId: '1.0.0' });
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const fetchChannels = async () => {
|
|
177
|
+
const result = await LiveUpdate.fetchChannels();
|
|
178
|
+
return result.channels;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const fetchLatestBundle = async () => {
|
|
182
|
+
await LiveUpdate.fetchLatestBundle();
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const getBundles = async () => {
|
|
186
|
+
const result = await LiveUpdate.getBundles();
|
|
187
|
+
return result.bundleIds;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const getChannel = async () => {
|
|
191
|
+
const result = await LiveUpdate.getChannel();
|
|
192
|
+
return result.channel;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const getCurrentBundle = async () => {
|
|
196
|
+
const result = await LiveUpdate.getCurrentBundle();
|
|
197
|
+
return result.bundleId;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const getCustomId = async () => {
|
|
201
|
+
const result = await LiveUpdate.getCustomId();
|
|
202
|
+
return result.customId;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const getDeviceId = async () => {
|
|
206
|
+
const result = await LiveUpdate.getDeviceId();
|
|
207
|
+
return result.deviceId;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const getNextBundle = async () => {
|
|
211
|
+
const result = await LiveUpdate.getNextBundle();
|
|
212
|
+
return result.bundleId;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const getVersionCode = async () => {
|
|
216
|
+
const result = await LiveUpdate.getVersionCode();
|
|
217
|
+
return result.versionCode;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const getVersionName = async () => {
|
|
221
|
+
const result = await LiveUpdate.getVersionName();
|
|
222
|
+
return result.versionName;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const ready = async () => {
|
|
226
|
+
const result = await LiveUpdate.ready();
|
|
227
|
+
if (result.currentBundleId) {
|
|
228
|
+
console.log(`The app is now using the bundle with the identifier ${result.currentBundleId}.`);
|
|
229
|
+
}
|
|
230
|
+
if (result.previousBundleId) {
|
|
231
|
+
console.log(`The app was using the bundle with the identifier ${result.previousBundleId}.`);
|
|
232
|
+
}
|
|
233
|
+
if (result.rollback) {
|
|
234
|
+
console.log('The app was reset to the default bundle.');
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const reload = async () => {
|
|
239
|
+
await LiveUpdate.reload();
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const reset = async () => {
|
|
243
|
+
await LiveUpdate.reset();
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const setChannel = async () => {
|
|
247
|
+
await LiveUpdate.setChannel({ channel: 'production-5' });
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const setCustomId = async () => {
|
|
251
|
+
await LiveUpdate.setCustomId({ customId: 'my-custom-id' });
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const setNextBundle = async () => {
|
|
255
|
+
await LiveUpdate.setNextBundle({ bundleId: '7f0b9bf2-dff6-4be2-bcac-b068cc5ea756' });
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
const sync = async () => {
|
|
259
|
+
const result = await LiveUpdate.sync({
|
|
260
|
+
channel: 'production-5',
|
|
261
|
+
});
|
|
262
|
+
return result.nextBundleId;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const isNewBundleAvailable = async () => {
|
|
266
|
+
const { bundleId: latestBundleId } = await LiveUpdate.fetchLatestBundle({
|
|
267
|
+
channel: 'production-5',
|
|
268
|
+
});
|
|
269
|
+
if (latestBundleId) {
|
|
270
|
+
const { bundleId: currentBundleId } = await LiveUpdate.getCurrentBundle();
|
|
271
|
+
return latestBundleId !== currentBundleId;
|
|
272
|
+
} else {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## API
|
|
279
|
+
|
|
280
|
+
<docgen-index>
|
|
281
|
+
|
|
282
|
+
* [`clearBlockedBundles()`](#clearblockedbundles)
|
|
283
|
+
* [`deleteBundle(...)`](#deletebundle)
|
|
284
|
+
* [`downloadBundle(...)`](#downloadbundle)
|
|
285
|
+
* [`fetchChannels(...)`](#fetchchannels)
|
|
286
|
+
* [`fetchLatestBundle(...)`](#fetchlatestbundle)
|
|
287
|
+
* [`getBlockedBundles()`](#getblockedbundles)
|
|
288
|
+
* [`getBundles()`](#getbundles)
|
|
289
|
+
* [`getChannel()`](#getchannel)
|
|
290
|
+
* [`getConfig()`](#getconfig)
|
|
291
|
+
* [`getDownloadedBundles()`](#getdownloadedbundles)
|
|
292
|
+
* [`getCurrentBundle()`](#getcurrentbundle)
|
|
293
|
+
* [`getCustomId()`](#getcustomid)
|
|
294
|
+
* [`getDeviceId()`](#getdeviceid)
|
|
295
|
+
* [`isSyncing()`](#issyncing)
|
|
296
|
+
* [`getNextBundle()`](#getnextbundle)
|
|
297
|
+
* [`getVersionCode()`](#getversioncode)
|
|
298
|
+
* [`getVersionName()`](#getversionname)
|
|
299
|
+
* [`ready()`](#ready)
|
|
300
|
+
* [`reload()`](#reload)
|
|
301
|
+
* [`reset()`](#reset)
|
|
302
|
+
* [`resetConfig()`](#resetconfig)
|
|
303
|
+
* [`setChannel(...)`](#setchannel)
|
|
304
|
+
* [`setConfig(...)`](#setconfig)
|
|
305
|
+
* [`setCustomId(...)`](#setcustomid)
|
|
306
|
+
* [`setNextBundle(...)`](#setnextbundle)
|
|
307
|
+
* [`sync(...)`](#sync)
|
|
308
|
+
* [`addListener('downloadBundleProgress', ...)`](#addlistenerdownloadbundleprogress-)
|
|
309
|
+
* [`addListener('nextBundleSet', ...)`](#addlistenernextbundleset-)
|
|
310
|
+
* [`removeAllListeners()`](#removealllisteners)
|
|
311
|
+
* [Interfaces](#interfaces)
|
|
312
|
+
* [Type Aliases](#type-aliases)
|
|
313
|
+
|
|
314
|
+
</docgen-index>
|
|
315
|
+
|
|
316
|
+
<docgen-api>
|
|
317
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
318
|
+
|
|
319
|
+
### clearBlockedBundles()
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
clearBlockedBundles() => any
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Clear all blocked bundles from the blocked list.
|
|
326
|
+
|
|
327
|
+
This removes all bundle identifiers that were automatically blocked
|
|
328
|
+
due to rollbacks when `autoBlockRolledBackBundles` is enabled.
|
|
329
|
+
|
|
330
|
+
**Returns:** <code>any</code>
|
|
331
|
+
|
|
332
|
+
**Since:** 0.1.0
|
|
333
|
+
|
|
334
|
+
--------------------
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
### deleteBundle(...)
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
deleteBundle(options: DeleteBundleOptions) => any
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Delete a bundle from the app.
|
|
344
|
+
|
|
345
|
+
| Param | Type |
|
|
346
|
+
| ------------- | ------------------------------------------------------------------- |
|
|
347
|
+
| **`options`** | <code><a href="#deletebundleoptions">DeleteBundleOptions</a></code> |
|
|
348
|
+
|
|
349
|
+
**Returns:** <code>any</code>
|
|
350
|
+
|
|
351
|
+
**Since:** 0.1.0
|
|
352
|
+
|
|
353
|
+
--------------------
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
### downloadBundle(...)
|
|
357
|
+
|
|
358
|
+
```typescript
|
|
359
|
+
downloadBundle(options: DownloadBundleOptions) => any
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Download a bundle.
|
|
363
|
+
|
|
364
|
+
| Param | Type |
|
|
365
|
+
| ------------- | ----------------------------------------------------------------------- |
|
|
366
|
+
| **`options`** | <code><a href="#downloadbundleoptions">DownloadBundleOptions</a></code> |
|
|
367
|
+
|
|
368
|
+
**Returns:** <code>any</code>
|
|
369
|
+
|
|
370
|
+
**Since:** 0.1.0
|
|
371
|
+
|
|
372
|
+
--------------------
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
### fetchChannels(...)
|
|
376
|
+
|
|
377
|
+
```typescript
|
|
378
|
+
fetchChannels(options?: FetchChannelsOptions | undefined) => any
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Fetch channels from [Capawesome Cloud](https://capawesome.io/cloud/).
|
|
382
|
+
|
|
383
|
+
This is primarily intended for development and QA purposes.
|
|
384
|
+
It allows you to retrieve a list of available channels so you can
|
|
385
|
+
dynamically switch between them using `setChannel(...)`.
|
|
386
|
+
|
|
387
|
+
**Attention**: Only works for apps with public channels enabled.
|
|
388
|
+
If channels are private, they can still be set using `setChannel(...)`
|
|
389
|
+
but won't be returned by this method.
|
|
390
|
+
|
|
391
|
+
| Param | Type |
|
|
392
|
+
| ------------- | --------------------------------------------------------------------- |
|
|
393
|
+
| **`options`** | <code><a href="#fetchchannelsoptions">FetchChannelsOptions</a></code> |
|
|
394
|
+
|
|
395
|
+
**Returns:** <code>any</code>
|
|
396
|
+
|
|
397
|
+
**Since:** 0.1.0
|
|
398
|
+
|
|
399
|
+
--------------------
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
### fetchLatestBundle(...)
|
|
403
|
+
|
|
404
|
+
```typescript
|
|
405
|
+
fetchLatestBundle(options?: FetchLatestBundleOptions | undefined) => any
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
Fetch the latest bundle using the [Capawesome Cloud](https://capawesome.io/cloud/).
|
|
409
|
+
|
|
410
|
+
| Param | Type |
|
|
411
|
+
| ------------- | ----------------------------------------------------------------------------- |
|
|
412
|
+
| **`options`** | <code><a href="#fetchlatestbundleoptions">FetchLatestBundleOptions</a></code> |
|
|
413
|
+
|
|
414
|
+
**Returns:** <code>any</code>
|
|
415
|
+
|
|
416
|
+
**Since:** 0.1.0
|
|
417
|
+
|
|
418
|
+
--------------------
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
### getBlockedBundles()
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
getBlockedBundles() => any
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
Get all blocked bundle identifiers.
|
|
428
|
+
|
|
429
|
+
Returns the list of bundle identifiers that were automatically blocked
|
|
430
|
+
due to rollbacks when `autoBlockRolledBackBundles` is enabled.
|
|
431
|
+
|
|
432
|
+
**Returns:** <code>any</code>
|
|
433
|
+
|
|
434
|
+
**Since:** 0.1.0
|
|
435
|
+
|
|
436
|
+
--------------------
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
### getBundles()
|
|
440
|
+
|
|
441
|
+
```typescript
|
|
442
|
+
getBundles() => any
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
Get all identifiers of bundles that have been downloaded.
|
|
446
|
+
|
|
447
|
+
**Returns:** <code>any</code>
|
|
448
|
+
|
|
449
|
+
**Since:** 0.1.0
|
|
450
|
+
|
|
451
|
+
--------------------
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
### getChannel()
|
|
455
|
+
|
|
456
|
+
```typescript
|
|
457
|
+
getChannel() => any
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
Get the channel that is used for the update.
|
|
461
|
+
|
|
462
|
+
The channel is resolved in the following order (highest priority first):
|
|
463
|
+
1. `setChannel()` (SharedPreferences on Android / UserDefaults on iOS)
|
|
464
|
+
2. Native config (`CapawesomeLiveUpdateDefaultChannel` in `Info.plist` on iOS or
|
|
465
|
+
`capawesome_live_update_default_channel` in `strings.xml` on Android)
|
|
466
|
+
3. The `DEFAULT_CHANNEL` preference in `config.xml`
|
|
467
|
+
|
|
468
|
+
**Note**: The `channel` parameter of `sync()` takes the highest priority
|
|
469
|
+
but is not persisted and therefore not returned by this method.
|
|
470
|
+
|
|
471
|
+
**Returns:** <code>any</code>
|
|
472
|
+
|
|
473
|
+
**Since:** 0.1.0
|
|
474
|
+
|
|
475
|
+
--------------------
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
### getConfig()
|
|
479
|
+
|
|
480
|
+
```typescript
|
|
481
|
+
getConfig() => any
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
Get the runtime configuration.
|
|
485
|
+
|
|
486
|
+
Returns the current plugin configuration including any runtime
|
|
487
|
+
overrides set via `setConfig()`.
|
|
488
|
+
|
|
489
|
+
**Returns:** <code>any</code>
|
|
490
|
+
|
|
491
|
+
**Since:** 0.1.0
|
|
492
|
+
|
|
493
|
+
--------------------
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
### getDownloadedBundles()
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
getDownloadedBundles() => any
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
Get all identifiers of bundles that have been downloaded.
|
|
503
|
+
|
|
504
|
+
**Returns:** <code>any</code>
|
|
505
|
+
|
|
506
|
+
**Since:** 0.1.0
|
|
507
|
+
|
|
508
|
+
--------------------
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
### getCurrentBundle()
|
|
512
|
+
|
|
513
|
+
```typescript
|
|
514
|
+
getCurrentBundle() => any
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
Get the bundle identifier of the current bundle.
|
|
518
|
+
The current bundle is the bundle that is currently used by the app.
|
|
519
|
+
|
|
520
|
+
**Returns:** <code>any</code>
|
|
521
|
+
|
|
522
|
+
**Since:** 0.1.0
|
|
523
|
+
|
|
524
|
+
--------------------
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
### getCustomId()
|
|
528
|
+
|
|
529
|
+
```typescript
|
|
530
|
+
getCustomId() => any
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
Get the custom identifier of the device.
|
|
534
|
+
|
|
535
|
+
**Returns:** <code>any</code>
|
|
536
|
+
|
|
537
|
+
**Since:** 0.1.0
|
|
538
|
+
|
|
539
|
+
--------------------
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
### getDeviceId()
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
getDeviceId() => any
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
Get the unique device identifier.
|
|
549
|
+
|
|
550
|
+
**Returns:** <code>any</code>
|
|
551
|
+
|
|
552
|
+
**Since:** 0.1.0
|
|
553
|
+
|
|
554
|
+
--------------------
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
### isSyncing()
|
|
558
|
+
|
|
559
|
+
```typescript
|
|
560
|
+
isSyncing() => any
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
Check whether a sync operation is currently in progress.
|
|
564
|
+
|
|
565
|
+
**Returns:** <code>any</code>
|
|
566
|
+
|
|
567
|
+
**Since:** 0.1.0
|
|
568
|
+
|
|
569
|
+
--------------------
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
### getNextBundle()
|
|
573
|
+
|
|
574
|
+
```typescript
|
|
575
|
+
getNextBundle() => any
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
Get the bundle identifier of the next bundle.
|
|
579
|
+
The next bundle is the bundle that will be used after calling `reload()`
|
|
580
|
+
or restarting the app.
|
|
581
|
+
|
|
582
|
+
**Returns:** <code>any</code>
|
|
583
|
+
|
|
584
|
+
**Since:** 0.1.0
|
|
585
|
+
|
|
586
|
+
--------------------
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
### getVersionCode()
|
|
590
|
+
|
|
591
|
+
```typescript
|
|
592
|
+
getVersionCode() => any
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
Get the version code of the app.
|
|
596
|
+
|
|
597
|
+
On **Android**, this is the `versionCode` from `PackageInfo`.
|
|
598
|
+
On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file.
|
|
599
|
+
|
|
600
|
+
**Returns:** <code>any</code>
|
|
601
|
+
|
|
602
|
+
**Since:** 0.1.0
|
|
603
|
+
|
|
604
|
+
--------------------
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
### getVersionName()
|
|
608
|
+
|
|
609
|
+
```typescript
|
|
610
|
+
getVersionName() => any
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
Get the version name of the app.
|
|
614
|
+
|
|
615
|
+
On **Android**, this is the `versionName` from `PackageInfo`.
|
|
616
|
+
On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file.
|
|
617
|
+
|
|
618
|
+
**Returns:** <code>any</code>
|
|
619
|
+
|
|
620
|
+
**Since:** 0.1.0
|
|
621
|
+
|
|
622
|
+
--------------------
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
### ready()
|
|
626
|
+
|
|
627
|
+
```typescript
|
|
628
|
+
ready() => any
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
Notify the plugin that the app is ready to use and no rollback is needed.
|
|
632
|
+
|
|
633
|
+
**Attention**: This method should be called as soon as the app is ready to use
|
|
634
|
+
to prevent the app from being reset to the default bundle.
|
|
635
|
+
|
|
636
|
+
**Returns:** <code>any</code>
|
|
637
|
+
|
|
638
|
+
**Since:** 0.1.0
|
|
639
|
+
|
|
640
|
+
--------------------
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
### reload()
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
reload() => any
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
Reload the app to apply the new bundle.
|
|
650
|
+
|
|
651
|
+
**Returns:** <code>any</code>
|
|
652
|
+
|
|
653
|
+
**Since:** 0.1.0
|
|
654
|
+
|
|
655
|
+
--------------------
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
### reset()
|
|
659
|
+
|
|
660
|
+
```typescript
|
|
661
|
+
reset() => any
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
Reset the app to the default bundle.
|
|
665
|
+
|
|
666
|
+
Call `reload()` or restart the app to apply the changes.
|
|
667
|
+
|
|
668
|
+
**Returns:** <code>any</code>
|
|
669
|
+
|
|
670
|
+
**Since:** 0.1.0
|
|
671
|
+
|
|
672
|
+
--------------------
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
### resetConfig()
|
|
676
|
+
|
|
677
|
+
```typescript
|
|
678
|
+
resetConfig() => any
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
Reset the runtime configuration to the values from `config.xml`.
|
|
682
|
+
|
|
683
|
+
This clears any runtime configuration set via `setConfig()`.
|
|
684
|
+
The changes take effect immediately.
|
|
685
|
+
|
|
686
|
+
**Returns:** <code>any</code>
|
|
687
|
+
|
|
688
|
+
**Since:** 0.1.0
|
|
689
|
+
|
|
690
|
+
--------------------
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
### setChannel(...)
|
|
694
|
+
|
|
695
|
+
```typescript
|
|
696
|
+
setChannel(options: SetChannelOptions) => any
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
Set the channel to use for the update.
|
|
700
|
+
|
|
701
|
+
| Param | Type |
|
|
702
|
+
| ------------- | --------------------------------------------------------------- |
|
|
703
|
+
| **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> |
|
|
704
|
+
|
|
705
|
+
**Returns:** <code>any</code>
|
|
706
|
+
|
|
707
|
+
**Since:** 0.1.0
|
|
708
|
+
|
|
709
|
+
--------------------
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
### setConfig(...)
|
|
713
|
+
|
|
714
|
+
```typescript
|
|
715
|
+
setConfig(options: SetConfigOptions) => any
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
Set the runtime configuration.
|
|
719
|
+
|
|
720
|
+
This allows updating plugin configuration options at runtime.
|
|
721
|
+
The changes are persisted across app restarts and take effect immediately.
|
|
722
|
+
|
|
723
|
+
**Important:** Runtime configuration is automatically reset to default values
|
|
724
|
+
whenever the native app is updated to a new version. This ensures that
|
|
725
|
+
configuration from previous versions doesn't persist after an app update.
|
|
726
|
+
|
|
727
|
+
| Param | Type |
|
|
728
|
+
| ------------- | ------------------------------------------------------------- |
|
|
729
|
+
| **`options`** | <code><a href="#setconfigoptions">SetConfigOptions</a></code> |
|
|
730
|
+
|
|
731
|
+
**Returns:** <code>any</code>
|
|
732
|
+
|
|
733
|
+
**Since:** 0.1.0
|
|
734
|
+
|
|
735
|
+
--------------------
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
### setCustomId(...)
|
|
739
|
+
|
|
740
|
+
```typescript
|
|
741
|
+
setCustomId(options: SetCustomIdOptions) => any
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
Set the custom identifier of the device.
|
|
745
|
+
|
|
746
|
+
| Param | Type |
|
|
747
|
+
| ------------- | ----------------------------------------------------------------- |
|
|
748
|
+
| **`options`** | <code><a href="#setcustomidoptions">SetCustomIdOptions</a></code> |
|
|
749
|
+
|
|
750
|
+
**Returns:** <code>any</code>
|
|
751
|
+
|
|
752
|
+
**Since:** 0.1.0
|
|
753
|
+
|
|
754
|
+
--------------------
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
### setNextBundle(...)
|
|
758
|
+
|
|
759
|
+
```typescript
|
|
760
|
+
setNextBundle(options: SetNextBundleOptions) => any
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
Set the next bundle to use for the app.
|
|
764
|
+
|
|
765
|
+
Call `reload()` or restart the app to apply the changes.
|
|
766
|
+
|
|
767
|
+
| Param | Type |
|
|
768
|
+
| ------------- | --------------------------------------------------------------------- |
|
|
769
|
+
| **`options`** | <code><a href="#setnextbundleoptions">SetNextBundleOptions</a></code> |
|
|
770
|
+
|
|
771
|
+
**Returns:** <code>any</code>
|
|
772
|
+
|
|
773
|
+
**Since:** 0.1.0
|
|
774
|
+
|
|
775
|
+
--------------------
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
### sync(...)
|
|
779
|
+
|
|
780
|
+
```typescript
|
|
781
|
+
sync(options?: SyncOptions | undefined) => any
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
Automatically download and set the latest bundle for the app using the [Capawesome Cloud](https://capawesome.io/cloud/).
|
|
785
|
+
|
|
786
|
+
Call `reload()` or restart the app to apply the changes.
|
|
787
|
+
|
|
788
|
+
| Param | Type |
|
|
789
|
+
| ------------- | --------------------------------------------------- |
|
|
790
|
+
| **`options`** | <code><a href="#syncoptions">SyncOptions</a></code> |
|
|
791
|
+
|
|
792
|
+
**Returns:** <code>any</code>
|
|
793
|
+
|
|
794
|
+
**Since:** 0.1.0
|
|
795
|
+
|
|
796
|
+
--------------------
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
### addListener('downloadBundleProgress', ...)
|
|
800
|
+
|
|
801
|
+
```typescript
|
|
802
|
+
addListener(eventName: 'downloadBundleProgress', listenerFunc: DownloadBundleProgressListener) => any
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
Listen for the download progress of a bundle.
|
|
806
|
+
|
|
807
|
+
| Param | Type |
|
|
808
|
+
| ------------------ | ----------------------------------------------------------------------------------------- |
|
|
809
|
+
| **`eventName`** | <code>'downloadBundleProgress'</code> |
|
|
810
|
+
| **`listenerFunc`** | <code><a href="#downloadbundleprogresslistener">DownloadBundleProgressListener</a></code> |
|
|
811
|
+
|
|
812
|
+
**Returns:** <code>any</code>
|
|
813
|
+
|
|
814
|
+
**Since:** 0.1.0
|
|
815
|
+
|
|
816
|
+
--------------------
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
### addListener('nextBundleSet', ...)
|
|
820
|
+
|
|
821
|
+
```typescript
|
|
822
|
+
addListener(eventName: 'nextBundleSet', listenerFunc: NextBundleSetListener) => any
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
Listen for when a bundle is set as the next bundle.
|
|
826
|
+
|
|
827
|
+
This event is triggered whenever a bundle is set to be used on the next app restart,
|
|
828
|
+
either through automatic updates or manual calls to `setNextBundle()`.
|
|
829
|
+
|
|
830
|
+
| Param | Type |
|
|
831
|
+
| ------------------ | ----------------------------------------------------------------------- |
|
|
832
|
+
| **`eventName`** | <code>'nextBundleSet'</code> |
|
|
833
|
+
| **`listenerFunc`** | <code><a href="#nextbundlesetlistener">NextBundleSetListener</a></code> |
|
|
834
|
+
|
|
835
|
+
**Returns:** <code>any</code>
|
|
836
|
+
|
|
837
|
+
**Since:** 0.1.0
|
|
838
|
+
|
|
839
|
+
--------------------
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
### removeAllListeners()
|
|
843
|
+
|
|
844
|
+
```typescript
|
|
845
|
+
removeAllListeners() => any
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
Remove all listeners for this plugin.
|
|
849
|
+
|
|
850
|
+
**Returns:** <code>any</code>
|
|
851
|
+
|
|
852
|
+
**Since:** 0.1.0
|
|
853
|
+
|
|
854
|
+
--------------------
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
### Interfaces
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
#### DeleteBundleOptions
|
|
861
|
+
|
|
862
|
+
| Prop | Type | Description | Since |
|
|
863
|
+
| -------------- | ------------------- | ---------------------------------------------- | ----- |
|
|
864
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle to delete. | 0.1.0 |
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
#### DownloadBundleOptions
|
|
868
|
+
|
|
869
|
+
| Prop | Type | Description | Default | Since |
|
|
870
|
+
| ------------------ | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------ | ----- |
|
|
871
|
+
| **`artifactType`** | <code>'manifest' \| 'zip'</code> | The artifact type of the bundle. | <code>'zip'</code> | 0.1.0 |
|
|
872
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle. **Attention**: The value `public` is reserved and cannot be used as a bundle identifier. | | 0.1.0 |
|
|
873
|
+
| **`checksum`** | <code>string</code> | The checksum of the self-hosted bundle as a SHA-256 hash in hex format to verify the integrity of the bundle. **Attention**: Only supported for the `zip` artifact type. | | 0.1.0 |
|
|
874
|
+
| **`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. | | 0.1.0 |
|
|
875
|
+
| **`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 hex 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. | | 0.1.0 |
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
#### FetchChannelsOptions
|
|
879
|
+
|
|
880
|
+
| Prop | Type | Description | Default | Since |
|
|
881
|
+
| ------------ | ------------------- | ----------------------------------------- | --------------- | ----- |
|
|
882
|
+
| **`limit`** | <code>number</code> | The maximum number of channels to return. | <code>50</code> | 0.1.0 |
|
|
883
|
+
| **`offset`** | <code>number</code> | The number of channels to skip. | <code>0</code> | 0.1.0 |
|
|
884
|
+
| **`query`** | <code>string</code> | The query to filter channels by name. | | 0.1.0 |
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
#### FetchChannelsResult
|
|
888
|
+
|
|
889
|
+
| Prop | Type | Description | Since |
|
|
890
|
+
| -------------- | --------------- | --------------------- | ----- |
|
|
891
|
+
| **`channels`** | <code>{}</code> | The list of channels. | 0.1.0 |
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
#### Channel
|
|
895
|
+
|
|
896
|
+
| Prop | Type | Description | Since |
|
|
897
|
+
| ---------- | ------------------- | ------------------------------------- | ----- |
|
|
898
|
+
| **`id`** | <code>string</code> | The unique identifier of the channel. | 0.1.0 |
|
|
899
|
+
| **`name`** | <code>string</code> | The name of the channel. | 0.1.0 |
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
#### FetchLatestBundleOptions
|
|
903
|
+
|
|
904
|
+
| Prop | Type | Description | Since |
|
|
905
|
+
| ------------- | ------------------- | ---------------------------------------------------------------- | ----- |
|
|
906
|
+
| **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 0.1.0 |
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
#### FetchLatestBundleResult
|
|
910
|
+
|
|
911
|
+
| Prop | Type | Description | Since |
|
|
912
|
+
| ---------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
913
|
+
| **`artifactType`** | <code>'manifest' \| 'zip'</code> | The artifact type of the bundle. | 0.1.0 |
|
|
914
|
+
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the latest bundle. On Capawesome Cloud, this is the ID of the app build artifact. If `null`, no bundle is available. | 0.1.0 |
|
|
915
|
+
| **`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. | 0.1.0 |
|
|
916
|
+
| **`customProperties`** | <code>{ [key: string]: string; }</code> | Custom properties that are associated with the latest bundle. | 0.1.0 |
|
|
917
|
+
| **`downloadUrl`** | <code>string</code> | The URL of the latest bundle to download. Pass this URL to the `downloadBundle(...)` method to download the bundle. | 0.1.0 |
|
|
918
|
+
| **`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. | 0.1.0 |
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
#### GetBlockedBundlesResult
|
|
922
|
+
|
|
923
|
+
| Prop | Type | Description | Since |
|
|
924
|
+
| --------------- | --------------- | ------------------------------------------------------ | ----- |
|
|
925
|
+
| **`bundleIds`** | <code>{}</code> | An array of unique identifiers of all blocked bundles. | 0.1.0 |
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
#### GetBundlesResult
|
|
929
|
+
|
|
930
|
+
| Prop | Type | Description | Since |
|
|
931
|
+
| --------------- | --------------- | -------------------------------------------------------- | ----- |
|
|
932
|
+
| **`bundleIds`** | <code>{}</code> | An array of unique identifiers of all available bundles. | 0.1.0 |
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
#### GetChannelResult
|
|
936
|
+
|
|
937
|
+
| Prop | Type | Description | Since |
|
|
938
|
+
| ------------- | --------------------------- | ------------------------------------------------------------------ | ----- |
|
|
939
|
+
| **`channel`** | <code>string \| null</code> | The channel name. If `null`, the app is using the default channel. | 0.1.0 |
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
#### GetConfigResult
|
|
943
|
+
|
|
944
|
+
| Prop | Type | Description | Since |
|
|
945
|
+
| ------------------------ | ----------------------------------- | ------------------------------------------------------------------------ | ----- |
|
|
946
|
+
| **`appId`** | <code>string \| null</code> | The app ID used to identify the app. If `null`, no app ID is configured. | 0.1.0 |
|
|
947
|
+
| **`autoUpdateStrategy`** | <code>'none' \| 'background'</code> | The auto-update strategy for live updates. | 0.1.0 |
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
#### GetDownloadedBundlesResult
|
|
951
|
+
|
|
952
|
+
| Prop | Type | Description | Since |
|
|
953
|
+
| --------------- | --------------- | --------------------------------------------------------- | ----- |
|
|
954
|
+
| **`bundleIds`** | <code>{}</code> | An array of unique identifiers of all downloaded bundles. | 0.1.0 |
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
#### GetCurrentBundleResult
|
|
958
|
+
|
|
959
|
+
| Prop | Type | Description | Since |
|
|
960
|
+
| -------------- | --------------------------- | ----------------------------------------------------------------------------------------- | ----- |
|
|
961
|
+
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the current bundle. If `null`, the default bundle is being used. | 0.1.0 |
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
#### GetCustomIdResult
|
|
965
|
+
|
|
966
|
+
| Prop | Type | Description | Since |
|
|
967
|
+
| -------------- | --------------------------- | ---------------------------------------------------------------------------- | ----- |
|
|
968
|
+
| **`customId`** | <code>string \| null</code> | The custom identifier of the device. If `null`, no custom identifier is set. | 0.1.0 |
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
#### GetDeviceIdResult
|
|
972
|
+
|
|
973
|
+
| Prop | Type | Description | Since |
|
|
974
|
+
| -------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
|
|
975
|
+
| **`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. | 0.1.0 |
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
#### IsSyncingResult
|
|
979
|
+
|
|
980
|
+
| Prop | Type | Description | Since |
|
|
981
|
+
| ------------- | -------------------- | -------------------------------------------------- | ----- |
|
|
982
|
+
| **`syncing`** | <code>boolean</code> | Whether a sync operation is currently in progress. | 0.1.0 |
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
#### GetNextBundleResult
|
|
986
|
+
|
|
987
|
+
| Prop | Type | Description | Since |
|
|
988
|
+
| -------------- | --------------------------- | -------------------------------------------------------------------------------------- | ----- |
|
|
989
|
+
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the next bundle. If `null`, the default bundle is being used. | 0.1.0 |
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
#### GetVersionCodeResult
|
|
993
|
+
|
|
994
|
+
| Prop | Type | Description | Since |
|
|
995
|
+
| ----------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
996
|
+
| **`versionCode`** | <code>string</code> | The version code of the app. On **Android**, this is the `versionCode` from `PackageInfo`. On **iOS**, this is the `CFBundleVersion` from the `Info.plist` file. | 0.1.0 |
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
#### GetVersionNameResult
|
|
1000
|
+
|
|
1001
|
+
| Prop | Type | Description | Since |
|
|
1002
|
+
| ----------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
1003
|
+
| **`versionName`** | <code>string</code> | The version name of the app. On **Android**, this is the `versionName` from `PackageInfo`. On **iOS**, this is the `CFBundleShortVersionString` from the `Info.plist` file. | 0.1.0 |
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
#### ReadyResult
|
|
1007
|
+
|
|
1008
|
+
| Prop | Type | Description | Since |
|
|
1009
|
+
| ---------------------- | --------------------------- | --------------------------------------------------------------------------------------- | ----- |
|
|
1010
|
+
| **`previousBundleId`** | <code>string \| null</code> | The identifier of the previous bundle used. If `null`, the default bundle was used. | 0.1.0 |
|
|
1011
|
+
| **`currentBundleId`** | <code>string \| null</code> | The identifier of the current bundle used. If `null`, the default bundle is being used. | 0.1.0 |
|
|
1012
|
+
| **`rollback`** | <code>boolean</code> | Whether or not the app was reset to the default bundle. | 0.1.0 |
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
#### SetChannelOptions
|
|
1016
|
+
|
|
1017
|
+
| Prop | Type | Description | Since |
|
|
1018
|
+
| ------------- | --------------------------- | --------------------------------------------------- | ----- |
|
|
1019
|
+
| **`channel`** | <code>string \| null</code> | The channel name. Set `null` to remove the channel. | 0.1.0 |
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
#### SetConfigOptions
|
|
1023
|
+
|
|
1024
|
+
| Prop | Type | Description | Since |
|
|
1025
|
+
| ----------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
1026
|
+
| **`appId`** | <code>string \| null</code> | The app ID used to identify the app. Set `null` to reset to the value from the `APP_ID` preference in `config.xml`. | 0.1.0 |
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
#### SetCustomIdOptions
|
|
1030
|
+
|
|
1031
|
+
| Prop | Type | Description | Since |
|
|
1032
|
+
| -------------- | --------------------------- | -------------------------------------------------------------------------------- | ----- |
|
|
1033
|
+
| **`customId`** | <code>string \| null</code> | The custom identifier of the device. Set `null` to remove the custom identifier. | 0.1.0 |
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
#### SetNextBundleOptions
|
|
1037
|
+
|
|
1038
|
+
| Prop | Type | Description | Since |
|
|
1039
|
+
| -------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------- | ----- |
|
|
1040
|
+
| **`bundleId`** | <code>string \| null</code> | The unique identifier of the bundle to use. Set `null` to use the default bundle (same as calling `reset()`). | 0.1.0 |
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
#### SyncOptions
|
|
1044
|
+
|
|
1045
|
+
| Prop | Type | Description | Since |
|
|
1046
|
+
| ------------- | ------------------- | ---------------------------------------------------------------- | ----- |
|
|
1047
|
+
| **`channel`** | <code>string</code> | The name of the channel where the latest bundle is fetched from. | 0.1.0 |
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
#### SyncResult
|
|
1051
|
+
|
|
1052
|
+
| Prop | Type | Description | Since |
|
|
1053
|
+
| ------------------ | --------------------------- | ---------------------------------------------------------------------------------------------------------- | ----- |
|
|
1054
|
+
| **`nextBundleId`** | <code>string \| null</code> | The identifier of the next bundle to use. If `null`, the app is up-to-date and no new bundle is available. | 0.1.0 |
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
#### DownloadBundleProgressEvent
|
|
1058
|
+
|
|
1059
|
+
Event that is triggered when the download progress of a bundle changes.
|
|
1060
|
+
|
|
1061
|
+
| Prop | Type | Description | Since |
|
|
1062
|
+
| --------------------- | ------------------- | ----------------------------------------------------------------------- | ----- |
|
|
1063
|
+
| **`bundleId`** | <code>string</code> | The unique identifier of the bundle that is being downloaded. | 0.1.0 |
|
|
1064
|
+
| **`downloadedBytes`** | <code>number</code> | The number of bytes that have been downloaded. | 0.1.0 |
|
|
1065
|
+
| **`progress`** | <code>number</code> | The progress of the download in percent as a value between `0` and `1`. | 0.1.0 |
|
|
1066
|
+
| **`totalBytes`** | <code>number</code> | The total number of bytes to download. | 0.1.0 |
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
#### PluginListenerHandle
|
|
1070
|
+
|
|
1071
|
+
Handle returned from `addListener(...)`. Call `remove()` to detach the
|
|
1072
|
+
listener.
|
|
1073
|
+
|
|
1074
|
+
| Prop | Type |
|
|
1075
|
+
| ------------ | ------------------------- |
|
|
1076
|
+
| **`remove`** | <code>() => any</code> |
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
#### NextBundleSetEvent
|
|
1080
|
+
|
|
1081
|
+
Event that is triggered when a bundle is set as the next bundle.
|
|
1082
|
+
|
|
1083
|
+
| Prop | Type | Description | Since |
|
|
1084
|
+
| -------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------- | ----- |
|
|
1085
|
+
| **`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. | 0.1.0 |
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
### Type Aliases
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
#### DownloadBundleProgressListener
|
|
1092
|
+
|
|
1093
|
+
Listener for the download progress of a bundle.
|
|
1094
|
+
|
|
1095
|
+
<code>(event: <a href="#downloadbundleprogressevent">DownloadBundleProgressEvent</a>): void</code>
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
#### NextBundleSetListener
|
|
1099
|
+
|
|
1100
|
+
Listener for when a bundle is set as the next bundle.
|
|
1101
|
+
|
|
1102
|
+
<code>(event: <a href="#nextbundlesetevent">NextBundleSetEvent</a>): void</code>
|
|
1103
|
+
|
|
1104
|
+
</docgen-api>
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
## Changelog
|
|
1108
|
+
|
|
1109
|
+
See [CHANGELOG.md](CHANGELOG.md).
|
|
1110
|
+
|
|
1111
|
+
## License
|
|
1112
|
+
|
|
1113
|
+
See [LICENSE](LICENSE).
|