@capgo/capacitor-updater 3.3.12 → 4.0.0-alpha.11
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/LICENCE +656 -160
- package/README.md +225 -129
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +130 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +36 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +314 -198
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +481 -246
- package/dist/docs.json +607 -114
- package/dist/esm/definitions.d.ts +222 -74
- package/dist/esm/web.d.ts +19 -16
- package/dist/esm/web.js +32 -23
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +32 -23
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +32 -23
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/BundleInfo.swift +94 -0
- package/ios/Plugin/BundleStatus.swift +41 -0
- package/ios/Plugin/CapacitorUpdater.swift +319 -82
- package/ios/Plugin/CapacitorUpdaterPlugin.m +4 -2
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +285 -173
- package/ios/Plugin/ObjectPreferences.swift +41 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# capacitor-updater
|
|
2
2
|
|
|
3
|
-
Update
|
|
3
|
+
Update Ionic Capacitor apps without App/Play Store review (Code-push / hot-code updates).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- use [capgo.app](https://capgo.app) a full featured auto update system
|
|
7
|
-
-
|
|
8
|
-
- use manual methods to zip, upload, download, from
|
|
5
|
+
Usage options:
|
|
6
|
+
- use [capgo.app](https://capgo.app), a full featured auto update system. (5 min Setup, easily manage versions, update, revert, and see detailed stats.)
|
|
7
|
+
- integrate your own API with this plugin's auto update system.
|
|
8
|
+
- use manual methods to zip, upload, download, from application code - you have full control.
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
## Community
|
|
@@ -14,20 +14,20 @@ Join the [discord](https://discord.gg/VnYRvBfgA6) to get help.
|
|
|
14
14
|
## Documentation
|
|
15
15
|
I maintain a more user friendly and complete [documentation](https://github.com/Cap-go/capacitor-updater/wiki) in GitHub wiki.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
npm install @capgo/capacitor-updater
|
|
21
21
|
npx cap sync
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
## Auto
|
|
24
|
+
## Auto-update setup
|
|
25
25
|
|
|
26
26
|
Create account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/app/apikeys)
|
|
27
|
-
-
|
|
28
|
-
- Add app
|
|
29
|
-
- Upload app
|
|
30
|
-
-
|
|
27
|
+
- Download the CLI `npm i -g @capgo/cli`
|
|
28
|
+
- Add app from CLI `capgo add -a API_KEY`
|
|
29
|
+
- Upload app `capgo upload -a API_KEY`
|
|
30
|
+
- Upload app `capgo set -a API_KEY -s public`
|
|
31
31
|
- Edit your `capacitor.config.json` like below, set `autoUpdate` to true.
|
|
32
32
|
```json
|
|
33
33
|
// capacitor.config.json
|
|
@@ -45,92 +45,96 @@ Create account in [capgo.app](https://capgo.app) and get your [API key](https://
|
|
|
45
45
|
```javascript
|
|
46
46
|
import { CapacitorUpdater } from '@capgo/capacitor-updater'
|
|
47
47
|
CapacitorUpdater.notifyAppReady()
|
|
48
|
-
// To let auto update know you app boot well.
|
|
49
48
|
```
|
|
49
|
+
This tells Capacitor Updator that the current update bundle has loaded succesfully. Failing to call this method will cause your application to be rolled back to the previously successful version (or built-in bundle).
|
|
50
50
|
|
|
51
51
|
- Do `npm run build && npx cap copy` to copy the build to capacitor.
|
|
52
52
|
- Run the app and see app auto update after each backgrounding.
|
|
53
|
-
-
|
|
53
|
+
- Failed updates will automatically roll back to the last successful version.
|
|
54
54
|
|
|
55
|
-
See more
|
|
56
|
-
https://github.com/Cap-go/capacitor-updater/wiki) documentation.
|
|
55
|
+
See more details in the [Auto update](https://github.com/Cap-go/capacitor-updater/wiki) documentation.
|
|
57
56
|
|
|
58
57
|
|
|
59
58
|
## Manual setup
|
|
60
59
|
|
|
61
|
-
Download
|
|
62
|
-
install it when user background the app.
|
|
63
|
-
|
|
64
|
-
In your main code :
|
|
60
|
+
Download update distribution zipfiles from a custom url. Manually control the entire update process.
|
|
65
61
|
|
|
62
|
+
- Add to your main code
|
|
66
63
|
```javascript
|
|
67
64
|
import { CapacitorUpdater } from '@capgo/capacitor-updater'
|
|
65
|
+
CapacitorUpdater.notifyAppReady()
|
|
66
|
+
```
|
|
67
|
+
This informs Capacitor Updator that the current update bundle has loaded succesfully. Failing to call this method will cause your application to be rolled back to the previously successful version (or built-in bundle).
|
|
68
|
+
- Add this to your application.
|
|
69
|
+
```javascript
|
|
70
|
+
const version = await CapacitorUpdater.download({
|
|
71
|
+
url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
|
|
72
|
+
})
|
|
73
|
+
await CapacitorUpdater.set(version); // sets the new version, and reloads the app
|
|
74
|
+
```
|
|
75
|
+
- Failed updates will automatically roll back to the last successful version.
|
|
76
|
+
- Example: Using App-state to control updates, with SplashScreen:
|
|
77
|
+
You might also consider performing auto-update when application state changes, and using the Splash Screen to improve user experience.
|
|
78
|
+
```javascript
|
|
79
|
+
import { CapacitorUpdater, VersionInfo } from '@capgo/capacitor-updater'
|
|
68
80
|
import { SplashScreen } from '@capacitor/splash-screen'
|
|
69
81
|
import { App } from '@capacitor/app'
|
|
70
82
|
|
|
71
|
-
let version
|
|
72
|
-
App.addListener('appStateChange', async(state) => {
|
|
83
|
+
let version: VersionInfo;
|
|
84
|
+
App.addListener('appStateChange', async (state) => {
|
|
73
85
|
if (state.isActive) {
|
|
74
|
-
//
|
|
86
|
+
// Ensure download occurs while the app is active, or download may fail
|
|
75
87
|
version = await CapacitorUpdater.download({
|
|
76
|
-
|
|
88
|
+
url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
|
|
77
89
|
})
|
|
78
90
|
}
|
|
79
|
-
|
|
80
|
-
|
|
91
|
+
|
|
92
|
+
if (!state.isActive && version) {
|
|
93
|
+
// Activate the update when the application is sent to background
|
|
81
94
|
SplashScreen.show()
|
|
82
95
|
try {
|
|
83
|
-
await CapacitorUpdater.set(version)
|
|
96
|
+
await CapacitorUpdater.set(version);
|
|
97
|
+
// At this point, the new version should be active, and will need to hide the splash screen
|
|
84
98
|
} catch () {
|
|
85
|
-
SplashScreen.hide() //
|
|
99
|
+
SplashScreen.hide() // Hide the splash screen again if something went wrong
|
|
86
100
|
}
|
|
87
101
|
}
|
|
88
102
|
})
|
|
89
103
|
|
|
90
|
-
// or do it when click on button
|
|
91
|
-
const updateNow = async () => {
|
|
92
|
-
const version = await CapacitorUpdater.download({
|
|
93
|
-
url: 'https://github.com/Cap-go/demo-app/releases/download/0.0.4/dist.zip',
|
|
94
|
-
})
|
|
95
|
-
// show the splashscreen to let the update happen
|
|
96
|
-
SplashScreen.show()
|
|
97
|
-
await CapacitorUpdater.set(version)
|
|
98
|
-
SplashScreen.hide() // in case the set fail, otherwise the new app will have to hide it
|
|
99
|
-
}
|
|
100
104
|
```
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
If you need more secure way to update your app, you can use Auto update system.
|
|
105
|
-
|
|
106
|
-
You can list the version and manage it with the command below.
|
|
106
|
+
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.
|
|
107
107
|
|
|
108
|
-
### Packaging `dist.zip`
|
|
108
|
+
### Packaging `dist.zip` update bundles
|
|
109
109
|
|
|
110
|
-
Whatever you choose to name the file you download from your release/update server URL
|
|
110
|
+
Capacitor Updator 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:
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
- 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.
|
|
113
|
+
- Do not password encrypt the bundle zip file, or it will fail to unpack.
|
|
114
|
+
- Make sure the bundle does not contain any extra hidden files or folders, or it may fail to unpack.
|
|
113
115
|
|
|
114
116
|
## API
|
|
115
117
|
|
|
116
118
|
<docgen-index>
|
|
117
119
|
|
|
120
|
+
* [`notifyAppReady()`](#notifyappready)
|
|
118
121
|
* [`download(...)`](#download)
|
|
122
|
+
* [`next(...)`](#next)
|
|
119
123
|
* [`set(...)`](#set)
|
|
120
|
-
* [`getId()`](#getid)
|
|
121
|
-
* [`getPluginVersion()`](#getpluginversion)
|
|
122
124
|
* [`delete(...)`](#delete)
|
|
123
125
|
* [`list()`](#list)
|
|
124
126
|
* [`reset(...)`](#reset)
|
|
125
127
|
* [`current()`](#current)
|
|
126
128
|
* [`reload()`](#reload)
|
|
127
|
-
* [`
|
|
128
|
-
* [`
|
|
129
|
-
* [`delayUpdate()`](#delayupdate)
|
|
130
|
-
* [`cancelDelay()`](#canceldelay)
|
|
129
|
+
* [`setDelay(...)`](#setdelay)
|
|
130
|
+
* [`getLatest(...)`](#getlatest)
|
|
131
131
|
* [`addListener('download', ...)`](#addlistenerdownload)
|
|
132
|
+
* [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete)
|
|
132
133
|
* [`addListener('majorAvailable', ...)`](#addlistenermajoravailable)
|
|
133
|
-
* [`addListener('
|
|
134
|
+
* [`addListener('updateFailed', ...)`](#addlistenerupdatefailed)
|
|
135
|
+
* [`getId()`](#getid)
|
|
136
|
+
* [`getPluginVersion()`](#getpluginversion)
|
|
137
|
+
* [`isAutoUpdateEnabled()`](#isautoupdateenabled)
|
|
134
138
|
* [`addListener(string, ...)`](#addlistenerstring)
|
|
135
139
|
* [`removeAllListeners()`](#removealllisteners)
|
|
136
140
|
* [Interfaces](#interfaces)
|
|
@@ -141,60 +145,64 @@ Do not password encrypt this file, or it will fail to unpack.
|
|
|
141
145
|
<docgen-api>
|
|
142
146
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
143
147
|
|
|
144
|
-
###
|
|
148
|
+
### notifyAppReady()
|
|
145
149
|
|
|
146
150
|
```typescript
|
|
147
|
-
|
|
151
|
+
notifyAppReady() => Promise<BundleInfo>
|
|
148
152
|
```
|
|
149
153
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
| Param | Type |
|
|
153
|
-
| ------------- | ----------------------------- |
|
|
154
|
-
| **`options`** | <code>{ url: string; }</code> |
|
|
154
|
+
Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
|
|
155
155
|
|
|
156
|
-
**Returns:** <code>Promise<
|
|
156
|
+
**Returns:** <code>Promise<<a href="#bundleinfo">BundleInfo</a>></code>
|
|
157
157
|
|
|
158
158
|
--------------------
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
###
|
|
161
|
+
### download(...)
|
|
162
162
|
|
|
163
163
|
```typescript
|
|
164
|
-
|
|
164
|
+
download(options: { url: string; version?: string; }) => Promise<BundleInfo>
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
Download a new version from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
|
|
168
|
+
|
|
169
|
+
| Param | Type |
|
|
170
|
+
| ------------- | ----------------------------------------------- |
|
|
171
|
+
| **`options`** | <code>{ url: string; version?: string; }</code> |
|
|
168
172
|
|
|
169
|
-
|
|
170
|
-
| ------------- | ------------------------------------------------------- |
|
|
171
|
-
| **`options`** | <code>{ version: string; versionName?: string; }</code> |
|
|
173
|
+
**Returns:** <code>Promise<<a href="#bundleinfo">BundleInfo</a>></code>
|
|
172
174
|
|
|
173
175
|
--------------------
|
|
174
176
|
|
|
175
177
|
|
|
176
|
-
###
|
|
178
|
+
### next(...)
|
|
177
179
|
|
|
178
180
|
```typescript
|
|
179
|
-
|
|
181
|
+
next(options: { id: string; }) => Promise<BundleInfo>
|
|
180
182
|
```
|
|
181
183
|
|
|
182
|
-
|
|
184
|
+
Set the next bundle to be used when the app is reloaded.
|
|
183
185
|
|
|
184
|
-
|
|
186
|
+
| Param | Type |
|
|
187
|
+
| ------------- | ---------------------------- |
|
|
188
|
+
| **`options`** | <code>{ id: string; }</code> |
|
|
189
|
+
|
|
190
|
+
**Returns:** <code>Promise<<a href="#bundleinfo">BundleInfo</a>></code>
|
|
185
191
|
|
|
186
192
|
--------------------
|
|
187
193
|
|
|
188
194
|
|
|
189
|
-
###
|
|
195
|
+
### set(...)
|
|
190
196
|
|
|
191
197
|
```typescript
|
|
192
|
-
|
|
198
|
+
set(options: { id: string; }) => Promise<void>
|
|
193
199
|
```
|
|
194
200
|
|
|
195
|
-
|
|
201
|
+
Set the current bundle and immediately reloads the app.
|
|
196
202
|
|
|
197
|
-
|
|
203
|
+
| Param | Type |
|
|
204
|
+
| ------------- | ---------------------------- |
|
|
205
|
+
| **`options`** | <code>{ id: string; }</code> |
|
|
198
206
|
|
|
199
207
|
--------------------
|
|
200
208
|
|
|
@@ -202,14 +210,14 @@ Get plugin version used in native code
|
|
|
202
210
|
### delete(...)
|
|
203
211
|
|
|
204
212
|
```typescript
|
|
205
|
-
delete(options: {
|
|
213
|
+
delete(options: { id: string; }) => Promise<void>
|
|
206
214
|
```
|
|
207
215
|
|
|
208
|
-
Delete
|
|
216
|
+
Delete bundle in storage
|
|
209
217
|
|
|
210
|
-
| Param | Type
|
|
211
|
-
| ------------- |
|
|
212
|
-
| **`options`** | <code>{
|
|
218
|
+
| Param | Type |
|
|
219
|
+
| ------------- | ---------------------------- |
|
|
220
|
+
| **`options`** | <code>{ id: string; }</code> |
|
|
213
221
|
|
|
214
222
|
--------------------
|
|
215
223
|
|
|
@@ -217,12 +225,12 @@ Delete version in storage
|
|
|
217
225
|
### list()
|
|
218
226
|
|
|
219
227
|
```typescript
|
|
220
|
-
list() => Promise<{
|
|
228
|
+
list() => Promise<{ bundles: BundleInfo[]; }>
|
|
221
229
|
```
|
|
222
230
|
|
|
223
231
|
Get all available versions
|
|
224
232
|
|
|
225
|
-
**Returns:** <code>Promise<{
|
|
233
|
+
**Returns:** <code>Promise<{ bundles: BundleInfo[]; }></code>
|
|
226
234
|
|
|
227
235
|
--------------------
|
|
228
236
|
|
|
@@ -230,14 +238,14 @@ Get all available versions
|
|
|
230
238
|
### reset(...)
|
|
231
239
|
|
|
232
240
|
```typescript
|
|
233
|
-
reset(options?: {
|
|
241
|
+
reset(options?: { toLastSuccessful?: boolean | undefined; } | undefined) => Promise<void>
|
|
234
242
|
```
|
|
235
243
|
|
|
236
244
|
Set the `builtin` version (the one sent to Apple store / Google play store ) as current version
|
|
237
245
|
|
|
238
|
-
| Param | Type
|
|
239
|
-
| ------------- |
|
|
240
|
-
| **`options`** | <code>{
|
|
246
|
+
| Param | Type |
|
|
247
|
+
| ------------- | -------------------------------------------- |
|
|
248
|
+
| **`options`** | <code>{ toLastSuccessful?: boolean; }</code> |
|
|
241
249
|
|
|
242
250
|
--------------------
|
|
243
251
|
|
|
@@ -245,12 +253,12 @@ Set the `builtin` version (the one sent to Apple store / Google play store ) as
|
|
|
245
253
|
### current()
|
|
246
254
|
|
|
247
255
|
```typescript
|
|
248
|
-
current() => Promise<{
|
|
256
|
+
current() => Promise<{ bundle: BundleInfo; native: string; }>
|
|
249
257
|
```
|
|
250
258
|
|
|
251
|
-
Get the current
|
|
259
|
+
Get the current bundle, if none are set it returns `builtin`, currentNative is the original bundle installed on the device
|
|
252
260
|
|
|
253
|
-
**Returns:** <code>Promise<{
|
|
261
|
+
**Returns:** <code>Promise<{ bundle: <a href="#bundleinfo">BundleInfo</a>; native: string; }></code>
|
|
254
262
|
|
|
255
263
|
--------------------
|
|
256
264
|
|
|
@@ -266,48 +274,38 @@ Reload the view
|
|
|
266
274
|
--------------------
|
|
267
275
|
|
|
268
276
|
|
|
269
|
-
###
|
|
277
|
+
### setDelay(...)
|
|
270
278
|
|
|
271
279
|
```typescript
|
|
272
|
-
|
|
280
|
+
setDelay(options: { delay: boolean; }) => Promise<void>
|
|
273
281
|
```
|
|
274
282
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
**Returns:** <code>Promise<{ versionName: string; }></code>
|
|
283
|
+
Set delay to skip updates in the next time the app goes into the background
|
|
278
284
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
### notifyAppReady()
|
|
283
|
-
|
|
284
|
-
```typescript
|
|
285
|
-
notifyAppReady() => Promise<void>
|
|
286
|
-
```
|
|
285
|
+
| Param | Type |
|
|
286
|
+
| ------------- | -------------------------------- |
|
|
287
|
+
| **`options`** | <code>{ delay: boolean; }</code> |
|
|
287
288
|
|
|
288
|
-
|
|
289
|
+
**Since:** 4.0.0
|
|
289
290
|
|
|
290
291
|
--------------------
|
|
291
292
|
|
|
292
293
|
|
|
293
|
-
###
|
|
294
|
+
### getLatest(...)
|
|
294
295
|
|
|
295
296
|
```typescript
|
|
296
|
-
|
|
297
|
+
getLatest(options: { delay: boolean; }) => Promise<latestVersion>
|
|
297
298
|
```
|
|
298
299
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
--------------------
|
|
300
|
+
Get Latest version available from update Url
|
|
302
301
|
|
|
302
|
+
| Param | Type |
|
|
303
|
+
| ------------- | -------------------------------- |
|
|
304
|
+
| **`options`** | <code>{ delay: boolean; }</code> |
|
|
303
305
|
|
|
304
|
-
|
|
306
|
+
**Returns:** <code>Promise<<a href="#latestversion">latestVersion</a>></code>
|
|
305
307
|
|
|
306
|
-
|
|
307
|
-
cancelDelay() => Promise<void>
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
allow update in the next time the app goes into the background, only in auto-update
|
|
308
|
+
**Since:** 4.0.0
|
|
311
309
|
|
|
312
310
|
--------------------
|
|
313
311
|
|
|
@@ -332,6 +330,26 @@ Listen for download event in the App, let you know when the download is started,
|
|
|
332
330
|
--------------------
|
|
333
331
|
|
|
334
332
|
|
|
333
|
+
### addListener('downloadComplete', ...)
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
addListener(eventName: 'downloadComplete', listenerFunc: DownloadCompleteListener) => Promise<PluginListenerHandle> & PluginListenerHandle
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Listen for download event in the App, let you know when the download is started, loading and finished
|
|
340
|
+
|
|
341
|
+
| Param | Type |
|
|
342
|
+
| ------------------ | ----------------------------------------------------------------------------- |
|
|
343
|
+
| **`eventName`** | <code>'downloadComplete'</code> |
|
|
344
|
+
| **`listenerFunc`** | <code><a href="#downloadcompletelistener">DownloadCompleteListener</a></code> |
|
|
345
|
+
|
|
346
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
|
|
347
|
+
|
|
348
|
+
**Since:** 4.0.0
|
|
349
|
+
|
|
350
|
+
--------------------
|
|
351
|
+
|
|
352
|
+
|
|
335
353
|
### addListener('majorAvailable', ...)
|
|
336
354
|
|
|
337
355
|
```typescript
|
|
@@ -352,18 +370,18 @@ Listen for Major update event in the App, let you know when major update is bloc
|
|
|
352
370
|
--------------------
|
|
353
371
|
|
|
354
372
|
|
|
355
|
-
### addListener('
|
|
373
|
+
### addListener('updateFailed', ...)
|
|
356
374
|
|
|
357
375
|
```typescript
|
|
358
|
-
addListener(eventName: '
|
|
376
|
+
addListener(eventName: 'updateFailed', listenerFunc: UpdateFailedListener) => Promise<PluginListenerHandle> & PluginListenerHandle
|
|
359
377
|
```
|
|
360
378
|
|
|
361
379
|
Listen for update event in the App, let you know when update is ready to install at next app start
|
|
362
380
|
|
|
363
|
-
| Param | Type
|
|
364
|
-
| ------------------ |
|
|
365
|
-
| **`eventName`** | <code>'
|
|
366
|
-
| **`listenerFunc`** | <code><a href="#
|
|
381
|
+
| Param | Type |
|
|
382
|
+
| ------------------ | --------------------------------------------------------------------- |
|
|
383
|
+
| **`eventName`** | <code>'updateFailed'</code> |
|
|
384
|
+
| **`listenerFunc`** | <code><a href="#updatefailedlistener">UpdateFailedListener</a></code> |
|
|
367
385
|
|
|
368
386
|
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
|
|
369
387
|
|
|
@@ -372,6 +390,45 @@ Listen for update event in the App, let you know when update is ready to install
|
|
|
372
390
|
--------------------
|
|
373
391
|
|
|
374
392
|
|
|
393
|
+
### getId()
|
|
394
|
+
|
|
395
|
+
```typescript
|
|
396
|
+
getId() => Promise<{ id: string; }>
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Get unique ID used to identify device (sent to auto update server)
|
|
400
|
+
|
|
401
|
+
**Returns:** <code>Promise<{ id: string; }></code>
|
|
402
|
+
|
|
403
|
+
--------------------
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
### getPluginVersion()
|
|
407
|
+
|
|
408
|
+
```typescript
|
|
409
|
+
getPluginVersion() => Promise<{ version: string; }>
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Get the native Capacitor Updater plugin version (sent to auto update server)
|
|
413
|
+
|
|
414
|
+
**Returns:** <code>Promise<{ version: string; }></code>
|
|
415
|
+
|
|
416
|
+
--------------------
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
### isAutoUpdateEnabled()
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
isAutoUpdateEnabled() => Promise<{ enabled: boolean; }>
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
Get the state of auto update config. This will return `false` in manual mode.
|
|
426
|
+
|
|
427
|
+
**Returns:** <code>Promise<{ enabled: boolean; }></code>
|
|
428
|
+
|
|
429
|
+
--------------------
|
|
430
|
+
|
|
431
|
+
|
|
375
432
|
### addListener(string, ...)
|
|
376
433
|
|
|
377
434
|
```typescript
|
|
@@ -400,6 +457,27 @@ removeAllListeners() => Promise<void>
|
|
|
400
457
|
### Interfaces
|
|
401
458
|
|
|
402
459
|
|
|
460
|
+
#### BundleInfo
|
|
461
|
+
|
|
462
|
+
| Prop | Type |
|
|
463
|
+
| ---------------- | ----------------------------------------------------- |
|
|
464
|
+
| **`id`** | <code>string</code> |
|
|
465
|
+
| **`version`** | <code>string</code> |
|
|
466
|
+
| **`downloaded`** | <code>string</code> |
|
|
467
|
+
| **`status`** | <code><a href="#bundlestatus">BundleStatus</a></code> |
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
#### latestVersion
|
|
471
|
+
|
|
472
|
+
| Prop | Type | Description | Since |
|
|
473
|
+
| ------------- | -------------------- | ----------------------- | ----- |
|
|
474
|
+
| **`version`** | <code>string</code> | Res of getLatest method | 4.0.0 |
|
|
475
|
+
| **`major`** | <code>boolean</code> | | |
|
|
476
|
+
| **`message`** | <code>string</code> | | |
|
|
477
|
+
| **`old`** | <code>string</code> | | |
|
|
478
|
+
| **`url`** | <code>string</code> | | |
|
|
479
|
+
|
|
480
|
+
|
|
403
481
|
#### PluginListenerHandle
|
|
404
482
|
|
|
405
483
|
| Prop | Type |
|
|
@@ -409,41 +487,59 @@ removeAllListeners() => Promise<void>
|
|
|
409
487
|
|
|
410
488
|
#### DownloadEvent
|
|
411
489
|
|
|
412
|
-
| Prop | Type
|
|
413
|
-
| ------------- |
|
|
414
|
-
| **`percent`** | <code>number</code>
|
|
490
|
+
| Prop | Type | Description | Since |
|
|
491
|
+
| ------------- | ------------------------------------------------- | ---------------------------------------------- | ----- |
|
|
492
|
+
| **`percent`** | <code>number</code> | Current status of download, between 0 and 100. | 4.0.0 |
|
|
493
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | | |
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
#### DownloadCompleteEvent
|
|
497
|
+
|
|
498
|
+
| Prop | Type | Description | Since |
|
|
499
|
+
| ------------ | ------------------------------------------------- | ------------------------------------ | ----- |
|
|
500
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a new update is available. | 4.0.0 |
|
|
415
501
|
|
|
416
502
|
|
|
417
503
|
#### MajorAvailableEvent
|
|
418
504
|
|
|
419
505
|
| Prop | Type | Description | Since |
|
|
420
506
|
| ------------- | ------------------- | ------------------------------------------- | ----- |
|
|
421
|
-
| **`version`** | <code>string</code> | Emit when a new major version is available. |
|
|
507
|
+
| **`version`** | <code>string</code> | Emit when a new major version is available. | 4.0.0 |
|
|
422
508
|
|
|
423
509
|
|
|
424
|
-
####
|
|
510
|
+
#### UpdateFailedEvent
|
|
425
511
|
|
|
426
|
-
| Prop
|
|
427
|
-
|
|
|
428
|
-
| **`
|
|
512
|
+
| Prop | Type | Description | Since |
|
|
513
|
+
| ------------ | ------------------------------------------------- | ------------------------------------- | ----- |
|
|
514
|
+
| **`bundle`** | <code><a href="#bundleinfo">BundleInfo</a></code> | Emit when a update failed to install. | 4.0.0 |
|
|
429
515
|
|
|
430
516
|
|
|
431
517
|
### Type Aliases
|
|
432
518
|
|
|
433
519
|
|
|
520
|
+
#### BundleStatus
|
|
521
|
+
|
|
522
|
+
<code>'success' | 'error' | 'pending' | 'downloading'</code>
|
|
523
|
+
|
|
524
|
+
|
|
434
525
|
#### DownloadChangeListener
|
|
435
526
|
|
|
436
527
|
<code>(state: <a href="#downloadevent">DownloadEvent</a>): void</code>
|
|
437
528
|
|
|
438
529
|
|
|
530
|
+
#### DownloadCompleteListener
|
|
531
|
+
|
|
532
|
+
<code>(state: <a href="#downloadcompleteevent">DownloadCompleteEvent</a>): void</code>
|
|
533
|
+
|
|
534
|
+
|
|
439
535
|
#### MajorAvailableListener
|
|
440
536
|
|
|
441
537
|
<code>(state: <a href="#majoravailableevent">MajorAvailableEvent</a>): void</code>
|
|
442
538
|
|
|
443
539
|
|
|
444
|
-
####
|
|
540
|
+
#### UpdateFailedListener
|
|
445
541
|
|
|
446
|
-
<code>(state: <a href="#
|
|
542
|
+
<code>(state: <a href="#updatefailedevent">UpdateFailedEvent</a>): void</code>
|
|
447
543
|
|
|
448
544
|
</docgen-api>
|
|
449
545
|
|