@capgo/capacitor-updater 5.9.5 → 5.30.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/CapgoCapacitorUpdater.podspec +7 -5
- package/Package.swift +37 -0
- package/README.md +1030 -212
- package/android/build.gradle +28 -11
- package/android/proguard-rules.pro +22 -5
- package/android/src/main/AndroidManifest.xml +0 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +171 -195
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +23 -23
- package/android/src/main/java/ee/forgr/capacitor_updater/Callback.java +2 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +2111 -1538
- package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +1551 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +253 -111
- package/android/src/main/java/ee/forgr/capacitor_updater/DataManager.java +28 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +42 -49
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +4 -4
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayUpdateUtils.java +260 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DeviceIdHelper.java +221 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +795 -124
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +156 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +19 -28
- package/android/src/main/java/ee/forgr/capacitor_updater/Logger.java +338 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/ShakeDetector.java +72 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +169 -0
- package/dist/docs.json +1072 -162
- package/dist/esm/definitions.d.ts +899 -118
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/history.d.ts +1 -0
- package/dist/esm/history.js +283 -0
- package/dist/esm/history.js.map +1 -0
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.js +5 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +16 -2
- package/dist/esm/web.js +79 -40
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +361 -40
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +361 -40
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/AES.swift +69 -0
- package/ios/Sources/CapacitorUpdaterPlugin/BigInt.swift +55 -0
- package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/BundleStatus.swift +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +1582 -0
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +1513 -0
- package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +220 -0
- package/ios/Sources/CapacitorUpdaterPlugin/DelayUpdateUtils.swift +220 -0
- package/ios/Sources/CapacitorUpdaterPlugin/DeviceIdHelper.swift +120 -0
- package/ios/Sources/CapacitorUpdaterPlugin/InternalUtils.swift +307 -0
- package/ios/Sources/CapacitorUpdaterPlugin/Logger.swift +310 -0
- package/ios/Sources/CapacitorUpdaterPlugin/RSA.swift +274 -0
- package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +112 -0
- package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/UserDefaultsExtension.swift +0 -2
- package/package.json +33 -28
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +0 -1187
- package/ios/Plugin/CapacitorUpdater.swift +0 -1032
- package/ios/Plugin/CapacitorUpdaterPlugin.h +0 -10
- package/ios/Plugin/CapacitorUpdaterPlugin.m +0 -31
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +0 -843
- package/ios/Plugin/CryptoCipher.swift +0 -246
- /package/{LICENCE → LICENSE} +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/BundleInfo.swift +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/DelayCondition.swift +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/DelayUntilNext.swift +0 -0
- /package/ios/{Plugin → Sources/CapacitorUpdaterPlugin}/Info.plist +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PluginListenerHandle } from
|
|
2
|
-
declare module
|
|
1
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
|
+
declare module '@capacitor/cli' {
|
|
3
3
|
interface PluginsConfig {
|
|
4
4
|
/**
|
|
5
5
|
* CapacitorUpdater can be configured with these options:
|
|
@@ -15,7 +15,7 @@ declare module "@capacitor/cli" {
|
|
|
15
15
|
*/
|
|
16
16
|
appReadyTimeout?: number;
|
|
17
17
|
/**
|
|
18
|
-
* Configure the number of
|
|
18
|
+
* Configure the number of seconds the native plugin should wait before considering API timeout.
|
|
19
19
|
*
|
|
20
20
|
* Only available for Android and iOS.
|
|
21
21
|
*
|
|
@@ -64,27 +64,37 @@ declare module "@capacitor/cli" {
|
|
|
64
64
|
*
|
|
65
65
|
* Only available for Android and iOS.
|
|
66
66
|
*
|
|
67
|
-
* @default https://
|
|
67
|
+
* @default https://plugin.capgo.app/updates
|
|
68
68
|
* @example https://example.com/api/auto_update
|
|
69
69
|
*/
|
|
70
70
|
updateUrl?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Configure the URL / endpoint for channel operations.
|
|
73
|
+
*
|
|
74
|
+
* Only available for Android and iOS.
|
|
75
|
+
*
|
|
76
|
+
* @default https://plugin.capgo.app/channel_self
|
|
77
|
+
* @example https://example.com/api/channel
|
|
78
|
+
*/
|
|
79
|
+
channelUrl?: string;
|
|
71
80
|
/**
|
|
72
81
|
* Configure the URL / endpoint to which update statistics are sent.
|
|
73
82
|
*
|
|
74
83
|
* Only available for Android and iOS. Set to "" to disable stats reporting.
|
|
75
84
|
*
|
|
76
|
-
* @default https://
|
|
85
|
+
* @default https://plugin.capgo.app/stats
|
|
77
86
|
* @example https://example.com/api/stats
|
|
78
87
|
*/
|
|
79
88
|
statsUrl?: string;
|
|
80
89
|
/**
|
|
81
|
-
* Configure the
|
|
90
|
+
* Configure the public key for end to end live update encryption Version 2
|
|
82
91
|
*
|
|
83
92
|
* Only available for Android and iOS.
|
|
84
93
|
*
|
|
85
94
|
* @default undefined
|
|
95
|
+
* @since 6.2.0
|
|
86
96
|
*/
|
|
87
|
-
|
|
97
|
+
publicKey?: string;
|
|
88
98
|
/**
|
|
89
99
|
* Configure the current version of the app. This will be used for the first update request.
|
|
90
100
|
* If not set, the plugin will get the version from the native code.
|
|
@@ -96,21 +106,67 @@ declare module "@capacitor/cli" {
|
|
|
96
106
|
*/
|
|
97
107
|
version?: string;
|
|
98
108
|
/**
|
|
99
|
-
*
|
|
109
|
+
* Configure when the plugin should direct install updates. Only for autoUpdate mode.
|
|
110
|
+
* Works well for apps less than 10MB and with uploads done using --partial flag.
|
|
111
|
+
* Zip or apps more than 10MB will be relatively slow for users to update.
|
|
112
|
+
* - false: Never do direct updates (use default behavior: download at start, set when backgrounded)
|
|
113
|
+
* - atInstall: Direct update only when app is installed, updated from store, otherwise act as directUpdate = false
|
|
114
|
+
* - onLaunch: Direct update only on app installed, updated from store or after app kill, otherwise act as directUpdate = false
|
|
115
|
+
* - always: Direct update in all previous cases (app installed, updated from store, after app kill or app resume), never act as directUpdate = false
|
|
116
|
+
* - true: (deprecated) Same as "always" for backward compatibility
|
|
100
117
|
*
|
|
101
118
|
* Only available for Android and iOS.
|
|
102
119
|
*
|
|
103
|
-
* @default
|
|
120
|
+
* @default false
|
|
104
121
|
* @since 5.1.0
|
|
105
122
|
*/
|
|
106
|
-
directUpdate?: boolean;
|
|
123
|
+
directUpdate?: boolean | 'atInstall' | 'always' | 'onLaunch';
|
|
124
|
+
/**
|
|
125
|
+
* Automatically handle splashscreen hiding when using directUpdate. When enabled, the plugin will automatically hide the splashscreen after updates are applied or when no update is needed.
|
|
126
|
+
* This removes the need to manually listen for appReady events and call SplashScreen.hide().
|
|
127
|
+
* Only works when directUpdate is set to "atInstall", "always", "onLaunch", or true.
|
|
128
|
+
* Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.
|
|
129
|
+
* Requires autoUpdate and directUpdate to be enabled.
|
|
130
|
+
*
|
|
131
|
+
* Only available for Android and iOS.
|
|
132
|
+
*
|
|
133
|
+
* @default false
|
|
134
|
+
* @since 7.6.0
|
|
135
|
+
*/
|
|
136
|
+
autoSplashscreen?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Display a native loading indicator on top of the splashscreen while automatic direct updates are running.
|
|
139
|
+
* Only takes effect when {@link autoSplashscreen} is enabled.
|
|
140
|
+
* Requires the @capacitor/splash-screen plugin to be installed and configured with launchAutoHide: false.
|
|
141
|
+
*
|
|
142
|
+
* Only available for Android and iOS.
|
|
143
|
+
*
|
|
144
|
+
* @default false
|
|
145
|
+
* @since 7.19.0
|
|
146
|
+
*/
|
|
147
|
+
autoSplashscreenLoader?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Automatically hide the splashscreen after the specified number of milliseconds when using automatic direct updates.
|
|
150
|
+
* If the timeout elapses, the update continues to download in the background while the splashscreen is dismissed.
|
|
151
|
+
* Set to `0` (zero) to disable the timeout.
|
|
152
|
+
* When the timeout fires, the direct update flow is skipped and the downloaded bundle is installed on the next background/launch.
|
|
153
|
+
* Requires {@link autoSplashscreen} to be enabled.
|
|
154
|
+
*
|
|
155
|
+
* Only available for Android and iOS.
|
|
156
|
+
*
|
|
157
|
+
* @default 10000 // (10 seconds)
|
|
158
|
+
* @since 7.19.0
|
|
159
|
+
*/
|
|
160
|
+
autoSplashscreenTimeout?: number;
|
|
107
161
|
/**
|
|
108
162
|
* Configure the delay period for period update check. the unit is in seconds.
|
|
109
163
|
*
|
|
110
164
|
* Only available for Android and iOS.
|
|
111
165
|
* Cannot be less than 600 seconds (10 minutes).
|
|
112
166
|
*
|
|
113
|
-
* @default
|
|
167
|
+
* @default 0 (disabled)
|
|
168
|
+
* @example 3600 (1 hour)
|
|
169
|
+
* @example 86400 (24 hours)
|
|
114
170
|
*/
|
|
115
171
|
periodCheckDelay?: number;
|
|
116
172
|
/**
|
|
@@ -153,6 +209,22 @@ declare module "@capacitor/cli" {
|
|
|
153
209
|
* @since 4.17.48
|
|
154
210
|
*/
|
|
155
211
|
localSupaAnon?: string;
|
|
212
|
+
/**
|
|
213
|
+
* Configure the CLI to use a local api for testing.
|
|
214
|
+
*
|
|
215
|
+
*
|
|
216
|
+
* @default undefined
|
|
217
|
+
* @since 6.3.3
|
|
218
|
+
*/
|
|
219
|
+
localApi?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Configure the CLI to use a local file api for testing.
|
|
222
|
+
*
|
|
223
|
+
*
|
|
224
|
+
* @default undefined
|
|
225
|
+
* @since 6.3.3
|
|
226
|
+
*/
|
|
227
|
+
localApiFiles?: string;
|
|
156
228
|
/**
|
|
157
229
|
* Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side.
|
|
158
230
|
*
|
|
@@ -162,276 +234,867 @@ declare module "@capacitor/cli" {
|
|
|
162
234
|
*/
|
|
163
235
|
allowModifyUrl?: boolean;
|
|
164
236
|
/**
|
|
165
|
-
*
|
|
237
|
+
* Allow the plugin to modify the appId dynamically from the JavaScript side.
|
|
166
238
|
*
|
|
167
239
|
*
|
|
240
|
+
* @default false
|
|
241
|
+
* @since 7.14.0
|
|
242
|
+
*/
|
|
243
|
+
allowModifyAppId?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Allow marking bundles as errored from JavaScript while using manual update flows.
|
|
246
|
+
* When enabled, {@link CapacitorUpdaterPlugin.setBundleError} can change a bundle status to `error`.
|
|
247
|
+
*
|
|
248
|
+
* @default false
|
|
249
|
+
* @since 7.20.0
|
|
250
|
+
*/
|
|
251
|
+
allowManualBundleError?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Persist the customId set through {@link CapacitorUpdaterPlugin.setCustomId} across app restarts.
|
|
254
|
+
*
|
|
255
|
+
* Only available for Android and iOS.
|
|
256
|
+
*
|
|
257
|
+
* @default false (will be true by default in a future major release v8.x.x)
|
|
258
|
+
* @since 7.17.3
|
|
259
|
+
*/
|
|
260
|
+
persistCustomId?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Persist the updateUrl, statsUrl and channelUrl set through {@link CapacitorUpdaterPlugin.setUpdateUrl},
|
|
263
|
+
* {@link CapacitorUpdaterPlugin.setStatsUrl} and {@link CapacitorUpdaterPlugin.setChannelUrl} across app restarts.
|
|
264
|
+
*
|
|
265
|
+
* Only available for Android and iOS.
|
|
266
|
+
*
|
|
267
|
+
* @default false
|
|
268
|
+
* @since 7.20.0
|
|
269
|
+
*/
|
|
270
|
+
persistModifyUrl?: boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Set the default channel for the app in the config. Case sensitive.
|
|
273
|
+
* This will setting will override the default channel set in the cloud, but will still respect overrides made in the cloud.
|
|
274
|
+
* This requires the channel to allow devices to self dissociate/associate in the channel settings. https://capgo.app/docs/public-api/channels/#channel-configuration-options
|
|
275
|
+
*
|
|
168
276
|
*
|
|
169
277
|
* @default undefined
|
|
170
278
|
* @since 5.5.0
|
|
171
279
|
*/
|
|
172
280
|
defaultChannel?: string;
|
|
281
|
+
/**
|
|
282
|
+
* Configure the app id for the app in the config.
|
|
283
|
+
*
|
|
284
|
+
* @default undefined
|
|
285
|
+
* @since 6.0.0
|
|
286
|
+
*/
|
|
287
|
+
appId?: string;
|
|
288
|
+
/**
|
|
289
|
+
* Configure the plugin to keep the URL path after a reload.
|
|
290
|
+
* WARNING: When a reload is triggered, 'window.history' will be cleared.
|
|
291
|
+
*
|
|
292
|
+
* @default false
|
|
293
|
+
* @since 6.8.0
|
|
294
|
+
*/
|
|
295
|
+
keepUrlPathAfterReload?: boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Disable the JavaScript logging of the plugin. if true, the plugin will not log to the JavaScript console. only the native log will be done
|
|
298
|
+
*
|
|
299
|
+
* @default false
|
|
300
|
+
* @since 7.3.0
|
|
301
|
+
*/
|
|
302
|
+
disableJSLogging?: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Enable shake gesture to show update menu for debugging/testing purposes
|
|
305
|
+
*
|
|
306
|
+
* @default false
|
|
307
|
+
* @since 7.5.0
|
|
308
|
+
*/
|
|
309
|
+
shakeMenu?: boolean;
|
|
173
310
|
};
|
|
174
311
|
}
|
|
175
312
|
}
|
|
176
313
|
export interface CapacitorUpdaterPlugin {
|
|
177
314
|
/**
|
|
178
|
-
* Notify
|
|
179
|
-
*
|
|
180
|
-
*
|
|
315
|
+
* Notify the native layer that JavaScript initialized successfully.
|
|
316
|
+
*
|
|
317
|
+
* **CRITICAL: You must call this method on every app launch to prevent automatic rollback.**
|
|
318
|
+
*
|
|
319
|
+
* This is a simple notification to confirm that your bundle's JavaScript loaded and executed.
|
|
320
|
+
* The native web server successfully served the bundle files and your JS runtime started.
|
|
321
|
+
* That's all it checks - nothing more complex.
|
|
322
|
+
*
|
|
323
|
+
* **What triggers rollback:**
|
|
324
|
+
* - NOT calling this method within the timeout (default: 10 seconds)
|
|
325
|
+
* - Complete JavaScript failure (bundle won't load at all)
|
|
326
|
+
*
|
|
327
|
+
* **What does NOT trigger rollback:**
|
|
328
|
+
* - Runtime errors after initialization (API failures, crashes, etc.)
|
|
329
|
+
* - Network request failures
|
|
330
|
+
* - Application logic errors
|
|
331
|
+
*
|
|
332
|
+
* **IMPORTANT: Call this BEFORE any network requests.**
|
|
333
|
+
* Don't wait for APIs, data loading, or async operations. Call it as soon as your
|
|
334
|
+
* JavaScript bundle starts executing to confirm the bundle itself is valid.
|
|
335
|
+
*
|
|
336
|
+
* Best practices:
|
|
337
|
+
* - Call immediately in your app entry point (main.js, app component mount, etc.)
|
|
338
|
+
* - Don't put it after network calls or heavy initialization
|
|
339
|
+
* - Don't wrap it in try/catch with conditions
|
|
340
|
+
* - Adjust {@link PluginsConfig.CapacitorUpdater.appReadyTimeout} if you need more time
|
|
181
341
|
*
|
|
182
|
-
* @returns {Promise<AppReadyResult>}
|
|
183
|
-
* @throws {Error}
|
|
342
|
+
* @returns {Promise<AppReadyResult>} Always resolves successfully with current bundle info. This method never fails.
|
|
184
343
|
*/
|
|
185
344
|
notifyAppReady(): Promise<AppReadyResult>;
|
|
186
345
|
/**
|
|
187
|
-
* Set the
|
|
346
|
+
* Set the update URL for the app dynamically at runtime.
|
|
188
347
|
*
|
|
189
|
-
*
|
|
190
|
-
* @
|
|
191
|
-
*
|
|
348
|
+
* This overrides the {@link PluginsConfig.CapacitorUpdater.updateUrl} config value.
|
|
349
|
+
* Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
|
|
350
|
+
*
|
|
351
|
+
* Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
|
|
352
|
+
* Otherwise, the URL will reset to the config value on next app launch.
|
|
353
|
+
*
|
|
354
|
+
* @param options Contains the URL to use for checking for updates.
|
|
355
|
+
* @returns {Promise<void>} Resolves when the URL is successfully updated.
|
|
356
|
+
* @throws {Error} If `allowModifyUrl` is false or if the operation fails.
|
|
192
357
|
* @since 5.4.0
|
|
193
358
|
*/
|
|
194
359
|
setUpdateUrl(options: UpdateUrl): Promise<void>;
|
|
195
360
|
/**
|
|
196
|
-
* Set the
|
|
361
|
+
* Set the statistics URL for the app dynamically at runtime.
|
|
362
|
+
*
|
|
363
|
+
* This overrides the {@link PluginsConfig.CapacitorUpdater.statsUrl} config value.
|
|
364
|
+
* Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
|
|
365
|
+
*
|
|
366
|
+
* Pass an empty string to disable statistics gathering entirely.
|
|
367
|
+
* Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
|
|
197
368
|
*
|
|
198
|
-
* @param options
|
|
199
|
-
* @returns {Promise<void>}
|
|
200
|
-
* @throws {Error}
|
|
369
|
+
* @param options Contains the URL to use for sending statistics, or an empty string to disable.
|
|
370
|
+
* @returns {Promise<void>} Resolves when the URL is successfully updated.
|
|
371
|
+
* @throws {Error} If `allowModifyUrl` is false or if the operation fails.
|
|
201
372
|
* @since 5.4.0
|
|
202
373
|
*/
|
|
203
374
|
setStatsUrl(options: StatsUrl): Promise<void>;
|
|
204
375
|
/**
|
|
205
|
-
* Set the
|
|
376
|
+
* Set the channel URL for the app dynamically at runtime.
|
|
206
377
|
*
|
|
207
|
-
*
|
|
208
|
-
* @
|
|
209
|
-
*
|
|
378
|
+
* This overrides the {@link PluginsConfig.CapacitorUpdater.channelUrl} config value.
|
|
379
|
+
* Requires {@link PluginsConfig.CapacitorUpdater.allowModifyUrl} to be set to `true`.
|
|
380
|
+
*
|
|
381
|
+
* Use {@link PluginsConfig.CapacitorUpdater.persistModifyUrl} to persist this value across app restarts.
|
|
382
|
+
* Otherwise, the URL will reset to the config value on next app launch.
|
|
383
|
+
*
|
|
384
|
+
* @param options Contains the URL to use for channel operations.
|
|
385
|
+
* @returns {Promise<void>} Resolves when the URL is successfully updated.
|
|
386
|
+
* @throws {Error} If `allowModifyUrl` is false or if the operation fails.
|
|
210
387
|
* @since 5.4.0
|
|
211
388
|
*/
|
|
212
389
|
setChannelUrl(options: ChannelUrl): Promise<void>;
|
|
213
390
|
/**
|
|
214
|
-
* Download a new bundle from the provided URL
|
|
391
|
+
* Download a new bundle from the provided URL for later installation.
|
|
392
|
+
*
|
|
393
|
+
* The downloaded bundle is stored locally but not activated. To use it:
|
|
394
|
+
* - Call {@link next} to set it for installation on next app backgrounding/restart
|
|
395
|
+
* - Call {@link set} to activate it immediately (destroys current JavaScript context)
|
|
396
|
+
*
|
|
397
|
+
* The URL should point to a zip file containing either:
|
|
398
|
+
* - Your app files directly in the zip root, or
|
|
399
|
+
* - A single folder containing all your app files
|
|
400
|
+
*
|
|
401
|
+
* The bundle must include an `index.html` file at the root level.
|
|
402
|
+
*
|
|
403
|
+
* For encrypted bundles, provide the `sessionKey` and `checksum` parameters.
|
|
404
|
+
* For multi-file partial updates, provide the `manifest` array.
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* const bundle = await CapacitorUpdater.download({
|
|
408
|
+
* url: `https://example.com/versions/${version}/dist.zip`,
|
|
409
|
+
* version: version
|
|
410
|
+
* });
|
|
411
|
+
* // Bundle is downloaded but not active yet
|
|
412
|
+
* await CapacitorUpdater.next({ id: bundle.id }); // Will activate on next background
|
|
215
413
|
*
|
|
216
|
-
* @example const bundle = await CapacitorUpdater.download({ url: `https://example.com/versions/${version}/dist.zip`, version });
|
|
217
|
-
* @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle.
|
|
218
414
|
* @param options The {@link DownloadOptions} for downloading a new bundle zip.
|
|
415
|
+
* @returns {Promise<BundleInfo>} The {@link BundleInfo} for the downloaded bundle.
|
|
416
|
+
* @throws {Error} If the download fails or the bundle is invalid.
|
|
219
417
|
*/
|
|
220
418
|
download(options: DownloadOptions): Promise<BundleInfo>;
|
|
221
419
|
/**
|
|
222
|
-
* Set the next bundle to be
|
|
420
|
+
* Set the next bundle to be activated when the app backgrounds or restarts.
|
|
223
421
|
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
422
|
+
* This is the recommended way to apply updates as it doesn't interrupt the user's current session.
|
|
423
|
+
* The bundle will be activated when:
|
|
424
|
+
* - The app is backgrounded (user switches away), or
|
|
425
|
+
* - The app is killed and relaunched, or
|
|
426
|
+
* - {@link reload} is called manually
|
|
427
|
+
*
|
|
428
|
+
* Unlike {@link set}, this method does NOT destroy the current JavaScript context immediately.
|
|
429
|
+
* Your app continues running normally until one of the above events occurs.
|
|
430
|
+
*
|
|
431
|
+
* Use {@link setMultiDelay} to add additional conditions before the update is applied.
|
|
432
|
+
*
|
|
433
|
+
* @param options Contains the ID of the bundle to set as next. Use {@link BundleInfo.id} from a downloaded bundle.
|
|
434
|
+
* @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle.
|
|
435
|
+
* @throws {Error} When there is no index.html file inside the bundle folder or the bundle doesn't exist.
|
|
227
436
|
*/
|
|
228
437
|
next(options: BundleId): Promise<BundleInfo>;
|
|
229
438
|
/**
|
|
230
439
|
* Set the current bundle and immediately reloads the app.
|
|
231
440
|
*
|
|
441
|
+
* **IMPORTANT: This is a terminal operation that destroys the current JavaScript context.**
|
|
442
|
+
*
|
|
443
|
+
* When you call this method:
|
|
444
|
+
* - The entire JavaScript context is immediately destroyed
|
|
445
|
+
* - The app reloads from a different folder with different files
|
|
446
|
+
* - NO code after this call will execute
|
|
447
|
+
* - NO promises will resolve
|
|
448
|
+
* - NO callbacks will fire
|
|
449
|
+
* - Event listeners registered after this call are unreliable and may never fire
|
|
450
|
+
*
|
|
451
|
+
* The reload happens automatically - you don't need to do anything else.
|
|
452
|
+
* If you need to preserve state like the current URL path, use the {@link PluginsConfig.CapacitorUpdater.keepUrlPathAfterReload} config option.
|
|
453
|
+
* For other state preservation needs, save your data before calling this method (e.g., to localStorage).
|
|
454
|
+
*
|
|
455
|
+
* **Do not** try to execute additional logic after calling `set()` - it won't work as expected.
|
|
456
|
+
*
|
|
232
457
|
* @param options A {@link BundleId} object containing the new bundle id to set as current.
|
|
233
|
-
* @returns {Promise<void>}
|
|
234
|
-
* @throws {Error} When there
|
|
458
|
+
* @returns {Promise<void>} A promise that will never resolve because the JavaScript context is destroyed.
|
|
459
|
+
* @throws {Error} When there is no index.html file inside the bundle folder.
|
|
235
460
|
*/
|
|
236
461
|
set(options: BundleId): Promise<void>;
|
|
237
462
|
/**
|
|
238
|
-
*
|
|
463
|
+
* Delete a bundle from local storage to free up disk space.
|
|
464
|
+
*
|
|
465
|
+
* You cannot delete:
|
|
466
|
+
* - The currently active bundle
|
|
467
|
+
* - The `builtin` bundle (the version shipped with your app)
|
|
468
|
+
* - The bundle set as `next` (call {@link next} with a different bundle first)
|
|
239
469
|
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
470
|
+
* Use {@link list} to get all available bundle IDs.
|
|
471
|
+
*
|
|
472
|
+
* **Note:** The bundle ID is NOT the same as the version name.
|
|
473
|
+
* Use the `id` field from {@link BundleInfo}, not the `version` field.
|
|
474
|
+
*
|
|
475
|
+
* @param options A {@link BundleId} object containing the bundle ID to delete.
|
|
476
|
+
* @returns {Promise<void>} Resolves when the bundle is successfully deleted.
|
|
477
|
+
* @throws {Error} If the bundle is currently in use or doesn't exist.
|
|
243
478
|
*/
|
|
244
479
|
delete(options: BundleId): Promise<void>;
|
|
245
480
|
/**
|
|
246
|
-
*
|
|
481
|
+
* Manually mark a bundle as failed/errored in manual update mode.
|
|
482
|
+
*
|
|
483
|
+
* This is useful when you detect that a bundle has critical issues and want to prevent
|
|
484
|
+
* it from being used again. The bundle status will be changed to `error` and the plugin
|
|
485
|
+
* will avoid using this bundle in the future.
|
|
486
|
+
*
|
|
487
|
+
* **Requirements:**
|
|
488
|
+
* - {@link PluginsConfig.CapacitorUpdater.allowManualBundleError} must be set to `true`
|
|
489
|
+
* - Only works in manual update mode (when autoUpdate is disabled)
|
|
490
|
+
*
|
|
491
|
+
* Common use case: After downloading and testing a bundle, you discover it has critical
|
|
492
|
+
* bugs and want to mark it as failed so it won't be retried.
|
|
247
493
|
*
|
|
248
|
-
* @
|
|
249
|
-
* @
|
|
494
|
+
* @param options A {@link BundleId} object containing the bundle ID to mark as errored.
|
|
495
|
+
* @returns {Promise<BundleInfo>} The updated {@link BundleInfo} with status set to `error`.
|
|
496
|
+
* @throws {Error} When the bundle does not exist or `allowManualBundleError` is false.
|
|
497
|
+
* @since 7.20.0
|
|
250
498
|
*/
|
|
251
|
-
|
|
499
|
+
setBundleError(options: BundleId): Promise<BundleInfo>;
|
|
252
500
|
/**
|
|
253
|
-
*
|
|
501
|
+
* Get all locally downloaded bundles stored in your app.
|
|
254
502
|
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
503
|
+
* This returns all bundles that have been downloaded and are available locally, including:
|
|
504
|
+
* - The currently active bundle
|
|
505
|
+
* - The `builtin` bundle (shipped with your app)
|
|
506
|
+
* - Any downloaded bundles waiting to be activated
|
|
507
|
+
* - Failed bundles (with `error` status)
|
|
508
|
+
*
|
|
509
|
+
* Use this to:
|
|
510
|
+
* - Check available disk space by counting bundles
|
|
511
|
+
* - Delete old bundles with {@link delete}
|
|
512
|
+
* - Monitor bundle download status
|
|
513
|
+
*
|
|
514
|
+
* @param options The {@link ListOptions} for customizing the bundle list output.
|
|
515
|
+
* @returns {Promise<BundleListResult>} A promise containing the array of {@link BundleInfo} objects.
|
|
516
|
+
* @throws {Error} If the operation fails.
|
|
517
|
+
*/
|
|
518
|
+
list(options?: ListOptions): Promise<BundleListResult>;
|
|
519
|
+
/**
|
|
520
|
+
* Reset the app to a known good bundle.
|
|
521
|
+
*
|
|
522
|
+
* This method helps recover from problematic updates by reverting to either:
|
|
523
|
+
* - The `builtin` bundle (the original version shipped with your app to App Store/Play Store)
|
|
524
|
+
* - The last successfully loaded bundle (most recent bundle that worked correctly)
|
|
525
|
+
*
|
|
526
|
+
* **IMPORTANT: This triggers an immediate app reload, destroying the current JavaScript context.**
|
|
527
|
+
* See {@link set} for details on the implications of this operation.
|
|
528
|
+
*
|
|
529
|
+
* Use cases:
|
|
530
|
+
* - Emergency recovery when an update causes critical issues
|
|
531
|
+
* - Testing rollback functionality
|
|
532
|
+
* - Providing users a "reset to factory" option
|
|
533
|
+
*
|
|
534
|
+
* @param options {@link ResetOptions} to control reset behavior. If `toLastSuccessful` is `false` (or omitted), resets to builtin. If `true`, resets to last successful bundle.
|
|
535
|
+
* @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.
|
|
536
|
+
* @throws {Error} If the reset operation fails.
|
|
258
537
|
*/
|
|
259
538
|
reset(options?: ResetOptions): Promise<void>;
|
|
260
539
|
/**
|
|
261
|
-
* Get
|
|
540
|
+
* Get information about the currently active bundle.
|
|
262
541
|
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
542
|
+
* Returns:
|
|
543
|
+
* - `bundle`: The currently active bundle information
|
|
544
|
+
* - `native`: The version of the builtin bundle (the original app version from App/Play Store)
|
|
545
|
+
*
|
|
546
|
+
* If no updates have been applied, `bundle.id` will be `"builtin"`, indicating the app
|
|
547
|
+
* is running the original version shipped with the native app.
|
|
548
|
+
*
|
|
549
|
+
* Use this to:
|
|
550
|
+
* - Display the current version to users
|
|
551
|
+
* - Check if an update is currently active
|
|
552
|
+
* - Compare against available updates
|
|
553
|
+
* - Log the active bundle for debugging
|
|
554
|
+
*
|
|
555
|
+
* @returns {Promise<CurrentBundleResult>} A promise with the current bundle and native version info.
|
|
556
|
+
* @throws {Error} If the operation fails.
|
|
265
557
|
*/
|
|
266
558
|
current(): Promise<CurrentBundleResult>;
|
|
267
559
|
/**
|
|
268
|
-
*
|
|
560
|
+
* Manually reload the app to apply a pending update.
|
|
561
|
+
*
|
|
562
|
+
* This triggers the same reload behavior that happens automatically when the app backgrounds.
|
|
563
|
+
* If you've called {@link next} to queue an update, calling `reload()` will apply it immediately.
|
|
269
564
|
*
|
|
270
|
-
*
|
|
271
|
-
* @
|
|
565
|
+
* **IMPORTANT: This destroys the current JavaScript context immediately.**
|
|
566
|
+
* See {@link set} for details on the implications of this operation.
|
|
567
|
+
*
|
|
568
|
+
* Common use cases:
|
|
569
|
+
* - Applying an update immediately after download instead of waiting for backgrounding
|
|
570
|
+
* - Providing a "Restart now" button to users after an update is ready
|
|
571
|
+
* - Testing update flows during development
|
|
572
|
+
*
|
|
573
|
+
* If no update is pending (no call to {@link next}), this simply reloads the current bundle.
|
|
574
|
+
*
|
|
575
|
+
* @returns {Promise<void>} A promise that may never resolve because the app will be reloaded.
|
|
576
|
+
* @throws {Error} If the reload operation fails.
|
|
272
577
|
*/
|
|
273
578
|
reload(): Promise<void>;
|
|
274
579
|
/**
|
|
275
|
-
*
|
|
580
|
+
* Configure conditions that must be met before a pending update is applied.
|
|
581
|
+
*
|
|
582
|
+
* After calling {@link next} to queue an update, use this method to control when it gets applied.
|
|
583
|
+
* The update will only be installed after ALL specified conditions are satisfied.
|
|
584
|
+
*
|
|
585
|
+
* Available condition types:
|
|
586
|
+
* - `background`: Wait for the app to be backgrounded. Optionally specify duration in milliseconds.
|
|
587
|
+
* - `kill`: Wait for the app to be killed and relaunched (**Note:** Current behavior triggers update immediately on kill, not on next background. This will be fixed in v8.)
|
|
588
|
+
* - `date`: Wait until a specific date/time (ISO 8601 format)
|
|
589
|
+
* - `nativeVersion`: Wait until the native app is updated to a specific version
|
|
590
|
+
*
|
|
591
|
+
* Condition value formats:
|
|
592
|
+
* - `background`: Number in milliseconds (e.g., `"300000"` for 5 minutes), or omit for immediate
|
|
593
|
+
* - `kill`: No value needed
|
|
594
|
+
* - `date`: ISO 8601 date string (e.g., `"2025-12-31T23:59:59Z"`)
|
|
595
|
+
* - `nativeVersion`: Version string (e.g., `"2.0.0"`)
|
|
276
596
|
*
|
|
277
597
|
* @example
|
|
278
|
-
* //
|
|
279
|
-
* await CapacitorUpdater.setMultiDelay({
|
|
598
|
+
* // Update after user kills app OR after 5 minutes in background
|
|
599
|
+
* await CapacitorUpdater.setMultiDelay({
|
|
600
|
+
* delayConditions: [
|
|
601
|
+
* { kind: 'kill' },
|
|
602
|
+
* { kind: 'background', value: '300000' }
|
|
603
|
+
* ]
|
|
604
|
+
* });
|
|
605
|
+
*
|
|
280
606
|
* @example
|
|
281
|
-
* //
|
|
282
|
-
* await CapacitorUpdater.setMultiDelay({
|
|
607
|
+
* // Update after a specific date
|
|
608
|
+
* await CapacitorUpdater.setMultiDelay({
|
|
609
|
+
* delayConditions: [{ kind: 'date', value: '2025-12-31T23:59:59Z' }]
|
|
610
|
+
* });
|
|
611
|
+
*
|
|
283
612
|
* @example
|
|
284
|
-
* //
|
|
285
|
-
* await CapacitorUpdater.setMultiDelay({
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
613
|
+
* // Default behavior: update on next background
|
|
614
|
+
* await CapacitorUpdater.setMultiDelay({
|
|
615
|
+
* delayConditions: [{ kind: 'background' }]
|
|
616
|
+
* });
|
|
617
|
+
*
|
|
618
|
+
* @param options Contains the {@link MultiDelayConditions} array of conditions.
|
|
619
|
+
* @returns {Promise<void>} Resolves when the delay conditions are set.
|
|
620
|
+
* @throws {Error} If the operation fails or conditions are invalid.
|
|
289
621
|
* @since 4.3.0
|
|
290
622
|
*/
|
|
291
623
|
setMultiDelay(options: MultiDelayConditions): Promise<void>;
|
|
292
624
|
/**
|
|
293
|
-
*
|
|
625
|
+
* Cancel all delay conditions and apply the pending update immediately.
|
|
626
|
+
*
|
|
627
|
+
* If you've set delay conditions with {@link setMultiDelay}, this method clears them
|
|
628
|
+
* and triggers the pending update to be applied on the next app background or restart.
|
|
294
629
|
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
630
|
+
* This is useful when:
|
|
631
|
+
* - User manually requests to update now (e.g., clicks "Update now" button)
|
|
632
|
+
* - Your app detects it's a good time to update (e.g., user finished critical task)
|
|
633
|
+
* - You want to override a time-based delay early
|
|
634
|
+
*
|
|
635
|
+
* @returns {Promise<void>} Resolves when the delay conditions are cleared.
|
|
636
|
+
* @throws {Error} If the operation fails.
|
|
297
637
|
* @since 4.0.0
|
|
298
638
|
*/
|
|
299
639
|
cancelDelay(): Promise<void>;
|
|
300
640
|
/**
|
|
301
|
-
*
|
|
641
|
+
* Check the update server for the latest available bundle version.
|
|
642
|
+
*
|
|
643
|
+
* This queries your configured update URL (or Capgo backend) to see if a newer bundle
|
|
644
|
+
* is available for download. It does NOT download the bundle automatically.
|
|
302
645
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
646
|
+
* The response includes:
|
|
647
|
+
* - `version`: The latest available version identifier
|
|
648
|
+
* - `url`: Download URL for the bundle (if available)
|
|
649
|
+
* - `breaking`: Whether this update is marked as incompatible (requires native app update)
|
|
650
|
+
* - `message`: Optional message from the server
|
|
651
|
+
* - `manifest`: File list for partial updates (if using multi-file downloads)
|
|
652
|
+
*
|
|
653
|
+
* After receiving the latest version info, you can:
|
|
654
|
+
* 1. Compare it with your current version
|
|
655
|
+
* 2. Download it using {@link download}
|
|
656
|
+
* 3. Apply it using {@link next} or {@link set}
|
|
657
|
+
*
|
|
658
|
+
* @param options Optional {@link GetLatestOptions} to specify which channel to check.
|
|
659
|
+
* @returns {Promise<LatestVersion>} Information about the latest available bundle version.
|
|
660
|
+
* @throws {Error} If the request fails or the server returns an error.
|
|
305
661
|
* @since 4.0.0
|
|
306
662
|
*/
|
|
307
|
-
getLatest(): Promise<LatestVersion>;
|
|
663
|
+
getLatest(options?: GetLatestOptions): Promise<LatestVersion>;
|
|
308
664
|
/**
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
665
|
+
* Assign this device to a specific update channel at runtime.
|
|
666
|
+
*
|
|
667
|
+
* Channels allow you to distribute different bundle versions to different groups of users
|
|
668
|
+
* (e.g., "production", "beta", "staging"). This method switches the device to a new channel.
|
|
669
|
+
*
|
|
670
|
+
* **Requirements:**
|
|
671
|
+
* - The target channel must allow self-assignment (configured in your Capgo dashboard or backend)
|
|
672
|
+
* - The backend may accept or reject the request based on channel settings
|
|
312
673
|
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
674
|
+
* **When to use:**
|
|
675
|
+
* - After the app is ready and the user has interacted (e.g., opted into beta program)
|
|
676
|
+
* - To implement in-app channel switching (beta toggle, tester access, etc.)
|
|
677
|
+
* - For user-driven channel changes
|
|
678
|
+
*
|
|
679
|
+
* **When NOT to use:**
|
|
680
|
+
* - At app boot/initialization - use {@link PluginsConfig.CapacitorUpdater.defaultChannel} config instead
|
|
681
|
+
* - Before user interaction
|
|
682
|
+
*
|
|
683
|
+
* This sends a request to the Capgo backend linking your device ID to the specified channel.
|
|
684
|
+
*
|
|
685
|
+
* @param options The {@link SetChannelOptions} containing the channel name and optional auto-update trigger.
|
|
686
|
+
* @returns {Promise<ChannelRes>} Channel operation result with status and optional error/message.
|
|
687
|
+
* @throws {Error} If the channel doesn't exist or doesn't allow self-assignment.
|
|
316
688
|
* @since 4.7.0
|
|
317
689
|
*/
|
|
318
690
|
setChannel(options: SetChannelOptions): Promise<ChannelRes>;
|
|
319
691
|
/**
|
|
320
|
-
*
|
|
692
|
+
* Remove the device's channel assignment and return to the default channel.
|
|
693
|
+
*
|
|
694
|
+
* This unlinks the device from any specifically assigned channel, causing it to fall back to:
|
|
695
|
+
* - The {@link PluginsConfig.CapacitorUpdater.defaultChannel} if configured, or
|
|
696
|
+
* - Your backend's default channel for this app
|
|
697
|
+
*
|
|
698
|
+
* Use this when:
|
|
699
|
+
* - Users opt out of beta/testing programs
|
|
700
|
+
* - You want to reset a device to standard update distribution
|
|
701
|
+
* - Testing channel switching behavior
|
|
321
702
|
*
|
|
322
|
-
* @
|
|
323
|
-
* @
|
|
703
|
+
* @param options {@link UnsetChannelOptions} containing optional auto-update trigger.
|
|
704
|
+
* @returns {Promise<void>} Resolves when the channel is successfully unset.
|
|
705
|
+
* @throws {Error} If the operation fails.
|
|
324
706
|
* @since 4.7.0
|
|
325
707
|
*/
|
|
326
708
|
unsetChannel(options: UnsetChannelOptions): Promise<void>;
|
|
327
709
|
/**
|
|
328
|
-
* Get the channel
|
|
710
|
+
* Get the current channel assigned to this device.
|
|
329
711
|
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
712
|
+
* Returns information about:
|
|
713
|
+
* - `channel`: The currently assigned channel name (if any)
|
|
714
|
+
* - `allowSet`: Whether the channel allows self-assignment
|
|
715
|
+
* - `status`: Operation status
|
|
716
|
+
* - `error`/`message`: Additional information (if applicable)
|
|
717
|
+
*
|
|
718
|
+
* Use this to:
|
|
719
|
+
* - Display current channel to users (e.g., "You're on the Beta channel")
|
|
720
|
+
* - Check if a device is on a specific channel before showing features
|
|
721
|
+
* - Verify channel assignment after calling {@link setChannel}
|
|
722
|
+
*
|
|
723
|
+
* @returns {Promise<GetChannelRes>} The current channel information.
|
|
724
|
+
* @throws {Error} If the operation fails.
|
|
332
725
|
* @since 4.8.0
|
|
333
726
|
*/
|
|
334
727
|
getChannel(): Promise<GetChannelRes>;
|
|
335
728
|
/**
|
|
336
|
-
*
|
|
729
|
+
* Get a list of all channels available for this device to self-assign to.
|
|
730
|
+
*
|
|
731
|
+
* Only returns channels where `allow_self_set` is `true`. These are channels that
|
|
732
|
+
* users can switch to using {@link setChannel} without backend administrator intervention.
|
|
733
|
+
*
|
|
734
|
+
* Each channel includes:
|
|
735
|
+
* - `id`: Unique channel identifier
|
|
736
|
+
* - `name`: Human-readable channel name
|
|
737
|
+
* - `public`: Whether the channel is publicly visible
|
|
738
|
+
* - `allow_self_set`: Always `true` in results (filtered to only self-assignable channels)
|
|
337
739
|
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
740
|
+
* Use this to:
|
|
741
|
+
* - Build a channel selector UI for users (e.g., "Join Beta" button)
|
|
742
|
+
* - Show available testing/preview channels
|
|
743
|
+
* - Implement channel discovery features
|
|
744
|
+
*
|
|
745
|
+
* @returns {Promise<ListChannelsResult>} List of channels the device can self-assign to.
|
|
746
|
+
* @throws {Error} If the operation fails or the request to the backend fails.
|
|
747
|
+
* @since 7.5.0
|
|
748
|
+
*/
|
|
749
|
+
listChannels(): Promise<ListChannelsResult>;
|
|
750
|
+
/**
|
|
751
|
+
* Set a custom identifier for this device.
|
|
752
|
+
*
|
|
753
|
+
* This allows you to identify devices by your own custom ID (user ID, account ID, etc.)
|
|
754
|
+
* instead of or in addition to the device's unique hardware ID. The custom ID is sent
|
|
755
|
+
* to your update server and can be used for:
|
|
756
|
+
* - Targeting specific users for updates
|
|
757
|
+
* - Analytics and user tracking
|
|
758
|
+
* - Debugging and support (correlating devices with users)
|
|
759
|
+
* - A/B testing or feature flagging
|
|
760
|
+
*
|
|
761
|
+
* **Persistence:**
|
|
762
|
+
* - When {@link PluginsConfig.CapacitorUpdater.persistCustomId} is `true`, the ID persists across app restarts
|
|
763
|
+
* - When `false`, the ID is only kept for the current session
|
|
764
|
+
*
|
|
765
|
+
* **Clearing the custom ID:**
|
|
766
|
+
* - Pass an empty string `""` to remove any stored custom ID
|
|
767
|
+
*
|
|
768
|
+
* @param options The {@link SetCustomIdOptions} containing the custom identifier string.
|
|
769
|
+
* @returns {Promise<void>} Resolves immediately (synchronous operation).
|
|
770
|
+
* @throws {Error} If the operation fails.
|
|
341
771
|
* @since 4.9.0
|
|
342
772
|
*/
|
|
343
773
|
setCustomId(options: SetCustomIdOptions): Promise<void>;
|
|
344
774
|
/**
|
|
345
|
-
* Get the
|
|
775
|
+
* Get the builtin bundle version (the original version shipped with your native app).
|
|
776
|
+
*
|
|
777
|
+
* This returns the version of the bundle that was included when the app was installed
|
|
778
|
+
* from the App Store or Play Store. This is NOT the currently active bundle version -
|
|
779
|
+
* use {@link current} for that.
|
|
346
780
|
*
|
|
347
|
-
*
|
|
781
|
+
* Returns:
|
|
782
|
+
* - The {@link PluginsConfig.CapacitorUpdater.version} config value if set, or
|
|
783
|
+
* - The native app version from platform configs (package.json, Info.plist, build.gradle)
|
|
784
|
+
*
|
|
785
|
+
* Use this to:
|
|
786
|
+
* - Display the "factory" version to users
|
|
787
|
+
* - Compare against downloaded bundle versions
|
|
788
|
+
* - Determine if any updates have been applied
|
|
789
|
+
* - Debugging version mismatches
|
|
790
|
+
*
|
|
791
|
+
* @returns {Promise<BuiltinVersion>} The builtin bundle version string.
|
|
348
792
|
* @since 5.2.0
|
|
349
793
|
*/
|
|
350
794
|
getBuiltinVersion(): Promise<BuiltinVersion>;
|
|
351
795
|
/**
|
|
352
|
-
* Get unique
|
|
796
|
+
* Get the unique, privacy-friendly identifier for this device.
|
|
797
|
+
*
|
|
798
|
+
* This ID is used to identify the device when communicating with update servers.
|
|
799
|
+
* It's automatically generated and stored securely by the plugin.
|
|
800
|
+
*
|
|
801
|
+
* **Privacy & Security characteristics:**
|
|
802
|
+
* - Generated as a UUID (not based on hardware identifiers)
|
|
803
|
+
* - Stored securely in platform-specific secure storage
|
|
804
|
+
* - Android: Android Keystore (persists across app reinstalls on API 23+)
|
|
805
|
+
* - iOS: Keychain with `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly`
|
|
806
|
+
* - Not synced to cloud (iOS)
|
|
807
|
+
* - Follows Apple and Google privacy best practices
|
|
808
|
+
* - Users can clear it via system settings (Android) or keychain access (iOS)
|
|
353
809
|
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
810
|
+
* **Persistence:**
|
|
811
|
+
* The device ID persists across app reinstalls to maintain consistent device identity
|
|
812
|
+
* for update tracking and analytics.
|
|
813
|
+
*
|
|
814
|
+
* Use this to:
|
|
815
|
+
* - Debug update delivery issues (check what ID the server sees)
|
|
816
|
+
* - Implement device-specific features
|
|
817
|
+
* - Correlate server logs with specific devices
|
|
818
|
+
*
|
|
819
|
+
* @returns {Promise<DeviceId>} The unique device identifier string.
|
|
820
|
+
* @throws {Error} If the operation fails.
|
|
356
821
|
*/
|
|
357
822
|
getDeviceId(): Promise<DeviceId>;
|
|
358
823
|
/**
|
|
359
|
-
* Get the
|
|
824
|
+
* Get the version of the Capacitor Updater plugin installed in your app.
|
|
825
|
+
*
|
|
826
|
+
* This returns the version of the native plugin code (Android/iOS), which is sent
|
|
827
|
+
* to the update server with each request. This is NOT your app version or bundle version.
|
|
828
|
+
*
|
|
829
|
+
* Use this to:
|
|
830
|
+
* - Debug plugin-specific issues (when reporting bugs)
|
|
831
|
+
* - Verify plugin installation and version
|
|
832
|
+
* - Check compatibility with backend features
|
|
833
|
+
* - Display in debug/about screens
|
|
360
834
|
*
|
|
361
|
-
* @returns {Promise<PluginVersion>}
|
|
362
|
-
* @throws {Error}
|
|
835
|
+
* @returns {Promise<PluginVersion>} The Capacitor Updater plugin version string.
|
|
836
|
+
* @throws {Error} If the operation fails.
|
|
363
837
|
*/
|
|
364
838
|
getPluginVersion(): Promise<PluginVersion>;
|
|
365
839
|
/**
|
|
366
|
-
*
|
|
840
|
+
* Check if automatic updates are currently enabled.
|
|
367
841
|
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
842
|
+
* Returns `true` if {@link PluginsConfig.CapacitorUpdater.autoUpdate} is enabled,
|
|
843
|
+
* meaning the plugin will automatically check for, download, and apply updates.
|
|
844
|
+
*
|
|
845
|
+
* Returns `false` if in manual mode, where you control the update flow using
|
|
846
|
+
* {@link getLatest}, {@link download}, {@link next}, and {@link set}.
|
|
847
|
+
*
|
|
848
|
+
* Use this to:
|
|
849
|
+
* - Determine which update flow your app is using
|
|
850
|
+
* - Show/hide manual update UI based on mode
|
|
851
|
+
* - Debug update behavior
|
|
852
|
+
*
|
|
853
|
+
* @returns {Promise<AutoUpdateEnabled>} `true` if auto-update is enabled, `false` if in manual mode.
|
|
854
|
+
* @throws {Error} If the operation fails.
|
|
370
855
|
*/
|
|
371
856
|
isAutoUpdateEnabled(): Promise<AutoUpdateEnabled>;
|
|
372
857
|
/**
|
|
373
|
-
* Remove all listeners for this plugin.
|
|
858
|
+
* Remove all event listeners registered for this plugin.
|
|
859
|
+
*
|
|
860
|
+
* This unregisters all listeners added via {@link addListener} for all event types:
|
|
861
|
+
* - `download`
|
|
862
|
+
* - `noNeedUpdate`
|
|
863
|
+
* - `updateAvailable`
|
|
864
|
+
* - `downloadComplete`
|
|
865
|
+
* - `downloadFailed`
|
|
866
|
+
* - `breakingAvailable` / `majorAvailable`
|
|
867
|
+
* - `updateFailed`
|
|
868
|
+
* - `appReloaded`
|
|
869
|
+
* - `appReady`
|
|
374
870
|
*
|
|
871
|
+
* Use this during cleanup (e.g., when unmounting components or closing screens)
|
|
872
|
+
* to prevent memory leaks from lingering event listeners.
|
|
873
|
+
*
|
|
874
|
+
* @returns {Promise<void>} Resolves when all listeners are removed.
|
|
375
875
|
* @since 1.0.0
|
|
376
876
|
*/
|
|
377
877
|
removeAllListeners(): Promise<void>;
|
|
378
878
|
/**
|
|
379
879
|
* Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.
|
|
880
|
+
* This will return you all download percent during the download
|
|
380
881
|
*
|
|
381
882
|
* @since 2.0.11
|
|
382
883
|
*/
|
|
383
|
-
addListener(eventName:
|
|
884
|
+
addListener(eventName: 'download', listenerFunc: (state: DownloadEvent) => void): Promise<PluginListenerHandle>;
|
|
384
885
|
/**
|
|
385
886
|
* Listen for no need to update event, useful when you want force check every time the app is launched
|
|
386
887
|
*
|
|
387
888
|
* @since 4.0.0
|
|
388
889
|
*/
|
|
389
|
-
addListener(eventName:
|
|
890
|
+
addListener(eventName: 'noNeedUpdate', listenerFunc: (state: NoNeedEvent) => void): Promise<PluginListenerHandle>;
|
|
390
891
|
/**
|
|
391
892
|
* Listen for available update event, useful when you want to force check every time the app is launched
|
|
392
893
|
*
|
|
393
894
|
* @since 4.0.0
|
|
394
895
|
*/
|
|
395
|
-
addListener(eventName:
|
|
896
|
+
addListener(eventName: 'updateAvailable', listenerFunc: (state: UpdateAvailableEvent) => void): Promise<PluginListenerHandle>;
|
|
396
897
|
/**
|
|
397
898
|
* Listen for downloadComplete events.
|
|
398
899
|
*
|
|
399
900
|
* @since 4.0.0
|
|
400
901
|
*/
|
|
401
|
-
addListener(eventName:
|
|
902
|
+
addListener(eventName: 'downloadComplete', listenerFunc: (state: DownloadCompleteEvent) => void): Promise<PluginListenerHandle>;
|
|
903
|
+
/**
|
|
904
|
+
* Listen for breaking update events when the backend flags an update as incompatible with the current app.
|
|
905
|
+
* Emits the same payload as the legacy `majorAvailable` listener.
|
|
906
|
+
*
|
|
907
|
+
* @since 7.22.0
|
|
908
|
+
*/
|
|
909
|
+
addListener(eventName: 'breakingAvailable', listenerFunc: (state: BreakingAvailableEvent) => void): Promise<PluginListenerHandle>;
|
|
402
910
|
/**
|
|
403
911
|
* Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
|
|
404
912
|
*
|
|
913
|
+
* @deprecated Deprecated alias for {@link addListener} with `breakingAvailable`. Emits the same payload. will be removed in v8
|
|
405
914
|
* @since 2.3.0
|
|
406
915
|
*/
|
|
407
|
-
addListener(eventName:
|
|
916
|
+
addListener(eventName: 'majorAvailable', listenerFunc: (state: MajorAvailableEvent) => void): Promise<PluginListenerHandle>;
|
|
408
917
|
/**
|
|
409
918
|
* Listen for update fail event in the App, let you know when update has fail to install at next app start
|
|
410
919
|
*
|
|
411
920
|
* @since 2.3.0
|
|
412
921
|
*/
|
|
413
|
-
addListener(eventName:
|
|
922
|
+
addListener(eventName: 'updateFailed', listenerFunc: (state: UpdateFailedEvent) => void): Promise<PluginListenerHandle>;
|
|
414
923
|
/**
|
|
415
924
|
* Listen for download fail event in the App, let you know when a bundle download has failed
|
|
416
925
|
*
|
|
417
926
|
* @since 4.0.0
|
|
418
927
|
*/
|
|
419
|
-
addListener(eventName:
|
|
928
|
+
addListener(eventName: 'downloadFailed', listenerFunc: (state: DownloadFailedEvent) => void): Promise<PluginListenerHandle>;
|
|
420
929
|
/**
|
|
421
930
|
* Listen for reload event in the App, let you know when reload has happened
|
|
422
931
|
*
|
|
423
932
|
* @since 4.3.0
|
|
424
933
|
*/
|
|
425
|
-
addListener(eventName:
|
|
934
|
+
addListener(eventName: 'appReloaded', listenerFunc: () => void): Promise<PluginListenerHandle>;
|
|
426
935
|
/**
|
|
427
|
-
* Listen for app ready event in the App, let you know when app is ready to use
|
|
936
|
+
* Listen for app ready event in the App, let you know when app is ready to use, this event is retain till consumed.
|
|
428
937
|
*
|
|
429
938
|
* @since 5.1.0
|
|
430
939
|
*/
|
|
431
|
-
addListener(eventName:
|
|
940
|
+
addListener(eventName: 'appReady', listenerFunc: (state: AppReadyEvent) => void): Promise<PluginListenerHandle>;
|
|
941
|
+
/**
|
|
942
|
+
* Check if the auto-update feature is available (not disabled by custom server configuration).
|
|
943
|
+
*
|
|
944
|
+
* Returns `false` when a custom `updateUrl` is configured, as this typically indicates
|
|
945
|
+
* you're using a self-hosted update server that may not support all auto-update features.
|
|
946
|
+
*
|
|
947
|
+
* Returns `true` when using the default Capgo backend or when the feature is available.
|
|
948
|
+
*
|
|
949
|
+
* This is different from {@link isAutoUpdateEnabled}:
|
|
950
|
+
* - `isAutoUpdateEnabled()`: Checks if auto-update MODE is turned on/off
|
|
951
|
+
* - `isAutoUpdateAvailable()`: Checks if auto-update is SUPPORTED with your current configuration
|
|
952
|
+
*
|
|
953
|
+
* @returns {Promise<AutoUpdateAvailable>} `false` when custom updateUrl is set, `true` otherwise.
|
|
954
|
+
* @throws {Error} If the operation fails.
|
|
955
|
+
*/
|
|
956
|
+
isAutoUpdateAvailable(): Promise<AutoUpdateAvailable>;
|
|
957
|
+
/**
|
|
958
|
+
* Get information about the bundle queued to be activated on next reload.
|
|
959
|
+
*
|
|
960
|
+
* Returns:
|
|
961
|
+
* - {@link BundleInfo} object if a bundle has been queued via {@link next}
|
|
962
|
+
* - `null` if no update is pending
|
|
963
|
+
*
|
|
964
|
+
* This is useful to:
|
|
965
|
+
* - Check if an update is waiting to be applied
|
|
966
|
+
* - Display "Update pending" status to users
|
|
967
|
+
* - Show version info of the queued update
|
|
968
|
+
* - Decide whether to show a "Restart to update" prompt
|
|
969
|
+
*
|
|
970
|
+
* The queued bundle will be activated when:
|
|
971
|
+
* - The app is backgrounded (default behavior)
|
|
972
|
+
* - The app is killed and restarted
|
|
973
|
+
* - {@link reload} is called manually
|
|
974
|
+
* - Delay conditions set by {@link setMultiDelay} are met
|
|
975
|
+
*
|
|
976
|
+
* @returns {Promise<BundleInfo | null>} The pending bundle info, or `null` if none is queued.
|
|
977
|
+
* @throws {Error} If the operation fails.
|
|
978
|
+
* @since 6.8.0
|
|
979
|
+
*/
|
|
980
|
+
getNextBundle(): Promise<BundleInfo | null>;
|
|
981
|
+
/**
|
|
982
|
+
* Retrieve information about the most recent bundle that failed to load.
|
|
983
|
+
*
|
|
984
|
+
* When a bundle fails to load (e.g., JavaScript errors prevent initialization, missing files),
|
|
985
|
+
* the plugin automatically rolls back and stores information about the failure. This method
|
|
986
|
+
* retrieves that failure information.
|
|
987
|
+
*
|
|
988
|
+
* **IMPORTANT: The stored value is cleared after being retrieved once.**
|
|
989
|
+
* Calling this method multiple times will only return the failure info on the first call,
|
|
990
|
+
* then `null` on subsequent calls until another failure occurs.
|
|
991
|
+
*
|
|
992
|
+
* Returns:
|
|
993
|
+
* - {@link UpdateFailedEvent} with bundle info if a failure was recorded
|
|
994
|
+
* - `null` if no failure has occurred or if it was already retrieved
|
|
995
|
+
*
|
|
996
|
+
* Use this to:
|
|
997
|
+
* - Show users why an update failed
|
|
998
|
+
* - Log failure information for debugging
|
|
999
|
+
* - Implement custom error handling/reporting
|
|
1000
|
+
* - Display rollback notifications
|
|
1001
|
+
*
|
|
1002
|
+
* @returns {Promise<UpdateFailedEvent | null>} The failed update info (cleared after first retrieval), or `null`.
|
|
1003
|
+
* @throws {Error} If the operation fails.
|
|
1004
|
+
* @since 7.22.0
|
|
1005
|
+
*/
|
|
1006
|
+
getFailedUpdate(): Promise<UpdateFailedEvent | null>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Enable or disable the shake gesture menu for debugging and testing.
|
|
1009
|
+
*
|
|
1010
|
+
* When enabled, users can shake their device to open a debug menu that shows:
|
|
1011
|
+
* - Current bundle information
|
|
1012
|
+
* - Available bundles
|
|
1013
|
+
* - Options to switch bundles manually
|
|
1014
|
+
* - Update status
|
|
1015
|
+
*
|
|
1016
|
+
* This is useful during development and testing to:
|
|
1017
|
+
* - Quickly test different bundle versions
|
|
1018
|
+
* - Debug update flows
|
|
1019
|
+
* - Switch between production and test bundles
|
|
1020
|
+
* - Verify bundle installations
|
|
1021
|
+
*
|
|
1022
|
+
* **Important:** Disable this in production builds or only enable for internal testers.
|
|
1023
|
+
*
|
|
1024
|
+
* Can also be configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
|
|
1025
|
+
*
|
|
1026
|
+
* @param options {@link SetShakeMenuOptions} with `enabled: true` to enable or `enabled: false` to disable.
|
|
1027
|
+
* @returns {Promise<void>} Resolves when the setting is applied.
|
|
1028
|
+
* @throws {Error} If the operation fails.
|
|
1029
|
+
* @since 7.5.0
|
|
1030
|
+
*/
|
|
1031
|
+
setShakeMenu(options: SetShakeMenuOptions): Promise<void>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Check if the shake gesture debug menu is currently enabled.
|
|
1034
|
+
*
|
|
1035
|
+
* Returns the current state of the shake menu feature that can be toggled via
|
|
1036
|
+
* {@link setShakeMenu} or configured via {@link PluginsConfig.CapacitorUpdater.shakeMenu}.
|
|
1037
|
+
*
|
|
1038
|
+
* Use this to:
|
|
1039
|
+
* - Check if debug features are enabled
|
|
1040
|
+
* - Show/hide debug settings UI
|
|
1041
|
+
* - Verify configuration during testing
|
|
1042
|
+
*
|
|
1043
|
+
* @returns {Promise<ShakeMenuEnabled>} Object with `enabled: true` or `enabled: false`.
|
|
1044
|
+
* @throws {Error} If the operation fails.
|
|
1045
|
+
* @since 7.5.0
|
|
1046
|
+
*/
|
|
1047
|
+
isShakeMenuEnabled(): Promise<ShakeMenuEnabled>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Get the currently configured App ID used for update server communication.
|
|
1050
|
+
*
|
|
1051
|
+
* Returns the App ID that identifies this app to the update server. This can be:
|
|
1052
|
+
* - The value set via {@link setAppId}, or
|
|
1053
|
+
* - The {@link PluginsConfig.CapacitorUpdater.appId} config value, or
|
|
1054
|
+
* - The default app identifier from your native app configuration
|
|
1055
|
+
*
|
|
1056
|
+
* Use this to:
|
|
1057
|
+
* - Verify which App ID is being used for updates
|
|
1058
|
+
* - Debug update delivery issues
|
|
1059
|
+
* - Display app configuration in debug screens
|
|
1060
|
+
* - Confirm App ID after calling {@link setAppId}
|
|
1061
|
+
*
|
|
1062
|
+
* @returns {Promise<GetAppIdRes>} Object containing the current `appId` string.
|
|
1063
|
+
* @throws {Error} If the operation fails.
|
|
1064
|
+
* @since 7.14.0
|
|
1065
|
+
*/
|
|
1066
|
+
getAppId(): Promise<GetAppIdRes>;
|
|
1067
|
+
/**
|
|
1068
|
+
* Dynamically change the App ID used for update server communication.
|
|
1069
|
+
*
|
|
1070
|
+
* This overrides the App ID used to identify your app to the update server, allowing you
|
|
1071
|
+
* to switch between different app configurations at runtime (e.g., production vs staging
|
|
1072
|
+
* app IDs, or multi-tenant configurations).
|
|
1073
|
+
*
|
|
1074
|
+
* **Requirements:**
|
|
1075
|
+
* - {@link PluginsConfig.CapacitorUpdater.allowModifyAppId} must be set to `true`
|
|
1076
|
+
*
|
|
1077
|
+
* **Important considerations:**
|
|
1078
|
+
* - Changing the App ID will affect which updates this device receives
|
|
1079
|
+
* - The new App ID must exist on your update server
|
|
1080
|
+
* - This is primarily for advanced use cases (multi-tenancy, environment switching)
|
|
1081
|
+
* - Most apps should use the config-based {@link PluginsConfig.CapacitorUpdater.appId} instead
|
|
1082
|
+
*
|
|
1083
|
+
* @param options {@link SetAppIdOptions} containing the new App ID string.
|
|
1084
|
+
* @returns {Promise<void>} Resolves when the App ID is successfully changed.
|
|
1085
|
+
* @throws {Error} If `allowModifyAppId` is false or the operation fails.
|
|
1086
|
+
* @since 7.14.0
|
|
1087
|
+
*/
|
|
1088
|
+
setAppId(options: SetAppIdOptions): Promise<void>;
|
|
432
1089
|
}
|
|
433
|
-
|
|
434
|
-
|
|
1090
|
+
/**
|
|
1091
|
+
* pending: The bundle is pending to be **SET** as the next bundle.
|
|
1092
|
+
* downloading: The bundle is being downloaded.
|
|
1093
|
+
* success: The bundle has been downloaded and is ready to be **SET** as the next bundle.
|
|
1094
|
+
* error: The bundle has failed to download.
|
|
1095
|
+
*/
|
|
1096
|
+
export type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';
|
|
1097
|
+
export type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';
|
|
435
1098
|
export interface NoNeedEvent {
|
|
436
1099
|
/**
|
|
437
1100
|
* Current status of download, between 0 and 100.
|
|
@@ -455,8 +1118,8 @@ export interface ChannelRes {
|
|
|
455
1118
|
* @since 4.7.0
|
|
456
1119
|
*/
|
|
457
1120
|
status: string;
|
|
458
|
-
error?:
|
|
459
|
-
message?:
|
|
1121
|
+
error?: string;
|
|
1122
|
+
message?: string;
|
|
460
1123
|
}
|
|
461
1124
|
export interface GetChannelRes {
|
|
462
1125
|
/**
|
|
@@ -465,11 +1128,45 @@ export interface GetChannelRes {
|
|
|
465
1128
|
* @since 4.8.0
|
|
466
1129
|
*/
|
|
467
1130
|
channel?: string;
|
|
468
|
-
error?:
|
|
469
|
-
message?:
|
|
1131
|
+
error?: string;
|
|
1132
|
+
message?: string;
|
|
470
1133
|
status?: string;
|
|
471
1134
|
allowSet?: boolean;
|
|
472
1135
|
}
|
|
1136
|
+
export interface ChannelInfo {
|
|
1137
|
+
/**
|
|
1138
|
+
* The channel ID
|
|
1139
|
+
*
|
|
1140
|
+
* @since 7.5.0
|
|
1141
|
+
*/
|
|
1142
|
+
id: string;
|
|
1143
|
+
/**
|
|
1144
|
+
* The channel name
|
|
1145
|
+
*
|
|
1146
|
+
* @since 7.5.0
|
|
1147
|
+
*/
|
|
1148
|
+
name: string;
|
|
1149
|
+
/**
|
|
1150
|
+
* Whether this is a public channel
|
|
1151
|
+
*
|
|
1152
|
+
* @since 7.5.0
|
|
1153
|
+
*/
|
|
1154
|
+
public: boolean;
|
|
1155
|
+
/**
|
|
1156
|
+
* Whether devices can self-assign to this channel
|
|
1157
|
+
*
|
|
1158
|
+
* @since 7.5.0
|
|
1159
|
+
*/
|
|
1160
|
+
allow_self_set: boolean;
|
|
1161
|
+
}
|
|
1162
|
+
export interface ListChannelsResult {
|
|
1163
|
+
/**
|
|
1164
|
+
* List of available channels
|
|
1165
|
+
*
|
|
1166
|
+
* @since 7.5.0
|
|
1167
|
+
*/
|
|
1168
|
+
channels: ChannelInfo[];
|
|
1169
|
+
}
|
|
473
1170
|
export interface DownloadEvent {
|
|
474
1171
|
/**
|
|
475
1172
|
* Current status of download, between 0 and 100.
|
|
@@ -481,12 +1178,19 @@ export interface DownloadEvent {
|
|
|
481
1178
|
}
|
|
482
1179
|
export interface MajorAvailableEvent {
|
|
483
1180
|
/**
|
|
484
|
-
* Emit when a
|
|
1181
|
+
* Emit when a breaking update is available.
|
|
485
1182
|
*
|
|
1183
|
+
* @deprecated Deprecated alias for {@link BreakingAvailableEvent}. Receives the same payload.
|
|
486
1184
|
* @since 4.0.0
|
|
487
1185
|
*/
|
|
488
1186
|
version: string;
|
|
489
1187
|
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Payload emitted by {@link CapacitorUpdaterPlugin.addListener} with `breakingAvailable`.
|
|
1190
|
+
*
|
|
1191
|
+
* @since 7.22.0
|
|
1192
|
+
*/
|
|
1193
|
+
export type BreakingAvailableEvent = MajorAvailableEvent;
|
|
490
1194
|
export interface DownloadFailedEvent {
|
|
491
1195
|
/**
|
|
492
1196
|
* Emit when a download fail.
|
|
@@ -520,6 +1224,11 @@ export interface AppReadyEvent {
|
|
|
520
1224
|
bundle: BundleInfo;
|
|
521
1225
|
status: string;
|
|
522
1226
|
}
|
|
1227
|
+
export interface ManifestEntry {
|
|
1228
|
+
file_name: string | null;
|
|
1229
|
+
file_hash: string | null;
|
|
1230
|
+
download_url: string | null;
|
|
1231
|
+
}
|
|
523
1232
|
export interface LatestVersion {
|
|
524
1233
|
/**
|
|
525
1234
|
* Result of getLatest method
|
|
@@ -527,12 +1236,29 @@ export interface LatestVersion {
|
|
|
527
1236
|
* @since 4.0.0
|
|
528
1237
|
*/
|
|
529
1238
|
version: string;
|
|
1239
|
+
/**
|
|
1240
|
+
* @since 6
|
|
1241
|
+
*/
|
|
1242
|
+
checksum?: string;
|
|
1243
|
+
/**
|
|
1244
|
+
* Indicates whether the update was flagged as breaking by the backend.
|
|
1245
|
+
*
|
|
1246
|
+
* @since 7.22.0
|
|
1247
|
+
*/
|
|
1248
|
+
breaking?: boolean;
|
|
1249
|
+
/**
|
|
1250
|
+
* @deprecated Use {@link LatestVersion.breaking} instead.
|
|
1251
|
+
*/
|
|
530
1252
|
major?: boolean;
|
|
531
1253
|
message?: string;
|
|
532
1254
|
sessionKey?: string;
|
|
533
1255
|
error?: string;
|
|
534
1256
|
old?: string;
|
|
535
1257
|
url?: string;
|
|
1258
|
+
/**
|
|
1259
|
+
* @since 6.1
|
|
1260
|
+
*/
|
|
1261
|
+
manifest?: ManifestEntry[];
|
|
536
1262
|
}
|
|
537
1263
|
export interface BundleInfo {
|
|
538
1264
|
id: string;
|
|
@@ -549,6 +1275,9 @@ export interface UnsetChannelOptions {
|
|
|
549
1275
|
triggerAutoUpdate?: boolean;
|
|
550
1276
|
}
|
|
551
1277
|
export interface SetCustomIdOptions {
|
|
1278
|
+
/**
|
|
1279
|
+
* Custom identifier to associate with the device. Use an empty string to clear any saved value.
|
|
1280
|
+
*/
|
|
552
1281
|
customId: string;
|
|
553
1282
|
}
|
|
554
1283
|
export interface DelayCondition {
|
|
@@ -559,6 +1288,15 @@ export interface DelayCondition {
|
|
|
559
1288
|
kind: DelayUntilNext;
|
|
560
1289
|
value?: string;
|
|
561
1290
|
}
|
|
1291
|
+
export interface GetLatestOptions {
|
|
1292
|
+
/**
|
|
1293
|
+
* The channel to get the latest version for
|
|
1294
|
+
* The channel must allow 'self_assign' for this to work
|
|
1295
|
+
* @since 6.8.0
|
|
1296
|
+
* @default undefined
|
|
1297
|
+
*/
|
|
1298
|
+
channel?: string;
|
|
1299
|
+
}
|
|
562
1300
|
export interface AppReadyResult {
|
|
563
1301
|
bundle: BundleInfo;
|
|
564
1302
|
}
|
|
@@ -571,6 +1309,10 @@ export interface StatsUrl {
|
|
|
571
1309
|
export interface ChannelUrl {
|
|
572
1310
|
url: string;
|
|
573
1311
|
}
|
|
1312
|
+
/**
|
|
1313
|
+
* This URL and versions are used to download the bundle from the server, If you use backend all information will be given by the method getLatest.
|
|
1314
|
+
* If you don't use backend, you need to provide the URL and version of the bundle. Checksum and sessionKey are required if you encrypted the bundle with the CLI command encrypt, you should receive them as result of the command.
|
|
1315
|
+
*/
|
|
574
1316
|
export interface DownloadOptions {
|
|
575
1317
|
/**
|
|
576
1318
|
* 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.)
|
|
@@ -580,8 +1322,24 @@ export interface DownloadOptions {
|
|
|
580
1322
|
* The version code/name of this bundle/version
|
|
581
1323
|
*/
|
|
582
1324
|
version: string;
|
|
1325
|
+
/**
|
|
1326
|
+
* The session key for the update, when the bundle is encrypted with a session key
|
|
1327
|
+
* @since 4.0.0
|
|
1328
|
+
* @default undefined
|
|
1329
|
+
*/
|
|
583
1330
|
sessionKey?: string;
|
|
1331
|
+
/**
|
|
1332
|
+
* The checksum for the update, it should be in sha256 and encrypted with private key if the bundle is encrypted
|
|
1333
|
+
* @since 4.0.0
|
|
1334
|
+
* @default undefined
|
|
1335
|
+
*/
|
|
584
1336
|
checksum?: string;
|
|
1337
|
+
/**
|
|
1338
|
+
* The manifest for multi-file downloads
|
|
1339
|
+
* @since 6.1.0
|
|
1340
|
+
* @default undefined
|
|
1341
|
+
*/
|
|
1342
|
+
manifest?: ManifestEntry[];
|
|
585
1343
|
}
|
|
586
1344
|
export interface BundleId {
|
|
587
1345
|
id: string;
|
|
@@ -592,6 +1350,14 @@ export interface BundleListResult {
|
|
|
592
1350
|
export interface ResetOptions {
|
|
593
1351
|
toLastSuccessful: boolean;
|
|
594
1352
|
}
|
|
1353
|
+
export interface ListOptions {
|
|
1354
|
+
/**
|
|
1355
|
+
* Whether to return the raw bundle list or the manifest. If true, the list will attempt to read the internal database instead of files on disk.
|
|
1356
|
+
* @since 6.14.0
|
|
1357
|
+
* @default false
|
|
1358
|
+
*/
|
|
1359
|
+
raw?: boolean;
|
|
1360
|
+
}
|
|
595
1361
|
export interface CurrentBundleResult {
|
|
596
1362
|
bundle: BundleInfo;
|
|
597
1363
|
native: string;
|
|
@@ -611,3 +1377,18 @@ export interface PluginVersion {
|
|
|
611
1377
|
export interface AutoUpdateEnabled {
|
|
612
1378
|
enabled: boolean;
|
|
613
1379
|
}
|
|
1380
|
+
export interface AutoUpdateAvailable {
|
|
1381
|
+
available: boolean;
|
|
1382
|
+
}
|
|
1383
|
+
export interface SetShakeMenuOptions {
|
|
1384
|
+
enabled: boolean;
|
|
1385
|
+
}
|
|
1386
|
+
export interface ShakeMenuEnabled {
|
|
1387
|
+
enabled: boolean;
|
|
1388
|
+
}
|
|
1389
|
+
export interface GetAppIdRes {
|
|
1390
|
+
appId: string;
|
|
1391
|
+
}
|
|
1392
|
+
export interface SetAppIdOptions {
|
|
1393
|
+
appId: string;
|
|
1394
|
+
}
|