@capgo/capacitor-updater 6.0.0 → 6.0.2
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/README.md +530 -210
- package/android/build.gradle +3 -3
- package/android/proguard-rules.pro +28 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/Callback.java +13 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +315 -259
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +716 -411
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +4 -12
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +3 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +31 -22
- package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +41 -0
- package/dist/docs.json +884 -329
- package/dist/esm/definitions.d.ts +402 -242
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +21 -40
- package/dist/esm/web.js +21 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +21 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +21 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +226 -69
- package/ios/Plugin/CapacitorUpdaterPlugin.m +4 -1
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +227 -59
- package/ios/Plugin/CryptoCipher.swift +9 -3
- package/package.json +21 -24
package/README.md
CHANGED
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
[](https://console.algora.io/org/Capgo/bounties?status=open)
|
|
16
16
|
[](https://console.algora.io/org/Capgo/bounties?status=completed)
|
|
17
17
|
|
|
18
|
+
<h2><a href="https://capgo.app/consulting/">Hire a Capacitor consultant</a></h2>
|
|
19
|
+
|
|
18
20
|
Update Ionic Capacitor apps without App/Play Store review (Code-push / hot-code updates).
|
|
19
21
|
|
|
20
22
|
You have 3 ways possible :
|
|
21
|
-
- Use [capgo.app](https://capgo.app) a full featured auto
|
|
22
|
-
- Use your own server update with auto
|
|
23
|
+
- Use [capgo.app](https://capgo.app) a full featured auto-update system in 5 min Setup, to manage version, update, revert and see stats.
|
|
24
|
+
- Use your own server update with auto-update system
|
|
23
25
|
- Use manual methods to zip, upload, download, from JS to do it when you want.
|
|
24
26
|
|
|
25
27
|
|
|
@@ -27,7 +29,7 @@ You have 3 ways possible :
|
|
|
27
29
|
Join the [discord](https://discord.gg/VnYRvBfgA6) to get help.
|
|
28
30
|
|
|
29
31
|
## Documentation
|
|
30
|
-
I maintain a more user
|
|
32
|
+
I maintain a more user-friendly and complete [documentation here](https://capgo.app/docs/).
|
|
31
33
|
|
|
32
34
|
## Installation
|
|
33
35
|
|
|
@@ -38,16 +40,16 @@ npx cap sync
|
|
|
38
40
|
|
|
39
41
|
## Auto-update setup
|
|
40
42
|
|
|
41
|
-
Create your account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/
|
|
43
|
+
Create your account in [capgo.app](https://capgo.app) and get your [API key](https://web.capgo.app/dashboard/apikeys)
|
|
42
44
|
- Login to CLI `npx @capgo/cli@latest init API_KEY`
|
|
43
45
|
And follow the steps by step to setup your app.
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
For detailed instructions on the auto-update setup, refer to the [Auto update documentation](https://capgo.app/docs/plugin/cloud-mode/getting-started/).
|
|
46
48
|
|
|
47
49
|
|
|
48
50
|
## Manual setup
|
|
49
51
|
|
|
50
|
-
Download update distribution zipfiles from a custom
|
|
52
|
+
Download update distribution zipfiles from a custom URL. Manually control the entire update process.
|
|
51
53
|
|
|
52
54
|
- Edit your `capacitor.config.json` like below, set `autoUpdate` to false.
|
|
53
55
|
```json
|
|
@@ -67,7 +69,7 @@ Download update distribution zipfiles from a custom url. Manually control the en
|
|
|
67
69
|
import { CapacitorUpdater } from '@capgo/capacitor-updater'
|
|
68
70
|
CapacitorUpdater.notifyAppReady()
|
|
69
71
|
```
|
|
70
|
-
This informs Capacitor
|
|
72
|
+
This informs Capacitor Updater that the current update bundle has loaded succesfully. Failing to call this method will cause your application to be rolled back to the previously successful version (or built-in bundle).
|
|
71
73
|
- Add this to your application.
|
|
72
74
|
```javascript
|
|
73
75
|
const version = await CapacitorUpdater.download({
|
|
@@ -106,21 +108,153 @@ You might also consider performing auto-update when application state changes, a
|
|
|
106
108
|
|
|
107
109
|
```
|
|
108
110
|
|
|
109
|
-
TIP: If you prefer a secure and automated way to update your app, you can use [capgo.app](https://capgo.app) - a full-featured, auto
|
|
111
|
+
TIP: If you prefer a secure and automated way to update your app, you can use [capgo.app](https://capgo.app) - a full-featured, auto-update system.
|
|
112
|
+
|
|
113
|
+
### Store Guideline Compliance
|
|
114
|
+
|
|
115
|
+
Android Google Play and iOS App Store have corresponding guidelines that have rules you should be aware of before integrating the Capacitor-updater solution within your application.
|
|
116
|
+
|
|
117
|
+
#### Google play
|
|
118
|
+
|
|
119
|
+
Third paragraph of [Device and Network Abuse](https://support.google.com/googleplay/android-developer/answer/9888379?hl=en) topic describe that updating source code by any method besides Google Play's update mechanism is restricted. But this restriction does not apply to updating JavaScript bundles.
|
|
120
|
+
> This restriction does not apply to code that runs in a virtual machine and has limited access to Android APIs (such as JavaScript in a web view or browser).
|
|
121
|
+
|
|
122
|
+
That fully allow Capacitor-updater as it updates just JS bundles and can't update native code part.
|
|
123
|
+
|
|
124
|
+
#### App Store
|
|
125
|
+
|
|
126
|
+
Paragraph **3.3.2**, since back in 2015's [Apple Developer Program License Agreement](https://developer.apple.com/programs/ios/information/) fully allowed performing over-the-air updates of JavaScript and assets.
|
|
127
|
+
|
|
128
|
+
And in its latest version (20170605) [downloadable here](https://developer.apple.com/terms/) this ruling is even broader:
|
|
129
|
+
|
|
130
|
+
> Interpreted code may be downloaded to an Application, but only so long as such code:
|
|
131
|
+
- (a) does not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store
|
|
132
|
+
- (b) does not create a store or storefront for other code or applications
|
|
133
|
+
- (c) does not bypass signing, sandbox, or other security features of the OS.
|
|
134
|
+
|
|
135
|
+
Capacitor-updater allows you to respect these rules in full compliance, so long as the update you push does not significantly deviate your product from its original App Store approved intent.
|
|
136
|
+
|
|
137
|
+
To further remain in compliance with Apple's guidelines, we suggest that App Store-distributed apps don't enable the `Force update` scenario, since in the [App Store Review Guidelines](https://developer.apple.com/app-store/review/guidelines/) it is written that:
|
|
138
|
+
|
|
139
|
+
> Apps must not force users to rate the app, review the app, download other apps, or other similar actions to access functionality, content, or use of the app.
|
|
140
|
+
|
|
141
|
+
This is not a problem for the default behavior of background update, since it won't force the user to apply the new version until the next app close, but at least you should be aware of that ruling if you decide to show it.
|
|
110
142
|
|
|
111
143
|
### Packaging `dist.zip` update bundles
|
|
112
144
|
|
|
113
|
-
Capacitor
|
|
145
|
+
Capacitor Updater works by unzipping a compiled app bundle to the native device filesystem. Whatever you choose to name the file you upload/download from your release/update server URL (via either manual or automatic updating), this `.zip` bundle must meet the following requirements:
|
|
114
146
|
|
|
115
147
|
- The zip file should contain the full contents of your production Capacitor build output folder, usually `{project directory}/dist/` or `{project directory}/www/`. This is where `index.html` will be located, and it should also contain all bundled JavaScript, CSS, and web resources necessary for your app to run.
|
|
116
148
|
- Do not password encrypt the bundle zip file, or it will fail to unpack.
|
|
117
149
|
- Make sure the bundle does not contain any extra hidden files or folders, or it may fail to unpack.
|
|
118
150
|
|
|
151
|
+
## Updater Plugin Config
|
|
152
|
+
|
|
153
|
+
<docgen-config>
|
|
154
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
155
|
+
|
|
156
|
+
CapacitorUpdater can be configured with these options:
|
|
157
|
+
|
|
158
|
+
| Prop | Type | Description | Default | Since |
|
|
159
|
+
| ------------------------ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ------- |
|
|
160
|
+
| **`appReadyTimeout`** | <code>number</code> | Configure the number of milliseconds the native plugin should wait before considering an update 'failed'. Only available for Android and iOS. | <code>10000 // (10 seconds)</code> | |
|
|
161
|
+
| **`responseTimeout`** | <code>number</code> | Configure the number of milliseconds the native plugin should wait before considering API timeout. Only available for Android and iOS. | <code>20 // (20 second)</code> | |
|
|
162
|
+
| **`autoDeleteFailed`** | <code>boolean</code> | Configure whether the plugin should use automatically delete failed bundles. Only available for Android and iOS. | <code>true</code> | |
|
|
163
|
+
| **`autoDeletePrevious`** | <code>boolean</code> | Configure whether the plugin should use automatically delete previous bundles after a successful update. Only available for Android and iOS. | <code>true</code> | |
|
|
164
|
+
| **`autoUpdate`** | <code>boolean</code> | Configure whether the plugin should use Auto Update via an update server. Only available for Android and iOS. | <code>true</code> | |
|
|
165
|
+
| **`resetWhenUpdate`** | <code>boolean</code> | Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device. Only available for Android and iOS. | <code>true</code> | |
|
|
166
|
+
| **`updateUrl`** | <code>string</code> | Configure the URL / endpoint to which update checks are sent. Only available for Android and iOS. | <code>https://api.capgo.app/auto_update</code> | |
|
|
167
|
+
| **`statsUrl`** | <code>string</code> | Configure the URL / endpoint to which update statistics are sent. Only available for Android and iOS. Set to "" to disable stats reporting. | <code>https://api.capgo.app/stats</code> | |
|
|
168
|
+
| **`privateKey`** | <code>string</code> | Configure the private key for end to end live update encryption. Only available for Android and iOS. | <code>undefined</code> | |
|
|
169
|
+
| **`version`** | <code>string</code> | Configure the current version of the app. This will be used for the first update request. If not set, the plugin will get the version from the native code. Only available for Android and iOS. | <code>undefined</code> | 4.17.48 |
|
|
170
|
+
| **`directUpdate`** | <code>boolean</code> | Make the plugin direct install the update when the app what just updated/installed. Only for autoUpdate mode. Only available for Android and iOS. | <code>undefined</code> | 5.1.0 |
|
|
171
|
+
| **`periodCheckDelay`** | <code>number</code> | Configure the delay period for period update check. the unit is in seconds. Only available for Android and iOS. Cannot be less than 600 seconds (10 minutes). | <code>600 // (10 minutes)</code> | |
|
|
172
|
+
| **`localS3`** | <code>boolean</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
173
|
+
| **`localHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
174
|
+
| **`localWebHost`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
175
|
+
| **`localSupa`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
176
|
+
| **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing. | <code>undefined</code> | 4.17.48 |
|
|
177
|
+
| **`allowModifyUrl`** | <code>boolean</code> | Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side. | <code>false</code> | 5.4.0 |
|
|
178
|
+
| **`defaultChannel`** | <code>string</code> | Set the default channel for the app in the config. | <code>undefined</code> | 5.5.0 |
|
|
179
|
+
|
|
180
|
+
### Examples
|
|
181
|
+
|
|
182
|
+
In `capacitor.config.json`:
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"plugins": {
|
|
187
|
+
"CapacitorUpdater": {
|
|
188
|
+
"appReadyTimeout": 1000 // (1 second),
|
|
189
|
+
"responseTimeout": 10 // (10 second),
|
|
190
|
+
"autoDeleteFailed": false,
|
|
191
|
+
"autoDeletePrevious": false,
|
|
192
|
+
"autoUpdate": false,
|
|
193
|
+
"resetWhenUpdate": false,
|
|
194
|
+
"updateUrl": https://example.com/api/auto_update,
|
|
195
|
+
"statsUrl": https://example.com/api/stats,
|
|
196
|
+
"privateKey": undefined,
|
|
197
|
+
"version": undefined,
|
|
198
|
+
"directUpdate": undefined,
|
|
199
|
+
"periodCheckDelay": undefined,
|
|
200
|
+
"localS3": undefined,
|
|
201
|
+
"localHost": undefined,
|
|
202
|
+
"localWebHost": undefined,
|
|
203
|
+
"localSupa": undefined,
|
|
204
|
+
"localSupaAnon": undefined,
|
|
205
|
+
"allowModifyUrl": undefined,
|
|
206
|
+
"defaultChannel": undefined
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
In `capacitor.config.ts`:
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
/// <reference types="@capgo/capacitor-updater" />
|
|
216
|
+
|
|
217
|
+
import { CapacitorConfig } from '@capacitor/cli';
|
|
218
|
+
|
|
219
|
+
const config: CapacitorConfig = {
|
|
220
|
+
plugins: {
|
|
221
|
+
CapacitorUpdater: {
|
|
222
|
+
appReadyTimeout: 1000 // (1 second),
|
|
223
|
+
responseTimeout: 10 // (10 second),
|
|
224
|
+
autoDeleteFailed: false,
|
|
225
|
+
autoDeletePrevious: false,
|
|
226
|
+
autoUpdate: false,
|
|
227
|
+
resetWhenUpdate: false,
|
|
228
|
+
updateUrl: https://example.com/api/auto_update,
|
|
229
|
+
statsUrl: https://example.com/api/stats,
|
|
230
|
+
privateKey: undefined,
|
|
231
|
+
version: undefined,
|
|
232
|
+
directUpdate: undefined,
|
|
233
|
+
periodCheckDelay: undefined,
|
|
234
|
+
localS3: undefined,
|
|
235
|
+
localHost: undefined,
|
|
236
|
+
localWebHost: undefined,
|
|
237
|
+
localSupa: undefined,
|
|
238
|
+
localSupaAnon: undefined,
|
|
239
|
+
allowModifyUrl: undefined,
|
|
240
|
+
defaultChannel: undefined,
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export default config;
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
</docgen-config>
|
|
249
|
+
|
|
119
250
|
## API
|
|
120
251
|
|
|
121
252
|
<docgen-index>
|
|
122
253
|
|
|
123
254
|
* [`notifyAppReady()`](#notifyappready)
|
|
255
|
+
* [`setUpdateUrl(...)`](#setupdateurl)
|
|
256
|
+
* [`setStatsUrl(...)`](#setstatsurl)
|
|
257
|
+
* [`setChannelUrl(...)`](#setchannelurl)
|
|
124
258
|
* [`download(...)`](#download)
|
|
125
259
|
* [`next(...)`](#next)
|
|
126
260
|
* [`set(...)`](#set)
|
|
@@ -133,20 +267,23 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
|
|
|
133
267
|
* [`cancelDelay()`](#canceldelay)
|
|
134
268
|
* [`getLatest()`](#getlatest)
|
|
135
269
|
* [`setChannel(...)`](#setchannel)
|
|
270
|
+
* [`unsetChannel(...)`](#unsetchannel)
|
|
136
271
|
* [`getChannel()`](#getchannel)
|
|
137
272
|
* [`setCustomId(...)`](#setcustomid)
|
|
138
|
-
* [`
|
|
139
|
-
* [`addListener('noNeedUpdate', ...)`](#addlistenernoneedupdate)
|
|
140
|
-
* [`addListener('updateAvailable', ...)`](#addlistenerupdateavailable)
|
|
141
|
-
* [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete)
|
|
142
|
-
* [`addListener('majorAvailable', ...)`](#addlistenermajoravailable)
|
|
143
|
-
* [`addListener('updateFailed', ...)`](#addlistenerupdatefailed)
|
|
144
|
-
* [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed)
|
|
145
|
-
* [`addListener('appReloaded', ...)`](#addlistenerappreloaded)
|
|
273
|
+
* [`getBuiltinVersion()`](#getbuiltinversion)
|
|
146
274
|
* [`getDeviceId()`](#getdeviceid)
|
|
147
275
|
* [`getPluginVersion()`](#getpluginversion)
|
|
148
276
|
* [`isAutoUpdateEnabled()`](#isautoupdateenabled)
|
|
149
277
|
* [`removeAllListeners()`](#removealllisteners)
|
|
278
|
+
* [`addListener('download', ...)`](#addlistenerdownload-)
|
|
279
|
+
* [`addListener('noNeedUpdate', ...)`](#addlistenernoneedupdate-)
|
|
280
|
+
* [`addListener('updateAvailable', ...)`](#addlistenerupdateavailable-)
|
|
281
|
+
* [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete-)
|
|
282
|
+
* [`addListener('majorAvailable', ...)`](#addlistenermajoravailable-)
|
|
283
|
+
* [`addListener('updateFailed', ...)`](#addlistenerupdatefailed-)
|
|
284
|
+
* [`addListener('downloadFailed', ...)`](#addlistenerdownloadfailed-)
|
|
285
|
+
* [`addListener('appReloaded', ...)`](#addlistenerappreloaded-)
|
|
286
|
+
* [`addListener('appReady', ...)`](#addlistenerappready-)
|
|
150
287
|
* [Interfaces](#interfaces)
|
|
151
288
|
* [Type Aliases](#type-aliases)
|
|
152
289
|
|
|
@@ -158,14 +295,65 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
|
|
|
158
295
|
### notifyAppReady()
|
|
159
296
|
|
|
160
297
|
```typescript
|
|
161
|
-
notifyAppReady() => Promise<
|
|
298
|
+
notifyAppReady() => Promise<AppReadyResult>
|
|
162
299
|
```
|
|
163
300
|
|
|
164
|
-
Notify Capacitor Updater that the current bundle is working (a rollback will occur
|
|
301
|
+
Notify Capacitor Updater that the current bundle is working (a rollback will occur if this method is not called on every app launch)
|
|
165
302
|
By default this method should be called in the first 10 sec after app launch, otherwise a rollback will occur.
|
|
166
303
|
Change this behaviour with {@link appReadyTimeout}
|
|
167
304
|
|
|
168
|
-
**Returns:** <code>Promise<<a href="#
|
|
305
|
+
**Returns:** <code>Promise<<a href="#appreadyresult">AppReadyResult</a>></code>
|
|
306
|
+
|
|
307
|
+
--------------------
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
### setUpdateUrl(...)
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
setUpdateUrl(options: UpdateUrl) => Promise<void>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Set the updateUrl for the app, this will be used to check for updates.
|
|
317
|
+
|
|
318
|
+
| Param | Type | Description |
|
|
319
|
+
| ------------- | ----------------------------------------------- | ------------------------------------------------- |
|
|
320
|
+
| **`options`** | <code><a href="#updateurl">UpdateUrl</a></code> | contains the URL to use for checking for updates. |
|
|
321
|
+
|
|
322
|
+
**Since:** 5.4.0
|
|
323
|
+
|
|
324
|
+
--------------------
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
### setStatsUrl(...)
|
|
328
|
+
|
|
329
|
+
```typescript
|
|
330
|
+
setStatsUrl(options: StatsUrl) => Promise<void>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Set the statsUrl for the app, this will be used to send statistics. Passing an empty string will disable statistics gathering.
|
|
334
|
+
|
|
335
|
+
| Param | Type | Description |
|
|
336
|
+
| ------------- | --------------------------------------------- | ----------------------------------------------- |
|
|
337
|
+
| **`options`** | <code><a href="#statsurl">StatsUrl</a></code> | contains the URL to use for sending statistics. |
|
|
338
|
+
|
|
339
|
+
**Since:** 5.4.0
|
|
340
|
+
|
|
341
|
+
--------------------
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
### setChannelUrl(...)
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
setChannelUrl(options: ChannelUrl) => Promise<void>
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Set the channelUrl for the app, this will be used to set the channel.
|
|
351
|
+
|
|
352
|
+
| Param | Type | Description |
|
|
353
|
+
| ------------- | ------------------------------------------------- | ------------------------------------------------ |
|
|
354
|
+
| **`options`** | <code><a href="#channelurl">ChannelUrl</a></code> | contains the URL to use for setting the channel. |
|
|
355
|
+
|
|
356
|
+
**Since:** 5.4.0
|
|
169
357
|
|
|
170
358
|
--------------------
|
|
171
359
|
|
|
@@ -173,14 +361,14 @@ Change this behaviour with {@link appReadyTimeout}
|
|
|
173
361
|
### download(...)
|
|
174
362
|
|
|
175
363
|
```typescript
|
|
176
|
-
download(options:
|
|
364
|
+
download(options: DownloadOptions) => Promise<BundleInfo>
|
|
177
365
|
```
|
|
178
366
|
|
|
179
367
|
Download a new bundle from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
|
|
180
368
|
|
|
181
|
-
| Param | Type
|
|
182
|
-
| ------------- |
|
|
183
|
-
| **`options`** | <code>{
|
|
369
|
+
| Param | Type | Description |
|
|
370
|
+
| ------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
371
|
+
| **`options`** | <code><a href="#downloadoptions">DownloadOptions</a></code> | The {@link <a href="#downloadoptions">DownloadOptions</a>} for downloading a new bundle zip. |
|
|
184
372
|
|
|
185
373
|
**Returns:** <code>Promise<<a href="#bundleinfo">BundleInfo</a>></code>
|
|
186
374
|
|
|
@@ -190,14 +378,14 @@ Download a new bundle from the provided URL, it should be a zip file, with files
|
|
|
190
378
|
### next(...)
|
|
191
379
|
|
|
192
380
|
```typescript
|
|
193
|
-
next(options:
|
|
381
|
+
next(options: BundleId) => Promise<BundleInfo>
|
|
194
382
|
```
|
|
195
383
|
|
|
196
384
|
Set the next bundle to be used when the app is reloaded.
|
|
197
385
|
|
|
198
|
-
| Param | Type
|
|
199
|
-
| ------------- |
|
|
200
|
-
| **`options`** | <code>{ id
|
|
386
|
+
| Param | Type | Description |
|
|
387
|
+
| ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
388
|
+
| **`options`** | <code><a href="#bundleid">BundleId</a></code> | Contains the ID of the next Bundle to set on next app launch. {@link <a href="#bundleinfo">BundleInfo.id</a>} |
|
|
201
389
|
|
|
202
390
|
**Returns:** <code>Promise<<a href="#bundleinfo">BundleInfo</a>></code>
|
|
203
391
|
|
|
@@ -207,14 +395,14 @@ Set the next bundle to be used when the app is reloaded.
|
|
|
207
395
|
### set(...)
|
|
208
396
|
|
|
209
397
|
```typescript
|
|
210
|
-
set(options:
|
|
398
|
+
set(options: BundleId) => Promise<void>
|
|
211
399
|
```
|
|
212
400
|
|
|
213
401
|
Set the current bundle and immediately reloads the app.
|
|
214
402
|
|
|
215
|
-
| Param | Type
|
|
216
|
-
| ------------- |
|
|
217
|
-
| **`options`** | <code>{
|
|
403
|
+
| Param | Type | Description |
|
|
404
|
+
| ------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
405
|
+
| **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the new bundle id to set as current. |
|
|
218
406
|
|
|
219
407
|
--------------------
|
|
220
408
|
|
|
@@ -222,14 +410,14 @@ Set the current bundle and immediately reloads the app.
|
|
|
222
410
|
### delete(...)
|
|
223
411
|
|
|
224
412
|
```typescript
|
|
225
|
-
delete(options:
|
|
413
|
+
delete(options: BundleId) => Promise<void>
|
|
226
414
|
```
|
|
227
415
|
|
|
228
|
-
|
|
416
|
+
Deletes the specified bundle from the native app storage. Use with {@link list} to get the stored Bundle IDs.
|
|
229
417
|
|
|
230
|
-
| Param | Type
|
|
231
|
-
| ------------- |
|
|
232
|
-
| **`options`** | <code>{
|
|
418
|
+
| Param | Type | Description |
|
|
419
|
+
| ------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
420
|
+
| **`options`** | <code><a href="#bundleid">BundleId</a></code> | A {@link <a href="#bundleid">BundleId</a>} object containing the ID of a bundle to delete (note, this is the bundle id, NOT the version name) |
|
|
233
421
|
|
|
234
422
|
--------------------
|
|
235
423
|
|
|
@@ -237,12 +425,12 @@ Delete bundle in storage
|
|
|
237
425
|
### list()
|
|
238
426
|
|
|
239
427
|
```typescript
|
|
240
|
-
list() => Promise<
|
|
428
|
+
list() => Promise<BundleListResult>
|
|
241
429
|
```
|
|
242
430
|
|
|
243
|
-
Get all
|
|
431
|
+
Get all locally downloaded bundles in your app
|
|
244
432
|
|
|
245
|
-
**Returns:** <code>Promise<
|
|
433
|
+
**Returns:** <code>Promise<<a href="#bundlelistresult">BundleListResult</a>></code>
|
|
246
434
|
|
|
247
435
|
--------------------
|
|
248
436
|
|
|
@@ -250,14 +438,14 @@ Get all available bundles
|
|
|
250
438
|
### reset(...)
|
|
251
439
|
|
|
252
440
|
```typescript
|
|
253
|
-
reset(options?:
|
|
441
|
+
reset(options?: ResetOptions | undefined) => Promise<void>
|
|
254
442
|
```
|
|
255
443
|
|
|
256
|
-
|
|
444
|
+
Reset the app to the `builtin` bundle (the one sent to Apple App Store / Google Play Store ) or the last successfully loaded bundle.
|
|
257
445
|
|
|
258
|
-
| Param | Type
|
|
259
|
-
| ------------- |
|
|
260
|
-
| **`options`** | <code>{ toLastSuccessful
|
|
446
|
+
| Param | Type | Description |
|
|
447
|
+
| ------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
448
|
+
| **`options`** | <code><a href="#resetoptions">ResetOptions</a></code> | Containing {@link <a href="#resetoptions">ResetOptions.toLastSuccessful</a>}, `true` resets to the builtin bundle and `false` will reset to the last successfully loaded bundle. |
|
|
261
449
|
|
|
262
450
|
--------------------
|
|
263
451
|
|
|
@@ -265,12 +453,12 @@ Set the `builtin` bundle (the one sent to Apple store / Google play store ) as c
|
|
|
265
453
|
### current()
|
|
266
454
|
|
|
267
455
|
```typescript
|
|
268
|
-
current() => Promise<
|
|
456
|
+
current() => Promise<CurrentBundleResult>
|
|
269
457
|
```
|
|
270
458
|
|
|
271
|
-
Get the current bundle, if none are set it returns `builtin
|
|
459
|
+
Get the current bundle, if none are set it returns `builtin`. currentNative is the original bundle installed on the device
|
|
272
460
|
|
|
273
|
-
**Returns:** <code>Promise<
|
|
461
|
+
**Returns:** <code>Promise<<a href="#currentbundleresult">CurrentBundleResult</a>></code>
|
|
274
462
|
|
|
275
463
|
--------------------
|
|
276
464
|
|
|
@@ -289,14 +477,14 @@ Reload the view
|
|
|
289
477
|
### setMultiDelay(...)
|
|
290
478
|
|
|
291
479
|
```typescript
|
|
292
|
-
setMultiDelay(options:
|
|
480
|
+
setMultiDelay(options: MultiDelayConditions) => Promise<void>
|
|
293
481
|
```
|
|
294
482
|
|
|
295
|
-
|
|
483
|
+
Sets a {@link <a href="#delaycondition">DelayCondition</a>} array containing conditions that the Plugin will use to determine when to install updates.
|
|
296
484
|
|
|
297
|
-
| Param | Type
|
|
298
|
-
| ------------- |
|
|
299
|
-
| **`options`** | <code>
|
|
485
|
+
| Param | Type | Description |
|
|
486
|
+
| ------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
487
|
+
| **`options`** | <code><a href="#multidelayconditions">MultiDelayConditions</a></code> | Containing the {@link <a href="#multidelayconditions">MultiDelayConditions</a>} array of conditions to set |
|
|
300
488
|
|
|
301
489
|
**Since:** 4.3.0
|
|
302
490
|
|
|
@@ -309,7 +497,7 @@ Set <a href="#delaycondition">DelayCondition</a>, skip updates until one of the
|
|
|
309
497
|
cancelDelay() => Promise<void>
|
|
310
498
|
```
|
|
311
499
|
|
|
312
|
-
|
|
500
|
+
Cancels a {@link <a href="#delaycondition">DelayCondition</a>} to process an update immediately.
|
|
313
501
|
|
|
314
502
|
**Since:** 4.0.0
|
|
315
503
|
|
|
@@ -319,12 +507,12 @@ Cancel delay to updates as usual
|
|
|
319
507
|
### getLatest()
|
|
320
508
|
|
|
321
509
|
```typescript
|
|
322
|
-
getLatest() => Promise<
|
|
510
|
+
getLatest() => Promise<LatestVersion>
|
|
323
511
|
```
|
|
324
512
|
|
|
325
513
|
Get Latest bundle available from update Url
|
|
326
514
|
|
|
327
|
-
**Returns:** <code>Promise<<a href="#latestversion">
|
|
515
|
+
**Returns:** <code>Promise<<a href="#latestversion">LatestVersion</a>></code>
|
|
328
516
|
|
|
329
517
|
**Since:** 4.0.0
|
|
330
518
|
|
|
@@ -334,16 +522,35 @@ Get Latest bundle available from update Url
|
|
|
334
522
|
### setChannel(...)
|
|
335
523
|
|
|
336
524
|
```typescript
|
|
337
|
-
setChannel(options: SetChannelOptions) => Promise<
|
|
525
|
+
setChannel(options: SetChannelOptions) => Promise<ChannelRes>
|
|
338
526
|
```
|
|
339
527
|
|
|
340
|
-
|
|
528
|
+
Sets the channel for this device. The channel has to allow for self assignment for this to work.
|
|
529
|
+
Do not use this method to set the channel at boot when `autoUpdate` is enabled in the {@link PluginsConfig}.
|
|
530
|
+
This method is to set the channel after the app is ready.
|
|
341
531
|
|
|
342
532
|
| Param | Type | Description |
|
|
343
533
|
| ------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
344
|
-
| **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> |
|
|
534
|
+
| **`options`** | <code><a href="#setchanneloptions">SetChannelOptions</a></code> | Is the {@link <a href="#setchanneloptions">SetChannelOptions</a>} channel to set |
|
|
345
535
|
|
|
346
|
-
**Returns:** <code>Promise<<a href="#channelres">
|
|
536
|
+
**Returns:** <code>Promise<<a href="#channelres">ChannelRes</a>></code>
|
|
537
|
+
|
|
538
|
+
**Since:** 4.7.0
|
|
539
|
+
|
|
540
|
+
--------------------
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
### unsetChannel(...)
|
|
544
|
+
|
|
545
|
+
```typescript
|
|
546
|
+
unsetChannel(options: UnsetChannelOptions) => Promise<void>
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
Unset the channel for this device. The device will then return to the default channel
|
|
550
|
+
|
|
551
|
+
| Param | Type |
|
|
552
|
+
| ------------- | ------------------------------------------------------------------- |
|
|
553
|
+
| **`options`** | <code><a href="#unsetchanneloptions">UnsetChannelOptions</a></code> |
|
|
347
554
|
|
|
348
555
|
**Since:** 4.7.0
|
|
349
556
|
|
|
@@ -353,12 +560,12 @@ Set Channel for this device
|
|
|
353
560
|
### getChannel()
|
|
354
561
|
|
|
355
562
|
```typescript
|
|
356
|
-
getChannel() => Promise<
|
|
563
|
+
getChannel() => Promise<GetChannelRes>
|
|
357
564
|
```
|
|
358
565
|
|
|
359
|
-
|
|
566
|
+
Get the channel for this device
|
|
360
567
|
|
|
361
|
-
**Returns:** <code>Promise<<a href="#getchannelres">
|
|
568
|
+
**Returns:** <code>Promise<<a href="#getchannelres">GetChannelRes</a>></code>
|
|
362
569
|
|
|
363
570
|
**Since:** 4.8.0
|
|
364
571
|
|
|
@@ -371,7 +578,7 @@ get Channel for this device
|
|
|
371
578
|
setCustomId(options: SetCustomIdOptions) => Promise<void>
|
|
372
579
|
```
|
|
373
580
|
|
|
374
|
-
Set
|
|
581
|
+
Set a custom ID for this device
|
|
375
582
|
|
|
376
583
|
| Param | Type | Description |
|
|
377
584
|
| ------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
@@ -382,214 +589,249 @@ Set Channel for this device
|
|
|
382
589
|
--------------------
|
|
383
590
|
|
|
384
591
|
|
|
385
|
-
###
|
|
592
|
+
### getBuiltinVersion()
|
|
386
593
|
|
|
387
594
|
```typescript
|
|
388
|
-
|
|
595
|
+
getBuiltinVersion() => Promise<BuiltinVersion>
|
|
389
596
|
```
|
|
390
597
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
| Param | Type |
|
|
394
|
-
| ------------------ | ------------------------------------------------------------------------- |
|
|
395
|
-
| **`eventName`** | <code>'download'</code> |
|
|
396
|
-
| **`listenerFunc`** | <code><a href="#downloadchangelistener">DownloadChangeListener</a></code> |
|
|
598
|
+
Get the native app version or the builtin version if set in config
|
|
397
599
|
|
|
398
|
-
**Returns:** <code>Promise<<a href="#
|
|
600
|
+
**Returns:** <code>Promise<<a href="#builtinversion">BuiltinVersion</a>></code>
|
|
399
601
|
|
|
400
|
-
**Since:** 2.0
|
|
602
|
+
**Since:** 5.2.0
|
|
401
603
|
|
|
402
604
|
--------------------
|
|
403
605
|
|
|
404
606
|
|
|
405
|
-
###
|
|
607
|
+
### getDeviceId()
|
|
406
608
|
|
|
407
609
|
```typescript
|
|
408
|
-
|
|
610
|
+
getDeviceId() => Promise<DeviceId>
|
|
409
611
|
```
|
|
410
612
|
|
|
411
|
-
|
|
613
|
+
Get unique ID used to identify device (sent to auto update server)
|
|
412
614
|
|
|
413
|
-
|
|
414
|
-
| ------------------ | --------------------------------------------------------- |
|
|
415
|
-
| **`eventName`** | <code>'noNeedUpdate'</code> |
|
|
416
|
-
| **`listenerFunc`** | <code><a href="#noneedlistener">NoNeedListener</a></code> |
|
|
615
|
+
**Returns:** <code>Promise<<a href="#deviceid">DeviceId</a>></code>
|
|
417
616
|
|
|
418
|
-
|
|
617
|
+
--------------------
|
|
419
618
|
|
|
420
|
-
|
|
619
|
+
|
|
620
|
+
### getPluginVersion()
|
|
621
|
+
|
|
622
|
+
```typescript
|
|
623
|
+
getPluginVersion() => Promise<PluginVersion>
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
Get the native Capacitor Updater plugin version (sent to auto update server)
|
|
627
|
+
|
|
628
|
+
**Returns:** <code>Promise<<a href="#pluginversion">PluginVersion</a>></code>
|
|
421
629
|
|
|
422
630
|
--------------------
|
|
423
631
|
|
|
424
632
|
|
|
425
|
-
###
|
|
633
|
+
### isAutoUpdateEnabled()
|
|
426
634
|
|
|
427
635
|
```typescript
|
|
428
|
-
|
|
636
|
+
isAutoUpdateEnabled() => Promise<AutoUpdateEnabled>
|
|
429
637
|
```
|
|
430
638
|
|
|
431
|
-
|
|
639
|
+
Get the state of auto update config.
|
|
640
|
+
|
|
641
|
+
**Returns:** <code>Promise<<a href="#autoupdateenabled">AutoUpdateEnabled</a>></code>
|
|
432
642
|
|
|
433
|
-
|
|
434
|
-
| ------------------ | ----------------------------------------------------------------------------- |
|
|
435
|
-
| **`eventName`** | <code>'updateAvailable'</code> |
|
|
436
|
-
| **`listenerFunc`** | <code><a href="#updateavailabledlistener">UpdateAvailabledListener</a></code> |
|
|
643
|
+
--------------------
|
|
437
644
|
|
|
438
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
|
|
439
645
|
|
|
440
|
-
|
|
646
|
+
### removeAllListeners()
|
|
647
|
+
|
|
648
|
+
```typescript
|
|
649
|
+
removeAllListeners() => Promise<void>
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
Remove all listeners for this plugin.
|
|
653
|
+
|
|
654
|
+
**Since:** 1.0.0
|
|
441
655
|
|
|
442
656
|
--------------------
|
|
443
657
|
|
|
444
658
|
|
|
445
|
-
### addListener('
|
|
659
|
+
### addListener('download', ...)
|
|
446
660
|
|
|
447
661
|
```typescript
|
|
448
|
-
addListener(eventName: "
|
|
662
|
+
addListener(eventName: "download", listenerFunc: (state: DownloadEvent) => void) => Promise<PluginListenerHandle>
|
|
449
663
|
```
|
|
450
664
|
|
|
451
|
-
Listen for download event in the App
|
|
665
|
+
Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.
|
|
452
666
|
|
|
453
|
-
| Param | Type
|
|
454
|
-
| ------------------ |
|
|
455
|
-
| **`eventName`** | <code>'
|
|
456
|
-
| **`listenerFunc`** | <code
|
|
667
|
+
| Param | Type |
|
|
668
|
+
| ------------------ | --------------------------------------------------------------------------- |
|
|
669
|
+
| **`eventName`** | <code>'download'</code> |
|
|
670
|
+
| **`listenerFunc`** | <code>(state: <a href="#downloadevent">DownloadEvent</a>) => void</code> |
|
|
457
671
|
|
|
458
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>>
|
|
672
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
459
673
|
|
|
460
|
-
**Since:**
|
|
674
|
+
**Since:** 2.0.11
|
|
461
675
|
|
|
462
676
|
--------------------
|
|
463
677
|
|
|
464
678
|
|
|
465
|
-
### addListener('
|
|
679
|
+
### addListener('noNeedUpdate', ...)
|
|
466
680
|
|
|
467
681
|
```typescript
|
|
468
|
-
addListener(eventName: "
|
|
682
|
+
addListener(eventName: "noNeedUpdate", listenerFunc: (state: NoNeedEvent) => void) => Promise<PluginListenerHandle>
|
|
469
683
|
```
|
|
470
684
|
|
|
471
|
-
Listen for
|
|
685
|
+
Listen for no need to update event, useful when you want force check every time the app is launched
|
|
472
686
|
|
|
473
|
-
| Param | Type
|
|
474
|
-
| ------------------ |
|
|
475
|
-
| **`eventName`** | <code>'
|
|
476
|
-
| **`listenerFunc`** | <code
|
|
687
|
+
| Param | Type |
|
|
688
|
+
| ------------------ | ----------------------------------------------------------------------- |
|
|
689
|
+
| **`eventName`** | <code>'noNeedUpdate'</code> |
|
|
690
|
+
| **`listenerFunc`** | <code>(state: <a href="#noneedevent">NoNeedEvent</a>) => void</code> |
|
|
477
691
|
|
|
478
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>>
|
|
692
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
479
693
|
|
|
480
|
-
**Since:**
|
|
694
|
+
**Since:** 4.0.0
|
|
481
695
|
|
|
482
696
|
--------------------
|
|
483
697
|
|
|
484
698
|
|
|
485
|
-
### addListener('
|
|
699
|
+
### addListener('updateAvailable', ...)
|
|
486
700
|
|
|
487
701
|
```typescript
|
|
488
|
-
addListener(eventName: "
|
|
702
|
+
addListener(eventName: "updateAvailable", listenerFunc: (state: UpdateAvailableEvent) => void) => Promise<PluginListenerHandle>
|
|
489
703
|
```
|
|
490
704
|
|
|
491
|
-
Listen for update
|
|
705
|
+
Listen for available update event, useful when you want to force check every time the app is launched
|
|
492
706
|
|
|
493
|
-
| Param | Type
|
|
494
|
-
| ------------------ |
|
|
495
|
-
| **`eventName`** | <code>'
|
|
496
|
-
| **`listenerFunc`** | <code
|
|
707
|
+
| Param | Type |
|
|
708
|
+
| ------------------ | ----------------------------------------------------------------------------------------- |
|
|
709
|
+
| **`eventName`** | <code>'updateAvailable'</code> |
|
|
710
|
+
| **`listenerFunc`** | <code>(state: <a href="#updateavailableevent">UpdateAvailableEvent</a>) => void</code> |
|
|
497
711
|
|
|
498
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>>
|
|
712
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
499
713
|
|
|
500
|
-
**Since:**
|
|
714
|
+
**Since:** 4.0.0
|
|
501
715
|
|
|
502
716
|
--------------------
|
|
503
717
|
|
|
504
718
|
|
|
505
|
-
### addListener('
|
|
719
|
+
### addListener('downloadComplete', ...)
|
|
506
720
|
|
|
507
721
|
```typescript
|
|
508
|
-
addListener(eventName: "
|
|
722
|
+
addListener(eventName: "downloadComplete", listenerFunc: (state: DownloadCompleteEvent) => void) => Promise<PluginListenerHandle>
|
|
509
723
|
```
|
|
510
724
|
|
|
511
|
-
Listen for
|
|
725
|
+
Listen for downloadComplete events.
|
|
512
726
|
|
|
513
|
-
| Param | Type
|
|
514
|
-
| ------------------ |
|
|
515
|
-
| **`eventName`** | <code>'
|
|
516
|
-
| **`listenerFunc`** | <code
|
|
727
|
+
| Param | Type |
|
|
728
|
+
| ------------------ | ------------------------------------------------------------------------------------------- |
|
|
729
|
+
| **`eventName`** | <code>'downloadComplete'</code> |
|
|
730
|
+
| **`listenerFunc`** | <code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>) => void</code> |
|
|
517
731
|
|
|
518
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>>
|
|
732
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
519
733
|
|
|
520
734
|
**Since:** 4.0.0
|
|
521
735
|
|
|
522
736
|
--------------------
|
|
523
737
|
|
|
524
738
|
|
|
525
|
-
### addListener('
|
|
739
|
+
### addListener('majorAvailable', ...)
|
|
526
740
|
|
|
527
741
|
```typescript
|
|
528
|
-
addListener(eventName: "
|
|
742
|
+
addListener(eventName: "majorAvailable", listenerFunc: (state: MajorAvailableEvent) => void) => Promise<PluginListenerHandle>
|
|
529
743
|
```
|
|
530
744
|
|
|
531
|
-
Listen for
|
|
745
|
+
Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
|
|
532
746
|
|
|
533
|
-
| Param | Type
|
|
534
|
-
| ------------------ |
|
|
535
|
-
| **`eventName`** | <code>'
|
|
536
|
-
| **`listenerFunc`** | <code
|
|
747
|
+
| Param | Type |
|
|
748
|
+
| ------------------ | --------------------------------------------------------------------------------------- |
|
|
749
|
+
| **`eventName`** | <code>'majorAvailable'</code> |
|
|
750
|
+
| **`listenerFunc`** | <code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>) => void</code> |
|
|
537
751
|
|
|
538
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>>
|
|
752
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
539
753
|
|
|
540
|
-
**Since:**
|
|
754
|
+
**Since:** 2.3.0
|
|
541
755
|
|
|
542
756
|
--------------------
|
|
543
757
|
|
|
544
758
|
|
|
545
|
-
###
|
|
759
|
+
### addListener('updateFailed', ...)
|
|
546
760
|
|
|
547
761
|
```typescript
|
|
548
|
-
|
|
762
|
+
addListener(eventName: "updateFailed", listenerFunc: (state: UpdateFailedEvent) => void) => Promise<PluginListenerHandle>
|
|
549
763
|
```
|
|
550
764
|
|
|
551
|
-
|
|
765
|
+
Listen for update fail event in the App, let you know when update has fail to install at next app start
|
|
766
|
+
|
|
767
|
+
| Param | Type |
|
|
768
|
+
| ------------------ | ----------------------------------------------------------------------------------- |
|
|
769
|
+
| **`eventName`** | <code>'updateFailed'</code> |
|
|
770
|
+
| **`listenerFunc`** | <code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>) => void</code> |
|
|
552
771
|
|
|
553
|
-
**Returns:** <code>Promise<
|
|
772
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
773
|
+
|
|
774
|
+
**Since:** 2.3.0
|
|
554
775
|
|
|
555
776
|
--------------------
|
|
556
777
|
|
|
557
778
|
|
|
558
|
-
###
|
|
779
|
+
### addListener('downloadFailed', ...)
|
|
559
780
|
|
|
560
781
|
```typescript
|
|
561
|
-
|
|
782
|
+
addListener(eventName: "downloadFailed", listenerFunc: (state: DownloadFailedEvent) => void) => Promise<PluginListenerHandle>
|
|
562
783
|
```
|
|
563
784
|
|
|
564
|
-
|
|
785
|
+
Listen for download fail event in the App, let you know when a bundle download has failed
|
|
565
786
|
|
|
566
|
-
|
|
787
|
+
| Param | Type |
|
|
788
|
+
| ------------------ | --------------------------------------------------------------------------------------- |
|
|
789
|
+
| **`eventName`** | <code>'downloadFailed'</code> |
|
|
790
|
+
| **`listenerFunc`** | <code>(state: <a href="#downloadfailedevent">DownloadFailedEvent</a>) => void</code> |
|
|
791
|
+
|
|
792
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
793
|
+
|
|
794
|
+
**Since:** 4.0.0
|
|
567
795
|
|
|
568
796
|
--------------------
|
|
569
797
|
|
|
570
798
|
|
|
571
|
-
###
|
|
799
|
+
### addListener('appReloaded', ...)
|
|
572
800
|
|
|
573
801
|
```typescript
|
|
574
|
-
|
|
802
|
+
addListener(eventName: "appReloaded", listenerFunc: () => void) => Promise<PluginListenerHandle>
|
|
575
803
|
```
|
|
576
804
|
|
|
577
|
-
|
|
805
|
+
Listen for reload event in the App, let you know when reload has happened
|
|
578
806
|
|
|
579
|
-
|
|
807
|
+
| Param | Type |
|
|
808
|
+
| ------------------ | -------------------------- |
|
|
809
|
+
| **`eventName`** | <code>'appReloaded'</code> |
|
|
810
|
+
| **`listenerFunc`** | <code>() => void</code> |
|
|
811
|
+
|
|
812
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
813
|
+
|
|
814
|
+
**Since:** 4.3.0
|
|
580
815
|
|
|
581
816
|
--------------------
|
|
582
817
|
|
|
583
818
|
|
|
584
|
-
###
|
|
819
|
+
### addListener('appReady', ...)
|
|
585
820
|
|
|
586
821
|
```typescript
|
|
587
|
-
|
|
822
|
+
addListener(eventName: "appReady", listenerFunc: (state: AppReadyEvent) => void) => Promise<PluginListenerHandle>
|
|
588
823
|
```
|
|
589
824
|
|
|
590
|
-
|
|
825
|
+
Listen for app ready event in the App, let you know when app is ready to use
|
|
591
826
|
|
|
592
|
-
|
|
827
|
+
| Param | Type |
|
|
828
|
+
| ------------------ | --------------------------------------------------------------------------- |
|
|
829
|
+
| **`eventName`** | <code>'appReady'</code> |
|
|
830
|
+
| **`listenerFunc`** | <code>(state: <a href="#appreadyevent">AppReadyEvent</a>) => void</code> |
|
|
831
|
+
|
|
832
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
833
|
+
|
|
834
|
+
**Since:** 5.1.0
|
|
593
835
|
|
|
594
836
|
--------------------
|
|
595
837
|
|
|
@@ -597,6 +839,13 @@ Remove all listeners for this plugin.
|
|
|
597
839
|
### Interfaces
|
|
598
840
|
|
|
599
841
|
|
|
842
|
+
#### AppReadyResult
|
|
843
|
+
|
|
844
|
+
| Prop | Type |
|
|
845
|
+
| ------------ | ------------------------------------------------- |
|
|
846
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> |
|
|
847
|
+
|
|
848
|
+
|
|
600
849
|
#### BundleInfo
|
|
601
850
|
|
|
602
851
|
| Prop | Type |
|
|
@@ -608,6 +857,73 @@ Remove all listeners for this plugin.
|
|
|
608
857
|
| **`status`** | <code><a href="#bundlestatus">BundleStatus</a></code> |
|
|
609
858
|
|
|
610
859
|
|
|
860
|
+
#### UpdateUrl
|
|
861
|
+
|
|
862
|
+
| Prop | Type |
|
|
863
|
+
| --------- | ------------------- |
|
|
864
|
+
| **`url`** | <code>string</code> |
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
#### StatsUrl
|
|
868
|
+
|
|
869
|
+
| Prop | Type |
|
|
870
|
+
| --------- | ------------------- |
|
|
871
|
+
| **`url`** | <code>string</code> |
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
#### ChannelUrl
|
|
875
|
+
|
|
876
|
+
| Prop | Type |
|
|
877
|
+
| --------- | ------------------- |
|
|
878
|
+
| **`url`** | <code>string</code> |
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
#### DownloadOptions
|
|
882
|
+
|
|
883
|
+
| Prop | Type | Description |
|
|
884
|
+
| ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
885
|
+
| **`url`** | <code>string</code> | The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a GitHub tag, any other place you've hosted your bundle.) |
|
|
886
|
+
| **`version`** | <code>string</code> | The version code/name of this bundle/version |
|
|
887
|
+
| **`sessionKey`** | <code>string</code> | |
|
|
888
|
+
| **`checksum`** | <code>string</code> | |
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
#### BundleId
|
|
892
|
+
|
|
893
|
+
| Prop | Type |
|
|
894
|
+
| -------- | ------------------- |
|
|
895
|
+
| **`id`** | <code>string</code> |
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
#### BundleListResult
|
|
899
|
+
|
|
900
|
+
| Prop | Type |
|
|
901
|
+
| ------------- | ------------------------- |
|
|
902
|
+
| **`bundles`** | <code>BundleInfo[]</code> |
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
#### ResetOptions
|
|
906
|
+
|
|
907
|
+
| Prop | Type |
|
|
908
|
+
| ---------------------- | -------------------- |
|
|
909
|
+
| **`toLastSuccessful`** | <code>boolean</code> |
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
#### CurrentBundleResult
|
|
913
|
+
|
|
914
|
+
| Prop | Type |
|
|
915
|
+
| ------------ | ------------------------------------------------- |
|
|
916
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> |
|
|
917
|
+
| **`native`** | <code>string</code> |
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
#### MultiDelayConditions
|
|
921
|
+
|
|
922
|
+
| Prop | Type |
|
|
923
|
+
| --------------------- | ----------------------------- |
|
|
924
|
+
| **`delayConditions`** | <code>DelayCondition[]</code> |
|
|
925
|
+
|
|
926
|
+
|
|
611
927
|
#### DelayCondition
|
|
612
928
|
|
|
613
929
|
| Prop | Type | Description |
|
|
@@ -616,20 +932,20 @@ Remove all listeners for this plugin.
|
|
|
616
932
|
| **`value`** | <code>string</code> | |
|
|
617
933
|
|
|
618
934
|
|
|
619
|
-
####
|
|
935
|
+
#### LatestVersion
|
|
620
936
|
|
|
621
|
-
| Prop | Type | Description
|
|
622
|
-
| ---------------- | -------------------- |
|
|
623
|
-
| **`version`** | <code>string</code> |
|
|
624
|
-
| **`major`** | <code>boolean</code> |
|
|
625
|
-
| **`message`** | <code>string</code> |
|
|
626
|
-
| **`sessionKey`** | <code>string</code> |
|
|
627
|
-
| **`error`** | <code>string</code> |
|
|
628
|
-
| **`old`** | <code>string</code> |
|
|
629
|
-
| **`url`** | <code>string</code> |
|
|
937
|
+
| Prop | Type | Description | Since |
|
|
938
|
+
| ---------------- | -------------------- | -------------------------- | ----- |
|
|
939
|
+
| **`version`** | <code>string</code> | Result of getLatest method | 4.0.0 |
|
|
940
|
+
| **`major`** | <code>boolean</code> | | |
|
|
941
|
+
| **`message`** | <code>string</code> | | |
|
|
942
|
+
| **`sessionKey`** | <code>string</code> | | |
|
|
943
|
+
| **`error`** | <code>string</code> | | |
|
|
944
|
+
| **`old`** | <code>string</code> | | |
|
|
945
|
+
| **`url`** | <code>string</code> | | |
|
|
630
946
|
|
|
631
947
|
|
|
632
|
-
####
|
|
948
|
+
#### ChannelRes
|
|
633
949
|
|
|
634
950
|
| Prop | Type | Description | Since |
|
|
635
951
|
| ------------- | ------------------- | ----------------------------- | ----- |
|
|
@@ -640,12 +956,20 @@ Remove all listeners for this plugin.
|
|
|
640
956
|
|
|
641
957
|
#### SetChannelOptions
|
|
642
958
|
|
|
643
|
-
| Prop
|
|
644
|
-
|
|
|
645
|
-
| **`channel`**
|
|
959
|
+
| Prop | Type |
|
|
960
|
+
| ----------------------- | -------------------- |
|
|
961
|
+
| **`channel`** | <code>string</code> |
|
|
962
|
+
| **`triggerAutoUpdate`** | <code>boolean</code> |
|
|
963
|
+
|
|
646
964
|
|
|
965
|
+
#### UnsetChannelOptions
|
|
647
966
|
|
|
648
|
-
|
|
967
|
+
| Prop | Type |
|
|
968
|
+
| ----------------------- | -------------------- |
|
|
969
|
+
| **`triggerAutoUpdate`** | <code>boolean</code> |
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
#### GetChannelRes
|
|
649
973
|
|
|
650
974
|
| Prop | Type | Description | Since |
|
|
651
975
|
| -------------- | -------------------- | ----------------------------- | ----- |
|
|
@@ -663,6 +987,34 @@ Remove all listeners for this plugin.
|
|
|
663
987
|
| **`customId`** | <code>string</code> |
|
|
664
988
|
|
|
665
989
|
|
|
990
|
+
#### BuiltinVersion
|
|
991
|
+
|
|
992
|
+
| Prop | Type |
|
|
993
|
+
| ------------- | ------------------- |
|
|
994
|
+
| **`version`** | <code>string</code> |
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
#### DeviceId
|
|
998
|
+
|
|
999
|
+
| Prop | Type |
|
|
1000
|
+
| -------------- | ------------------- |
|
|
1001
|
+
| **`deviceId`** | <code>string</code> |
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
#### PluginVersion
|
|
1005
|
+
|
|
1006
|
+
| Prop | Type |
|
|
1007
|
+
| ------------- | ------------------- |
|
|
1008
|
+
| **`version`** | <code>string</code> |
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
#### AutoUpdateEnabled
|
|
1012
|
+
|
|
1013
|
+
| Prop | Type |
|
|
1014
|
+
| ------------- | -------------------- |
|
|
1015
|
+
| **`enabled`** | <code>boolean</code> |
|
|
1016
|
+
|
|
1017
|
+
|
|
666
1018
|
#### PluginListenerHandle
|
|
667
1019
|
|
|
668
1020
|
| Prop | Type |
|
|
@@ -678,14 +1030,14 @@ Remove all listeners for this plugin.
|
|
|
678
1030
|
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | | |
|
|
679
1031
|
|
|
680
1032
|
|
|
681
|
-
####
|
|
1033
|
+
#### NoNeedEvent
|
|
682
1034
|
|
|
683
1035
|
| Prop | Type | Description | Since |
|
|
684
1036
|
| ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
|
|
685
1037
|
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Current status of download, between 0 and 100. | 4.0.0 |
|
|
686
1038
|
|
|
687
1039
|
|
|
688
|
-
####
|
|
1040
|
+
#### UpdateAvailableEvent
|
|
689
1041
|
|
|
690
1042
|
| Prop | Type | Description | Since |
|
|
691
1043
|
| ------------ | ------------------------------------------------- | ---------------------------------------------- | ----- |
|
|
@@ -720,6 +1072,14 @@ Remove all listeners for this plugin.
|
|
|
720
1072
|
| **`version`** | <code>string</code> | Emit when a download fail. | 4.0.0 |
|
|
721
1073
|
|
|
722
1074
|
|
|
1075
|
+
#### AppReadyEvent
|
|
1076
|
+
|
|
1077
|
+
| Prop | Type | Description | Since |
|
|
1078
|
+
| ------------ | ------------------------------------------------- | ------------------------------------- | ----- |
|
|
1079
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emitted when the app is ready to use. | 5.2.0 |
|
|
1080
|
+
| **`status`** | <code>string</code> | | |
|
|
1081
|
+
|
|
1082
|
+
|
|
723
1083
|
### Type Aliases
|
|
724
1084
|
|
|
725
1085
|
|
|
@@ -732,46 +1092,6 @@ Remove all listeners for this plugin.
|
|
|
732
1092
|
|
|
733
1093
|
<code>"background" | "kill" | "nativeVersion" | "date"</code>
|
|
734
1094
|
|
|
735
|
-
|
|
736
|
-
#### DownloadChangeListener
|
|
737
|
-
|
|
738
|
-
<code>(state: <a href="#downloadevent">DownloadEvent</a>): void</code>
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
#### NoNeedListener
|
|
742
|
-
|
|
743
|
-
<code>(state: <a href="#noneedevent">noNeedEvent</a>): void</code>
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
#### UpdateAvailabledListener
|
|
747
|
-
|
|
748
|
-
<code>(state: <a href="#updateavailableevent">updateAvailableEvent</a>): void</code>
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
#### DownloadCompleteListener
|
|
752
|
-
|
|
753
|
-
<code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>): void</code>
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
#### MajorAvailableListener
|
|
757
|
-
|
|
758
|
-
<code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>): void</code>
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
#### UpdateFailedListener
|
|
762
|
-
|
|
763
|
-
<code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>): void</code>
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
#### DownloadFailedListener
|
|
767
|
-
|
|
768
|
-
<code>(state: <a href="#downloadfailedevent">DownloadFailedEvent</a>): void</code>
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
#### AppReloadedListener
|
|
772
|
-
|
|
773
|
-
<code>(state: void): void</code>
|
|
774
|
-
|
|
775
1095
|
</docgen-api>
|
|
776
1096
|
|
|
777
1097
|
### Listen to download events
|
|
@@ -794,4 +1114,4 @@ On iOS, Apple don't allow you to show a message when the app is updated, so you
|
|
|
794
1114
|
|
|
795
1115
|
### Contributors
|
|
796
1116
|
|
|
797
|
-
[jamesyoung1337](https://github.com/jamesyoung1337)
|
|
1117
|
+
[jamesyoung1337](https://github.com/jamesyoung1337) Thank you so much for your guidance and support, it was impossible to make this plugin work without you.
|