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