@capgo/capacitor-updater 5.7.3 → 5.7.7

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.
@@ -2,7 +2,7 @@ import type { PluginListenerHandle } from "@capacitor/core";
2
2
  declare module "@capacitor/cli" {
3
3
  interface PluginsConfig {
4
4
  /**
5
- * CapacitorUpdater can be configured with this options:
5
+ * CapacitorUpdater can be configured with these options:
6
6
  */
7
7
  CapacitorUpdater?: {
8
8
  /**
@@ -173,438 +173,441 @@ declare module "@capacitor/cli" {
173
173
  };
174
174
  }
175
175
  }
176
- export interface noNeedEvent {
177
- /**
178
- * Current status of download, between 0 and 100.
179
- *
180
- * @since 4.0.0
181
- */
182
- bundle: BundleInfo;
183
- }
184
- export interface updateAvailableEvent {
185
- /**
186
- * Current status of download, between 0 and 100.
187
- *
188
- * @since 4.0.0
189
- */
190
- bundle: BundleInfo;
191
- }
192
- export interface channelRes {
193
- /**
194
- * Current status of set channel
195
- *
196
- * @since 4.7.0
197
- */
198
- status: string;
199
- error?: any;
200
- message?: any;
201
- }
202
- export interface getChannelRes {
203
- /**
204
- * Current status of get channel
205
- *
206
- * @since 4.8.0
207
- */
208
- channel?: string;
209
- error?: any;
210
- message?: any;
211
- status?: string;
212
- allowSet?: boolean;
213
- }
214
- export interface DownloadEvent {
215
- /**
216
- * Current status of download, between 0 and 100.
217
- *
218
- * @since 4.0.0
219
- */
220
- percent: number;
221
- bundle: BundleInfo;
222
- }
223
- export interface MajorAvailableEvent {
224
- /**
225
- * Emit when a new major bundle is available.
226
- *
227
- * @since 4.0.0
228
- */
229
- version: string;
230
- }
231
- export interface DownloadFailedEvent {
232
- /**
233
- * Emit when a download fail.
234
- *
235
- * @since 4.0.0
236
- */
237
- version: string;
238
- }
239
- export interface DownloadCompleteEvent {
240
- /**
241
- * Emit when a new update is available.
242
- *
243
- * @since 4.0.0
244
- */
245
- bundle: BundleInfo;
246
- }
247
- export interface UpdateFailedEvent {
248
- /**
249
- * Emit when a update failed to install.
250
- *
251
- * @since 4.0.0
252
- */
253
- bundle: BundleInfo;
254
- }
255
- export interface AppReadyEvent {
256
- /**
257
- * Emit when a app is ready to use.
258
- *
259
- * @since 5.2.0
260
- */
261
- bundle: BundleInfo;
262
- status: string;
263
- }
264
- export interface latestVersion {
265
- /**
266
- * Res of getLatest method
267
- *
268
- * @since 4.0.0
269
- */
270
- version: string;
271
- major?: boolean;
272
- message?: string;
273
- sessionKey?: string;
274
- error?: string;
275
- old?: string;
276
- url?: string;
277
- }
278
- export interface BundleInfo {
279
- id: string;
280
- version: string;
281
- downloaded: string;
282
- checksum: string;
283
- status: BundleStatus;
284
- }
285
- export interface SetChannelOptions {
286
- channel: string;
287
- triggerAutoUpdate?: boolean;
288
- }
289
- export interface UnsetChannelOptions {
290
- triggerAutoUpdate?: boolean;
291
- }
292
- export interface SetCustomIdOptions {
293
- customId: string;
294
- }
295
- export interface DelayCondition {
296
- /**
297
- * Set up delay conditions in setMultiDelay
298
- * @param value is useless for @param kind "kill", optional for "background" (default value: "0") and required for "nativeVersion" and "date"
299
- */
300
- kind: DelayUntilNext;
301
- value?: string;
302
- }
303
- export type BundleStatus = "success" | "error" | "pending" | "downloading";
304
- export type DelayUntilNext = "background" | "kill" | "nativeVersion" | "date";
305
- export type DownloadChangeListener = (state: DownloadEvent) => void;
306
- export type NoNeedListener = (state: noNeedEvent) => void;
307
- export type UpdateAvailabledListener = (state: updateAvailableEvent) => void;
308
- export type DownloadFailedListener = (state: DownloadFailedEvent) => void;
309
- export type DownloadCompleteListener = (state: DownloadCompleteEvent) => void;
310
- export type MajorAvailableListener = (state: MajorAvailableEvent) => void;
311
- export type UpdateFailedListener = (state: UpdateFailedEvent) => void;
312
- export type AppReloadedListener = (state: void) => void;
313
- export type AppReadyListener = (state: AppReadyEvent) => void;
314
176
  export interface CapacitorUpdaterPlugin {
315
177
  /**
316
178
  * Notify Capacitor Updater that the current bundle is working (a rollback will occur if this method is not called on every app launch)
317
179
  * By default this method should be called in the first 10 sec after app launch, otherwise a rollback will occur.
318
180
  * Change this behaviour with {@link appReadyTimeout}
319
181
  *
320
- * @returns {Promise<{ bundle: BundleInfo }>} an Promise resolved directly
321
- * @throws An error if something went wrong
182
+ * @returns {Promise<AppReadyResult>} an Promise resolved directly
183
+ * @throws {Error}
322
184
  */
323
- notifyAppReady(): Promise<{
324
- bundle: BundleInfo;
325
- }>;
185
+ notifyAppReady(): Promise<AppReadyResult>;
326
186
  /**
327
187
  * Set the updateUrl for the app, this will be used to check for updates.
328
188
  *
329
- * @returns {Promise<void>} an empty Promise
330
- * @param url The URL to use for checking for updates.
331
- * @throws An error if the something went wrong
189
+ * @param options contains the URL to use for checking for updates.
190
+ * @returns {Promise<void>}
191
+ * @throws {Error}
332
192
  * @since 5.4.0
333
193
  */
334
- setUpdateUrl(options: {
335
- url: string;
336
- }): Promise<void>;
194
+ setUpdateUrl(options: UpdateUrl): Promise<void>;
337
195
  /**
338
- * Set the statsUrl for the app, this will be used to send statistics.
196
+ * Set the statsUrl for the app, this will be used to send statistics. Passing an empty string will disable statistics gathering.
339
197
  *
340
- * @returns {Promise<void>} an empty Promise
341
- * @param url The URL to use for sending statistics.
342
- * @throws An error if the something went wrong
198
+ * @param options contains the URL to use for sending statistics.
199
+ * @returns {Promise<void>}
200
+ * @throws {Error}
343
201
  * @since 5.4.0
344
202
  */
345
- setStatsUrl(options: {
346
- url: string;
347
- }): Promise<void>;
203
+ setStatsUrl(options: StatsUrl): Promise<void>;
348
204
  /**
349
205
  * Set the channelUrl for the app, this will be used to set the channel.
350
206
  *
351
- * @returns {Promise<void>} an empty Promise
352
- * @param url The URL to use for setting the channel.
353
- * @throws An error if the something went wrong
207
+ * @param options contains the URL to use for setting the channel.
208
+ * @returns {Promise<void>}
209
+ * @throws {Error}
354
210
  * @since 5.4.0
355
211
  */
356
- setChannelUrl(options: {
357
- url: string;
358
- }): Promise<void>;
212
+ setChannelUrl(options: ChannelUrl): Promise<void>;
359
213
  /**
360
214
  * Download a new bundle from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
361
215
  *
216
+ * @example const bundle = await CapacitorUpdater.download({ url: `https://example.com/versions/${version}/dist.zip`, version });
362
217
  * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle.
363
- * @param url 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.)
364
- * @param version set the version code/name of this bundle/version
365
- * @example https://example.com/versions/{version}/dist.zip
218
+ * @param options The {@link DownloadOptions} for downloading a new bundle zip.
366
219
  */
367
- download(options: {
368
- url: string;
369
- version: string;
370
- sessionKey?: string;
371
- checksum?: string;
372
- }): Promise<BundleInfo>;
220
+ download(options: DownloadOptions): Promise<BundleInfo>;
373
221
  /**
374
222
  * Set the next bundle to be used when the app is reloaded.
375
223
  *
224
+ * @param options Contains the ID of the next Bundle to set on next app launch. {@link BundleInfo.id}
376
225
  * @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle id.
377
- * @param id The bundle id to set as current, next time the app is reloaded. See {@link BundleInfo.id}
378
- * @throws An error if there are is no index.html file inside the bundle folder.
226
+ * @throws {Error} When there is no index.html file inside the bundle folder.
379
227
  */
380
- next(options: {
381
- id: string;
382
- }): Promise<BundleInfo>;
228
+ next(options: BundleId): Promise<BundleInfo>;
383
229
  /**
384
230
  * Set the current bundle and immediately reloads the app.
385
231
  *
386
- * @param id The bundle id to set as current. See {@link BundleInfo.id}
387
- * @returns {Promise<Void>} An empty promise.
388
- * @throws An error if there are is no index.html file inside the bundle folder.
232
+ * @param options A {@link BundleId} object containing the new bundle id to set as current.
233
+ * @returns {Promise<void>}
234
+ * @throws {Error} When there are is no index.html file inside the bundle folder.
389
235
  */
390
- set(options: {
391
- id: string;
392
- }): Promise<void>;
236
+ set(options: BundleId): Promise<void>;
393
237
  /**
394
- * Delete bundle in storage
238
+ * Deletes the specified bundle from the native app storage. Use with {@link list} to get the stored Bundle IDs.
395
239
  *
396
- * @returns {Promise<void>} an empty Promise when the bundle is deleted
397
- * @param id The bundle id to delete (note, this is the bundle id, NOT the version name)
398
- * @throws An error if the something went wrong
240
+ * @param options A {@link BundleId} object containing the ID of a bundle to delete (note, this is the bundle id, NOT the version name)
241
+ * @returns {Promise<void>} When the bundle is deleted
242
+ * @throws {Error}
399
243
  */
400
- delete(options: {
401
- id: string;
402
- }): Promise<void>;
244
+ delete(options: BundleId): Promise<void>;
403
245
  /**
404
246
  * Get all locally downloaded bundles in your app
405
247
  *
406
- * @returns {Promise<{bundles: BundleInfo[]}>} an Promise witht the bundles list
407
- * @throws An error if the something went wrong
248
+ * @returns {Promise<BundleListResult>} A Promise containing the {@link BundleListResult.bundles}
249
+ * @throws {Error}
408
250
  */
409
- list(): Promise<{
410
- bundles: BundleInfo[];
411
- }>;
251
+ list(): Promise<BundleListResult>;
412
252
  /**
413
- * Set the `builtin` bundle (the one sent to Apple store / Google play store ) as current bundle
253
+ * Reset the app to the `builtin` bundle (the one sent to Apple App Store / Google Play Store ) or the last successfully loaded bundle.
414
254
  *
415
- * @returns {Promise<void>} an empty Promise
416
- * @param toLastSuccessful [false] if yes it reset to to the last successfully loaded bundle instead of `builtin`
417
- * @throws An error if the something went wrong
255
+ * @param options Containing {@link ResetOptions.toLastSuccessful}, `true` resets to the builtin bundle and `false` will reset to the last successfully loaded bundle.
256
+ * @returns {Promise<void>}
257
+ * @throws {Error}
418
258
  */
419
- reset(options?: {
420
- toLastSuccessful?: boolean;
421
- }): Promise<void>;
259
+ reset(options?: ResetOptions): Promise<void>;
422
260
  /**
423
- * Get the current bundle, if none are set it returns `builtin`, currentNative is the original bundle installed on the device
261
+ * Get the current bundle, if none are set it returns `builtin`. currentNative is the original bundle installed on the device
424
262
  *
425
- * @returns {Promise<{ bundle: BundleInfo, native: string }>} an Promise with the current bundle info
426
- * @throws An error if the something went wrong
263
+ * @returns {Promise<CurrentBundleResult>} A Promise evaluating to the {@link CurrentBundleResult}
264
+ * @throws {Error}
427
265
  */
428
- current(): Promise<{
429
- bundle: BundleInfo;
430
- native: string;
431
- }>;
266
+ current(): Promise<CurrentBundleResult>;
432
267
  /**
433
268
  * Reload the view
434
269
  *
435
- * @returns {Promise<void>} an Promise resolved when the view is reloaded
436
- * @throws An error if the something went wrong
270
+ * @returns {Promise<void>} A Promise which is resolved when the view is reloaded
271
+ * @throws {Error}
437
272
  */
438
273
  reload(): Promise<void>;
439
274
  /**
440
- * Set DelayCondition, skip updates until one of the conditions is met
441
- *
442
- * @returns {Promise<void>} an Promise resolved directly
443
- * @param options are the {@link DelayCondition} list to set
275
+ * Sets a {@link DelayCondition} array containing conditions that the Plugin will use to determine when to install updates.
444
276
  *
445
277
  * @example
446
- * setMultiDelay({ delayConditions: [{ kind: 'kill' }, { kind: 'background', value: '300000' }] })
447
- * // installs the update after the user kills the app or after a background of 300000 ms (5 minutes)
448
- *
278
+ * // Install the update after the user kills the app or after a background of 300000 ms (5 minutes)
279
+ * await CapacitorUpdater.setMultiDelay({ delayConditions: [{ kind: 'kill' }, { kind: 'background', value: '300000' }] })
449
280
  * @example
450
- * setMultiDelay({ delayConditions: [{ kind: 'date', value: '2022-09-14T06:14:11.920Z' }] })
451
- * // installs the update after the specific iso8601 date is expired
452
- *
281
+ * // Install the update after the specific iso8601 date is expired
282
+ * await CapacitorUpdater.setMultiDelay({ delayConditions: [{ kind: 'date', value: '2022-09-14T06:14:11.920Z' }] })
453
283
  * @example
454
- * setMultiDelay({ delayConditions: [{ kind: 'background' }] })
455
- * // installs the update after the the first background (default behaviour without setting delay)
456
- *
457
- * @throws An error if the something went wrong
284
+ * // Install the update after the first background (default behaviour without setting delay)
285
+ * await CapacitorUpdater.setMultiDelay({ delayConditions: [{ kind: 'background' }] })
286
+ * @param options Containing the {@link MultiDelayConditions} array of conditions to set
287
+ * @returns {Promise<void>}
288
+ * @throws {Error}
458
289
  * @since 4.3.0
459
290
  */
460
- setMultiDelay(options: {
461
- delayConditions: DelayCondition[];
462
- }): Promise<void>;
291
+ setMultiDelay(options: MultiDelayConditions): Promise<void>;
463
292
  /**
464
- * Cancel delay to updates as usual
293
+ * Cancels a {@link DelayCondition} to process an update immediately.
465
294
  *
466
- * @returns {Promise<void>} an Promise resolved directly
467
- * @throws An error if the something went wrong
295
+ * @returns {Promise<void>}
296
+ * @throws {Error}
468
297
  * @since 4.0.0
469
298
  */
470
299
  cancelDelay(): Promise<void>;
471
300
  /**
472
301
  * Get Latest bundle available from update Url
473
302
  *
474
- * @returns {Promise<latestVersion>} an Promise resolved when url is loaded
475
- * @throws An error if the something went wrong
303
+ * @returns {Promise<LatestVersion>} A Promise resolved when url is loaded
304
+ * @throws {Error}
476
305
  * @since 4.0.0
477
306
  */
478
- getLatest(): Promise<latestVersion>;
307
+ getLatest(): Promise<LatestVersion>;
479
308
  /**
480
- * Set Channel for this device, the channel have to allow self assignement to make this work
481
- * Do not use this method to set the channel at boot when autoUpdate is enabled, this method is made to set the channel after the app is ready when user click on a button for example
309
+ * Sets the channel for this device. The channel has to allow for self assignment for this to work.
310
+ * Do not use this method to set the channel at boot when `autoUpdate` is enabled in the {@link PluginsConfig}.
311
+ * This method is to set the channel after the app is ready.
482
312
  *
483
- * @returns {Promise<channelRes>} an Promise resolved when channel is set
484
- * @param options is the {@link SetChannelOptions} channel to set
485
- * @throws An error if the something went wrong
313
+ * @param options Is the {@link SetChannelOptions} channel to set
314
+ * @returns {Promise<ChannelRes>} A Promise which is resolved when the new channel is set
315
+ * @throws {Error}
486
316
  * @since 4.7.0
487
317
  */
488
- setChannel(options: SetChannelOptions): Promise<channelRes>;
318
+ setChannel(options: SetChannelOptions): Promise<ChannelRes>;
489
319
  /**
490
- * Unset Channel for this device, the device will return to the default channel
320
+ * Unset the channel for this device. The device will then return to the default channel
491
321
  *
492
- * @returns {Promise<channelRes>} an Promise resolved when channel is set
493
- * @throws An error if the something went wrong
322
+ * @returns {Promise<ChannelRes>} A Promise resolved when channel is set
323
+ * @throws {Error}
494
324
  * @since 4.7.0
495
325
  */
496
326
  unsetChannel(options: UnsetChannelOptions): Promise<void>;
497
327
  /**
498
- * get Channel for this device
328
+ * Get the channel for this device
499
329
  *
500
- * @returns {Promise<channelRes>} an Promise resolved with channel info
501
- * @throws An error if the something went wrong
330
+ * @returns {Promise<ChannelRes>} A Promise that resolves with the channel info
331
+ * @throws {Error}
502
332
  * @since 4.8.0
503
333
  */
504
- getChannel(): Promise<getChannelRes>;
334
+ getChannel(): Promise<GetChannelRes>;
505
335
  /**
506
- * Set Channel for this device
336
+ * Set a custom ID for this device
507
337
  *
508
- * @returns {Promise<void>} an Promise resolved instantly
509
338
  * @param options is the {@link SetCustomIdOptions} customId to set
510
- * @throws An error if the something went wrong
339
+ * @returns {Promise<void>} an Promise resolved instantly
340
+ * @throws {Error}
511
341
  * @since 4.9.0
512
342
  */
513
343
  setCustomId(options: SetCustomIdOptions): Promise<void>;
514
344
  /**
515
- * Listen for download event in the App, let you know when the download is started, loading and finished, with a percent value
345
+ * Get the native app version or the builtin version if set in config
346
+ *
347
+ * @returns {Promise<BuiltinVersion>} A Promise with version for this device
348
+ * @since 5.2.0
349
+ */
350
+ getBuiltinVersion(): Promise<BuiltinVersion>;
351
+ /**
352
+ * Get unique ID used to identify device (sent to auto update server)
353
+ *
354
+ * @returns {Promise<DeviceId>} A Promise with id for this device
355
+ * @throws {Error}
356
+ */
357
+ getDeviceId(): Promise<DeviceId>;
358
+ /**
359
+ * Get the native Capacitor Updater plugin version (sent to auto update server)
360
+ *
361
+ * @returns {Promise<PluginVersion>} A Promise with Plugin version
362
+ * @throws {Error}
363
+ */
364
+ getPluginVersion(): Promise<PluginVersion>;
365
+ /**
366
+ * Get the state of auto update config.
367
+ *
368
+ * @returns {Promise<AutoUpdateEnabled>} The status for auto update. Evaluates to `false` in manual mode.
369
+ * @throws {Error}
370
+ */
371
+ isAutoUpdateEnabled(): Promise<AutoUpdateEnabled>;
372
+ /**
373
+ * Remove all listeners for this plugin.
374
+ *
375
+ * @since 1.0.0
376
+ */
377
+ removeAllListeners(): Promise<void>;
378
+ /**
379
+ * Listen for bundle download event in the App. Fires once a download has started, during downloading and when finished.
516
380
  *
517
381
  * @since 2.0.11
518
382
  */
519
- addListener(eventName: "download", listenerFunc: DownloadChangeListener): Promise<PluginListenerHandle> & PluginListenerHandle;
383
+ addListener(eventName: "download", listenerFunc: (state: DownloadEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
520
384
  /**
521
- * Listen for no need to update event, usefull when you want force check every time the app is launched
385
+ * Listen for no need to update event, useful when you want force check every time the app is launched
522
386
  *
523
387
  * @since 4.0.0
524
388
  */
525
- addListener(eventName: "noNeedUpdate", listenerFunc: NoNeedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
389
+ addListener(eventName: "noNeedUpdate", listenerFunc: (state: NoNeedEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
526
390
  /**
527
- * Listen for availbale update event, usefull when you want to force check every time the app is launched
391
+ * Listen for available update event, useful when you want to force check every time the app is launched
528
392
  *
529
393
  * @since 4.0.0
530
394
  */
531
- addListener(eventName: "updateAvailable", listenerFunc: UpdateAvailabledListener): Promise<PluginListenerHandle> & PluginListenerHandle;
395
+ addListener(eventName: "updateAvailable", listenerFunc: (state: UpdateAvailableEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
532
396
  /**
533
- * Listen for download event in the App, let you know when the download is started, loading and finished
397
+ * Listen for downloadComplete events.
534
398
  *
535
399
  * @since 4.0.0
536
400
  */
537
- addListener(eventName: "downloadComplete", listenerFunc: DownloadCompleteListener): Promise<PluginListenerHandle> & PluginListenerHandle;
401
+ addListener(eventName: "downloadComplete", listenerFunc: (state: DownloadCompleteEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
538
402
  /**
539
403
  * Listen for Major update event in the App, let you know when major update is blocked by setting disableAutoUpdateBreaking
540
404
  *
541
405
  * @since 2.3.0
542
406
  */
543
- addListener(eventName: "majorAvailable", listenerFunc: MajorAvailableListener): Promise<PluginListenerHandle> & PluginListenerHandle;
407
+ addListener(eventName: "majorAvailable", listenerFunc: (state: MajorAvailableEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
544
408
  /**
545
409
  * Listen for update fail event in the App, let you know when update has fail to install at next app start
546
410
  *
547
411
  * @since 2.3.0
548
412
  */
549
- addListener(eventName: "updateFailed", listenerFunc: UpdateFailedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
413
+ addListener(eventName: "updateFailed", listenerFunc: (state: UpdateFailedEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
550
414
  /**
551
- * Listen for download fail event in the App, let you know when download has fail finished
415
+ * Listen for download fail event in the App, let you know when a bundle download has failed
552
416
  *
553
417
  * @since 4.0.0
554
418
  */
555
- addListener(eventName: "downloadFailed", listenerFunc: DownloadFailedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
419
+ addListener(eventName: "downloadFailed", listenerFunc: (state: DownloadFailedEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
556
420
  /**
557
- * Listen for reload event in the App, let you know when reload has happend
421
+ * Listen for reload event in the App, let you know when reload has happened
558
422
  *
559
423
  * @since 4.3.0
560
424
  */
561
- addListener(eventName: "appReloaded", listenerFunc: AppReloadedListener): Promise<PluginListenerHandle> & PluginListenerHandle;
425
+ addListener(eventName: "appReloaded", listenerFunc: () => void): Promise<PluginListenerHandle> & PluginListenerHandle;
562
426
  /**
563
427
  * Listen for app ready event in the App, let you know when app is ready to use
564
428
  *
565
429
  * @since 5.1.0
566
430
  */
567
- addListener(eventName: "appReady", listenerFunc: AppReadyListener): Promise<PluginListenerHandle> & PluginListenerHandle;
431
+ addListener(eventName: "appReady", listenerFunc: (state: AppReadyEvent) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
432
+ }
433
+ export type BundleStatus = "success" | "error" | "pending" | "downloading";
434
+ export type DelayUntilNext = "background" | "kill" | "nativeVersion" | "date";
435
+ export interface NoNeedEvent {
568
436
  /**
569
- * Get the native app version or the builtin version if set in config
437
+ * Current status of download, between 0 and 100.
570
438
  *
571
- * @returns {Promise<{ version: string }>} an Promise with version for this device
572
- * @since 5.2.0
439
+ * @since 4.0.0
573
440
  */
574
- getBuiltinVersion(): Promise<{
575
- version: string;
576
- }>;
441
+ bundle: BundleInfo;
442
+ }
443
+ export interface UpdateAvailableEvent {
577
444
  /**
578
- * Get unique ID used to identify device (sent to auto update server)
445
+ * Current status of download, between 0 and 100.
579
446
  *
580
- * @returns {Promise<{ deviceId: string }>} an Promise with id for this device
581
- * @throws An error if the something went wrong
447
+ * @since 4.0.0
582
448
  */
583
- getDeviceId(): Promise<{
584
- deviceId: string;
585
- }>;
449
+ bundle: BundleInfo;
450
+ }
451
+ export interface ChannelRes {
586
452
  /**
587
- * Get the native Capacitor Updater plugin version (sent to auto update server)
453
+ * Current status of set channel
588
454
  *
589
- * @returns {Promise<{ id: string }>} an Promise with version for this device
590
- * @throws An error if the something went wrong
455
+ * @since 4.7.0
591
456
  */
592
- getPluginVersion(): Promise<{
593
- version: string;
594
- }>;
457
+ status: string;
458
+ error?: any;
459
+ message?: any;
460
+ }
461
+ export interface GetChannelRes {
595
462
  /**
596
- * Get the state of auto update config. This will return `false` in manual mode.
463
+ * Current status of get channel
597
464
  *
598
- * @returns {Promise<{enabled: boolean}>} The status for auto update.
599
- * @throws An error if the something went wrong
465
+ * @since 4.8.0
600
466
  */
601
- isAutoUpdateEnabled(): Promise<{
602
- enabled: boolean;
603
- }>;
467
+ channel?: string;
468
+ error?: any;
469
+ message?: any;
470
+ status?: string;
471
+ allowSet?: boolean;
472
+ }
473
+ export interface DownloadEvent {
604
474
  /**
605
- * Remove all listeners for this plugin.
475
+ * Current status of download, between 0 and 100.
606
476
  *
607
- * @since 1.0.0
477
+ * @since 4.0.0
608
478
  */
609
- removeAllListeners(): Promise<void>;
479
+ percent: number;
480
+ bundle: BundleInfo;
481
+ }
482
+ export interface MajorAvailableEvent {
483
+ /**
484
+ * Emit when a new major bundle is available.
485
+ *
486
+ * @since 4.0.0
487
+ */
488
+ version: string;
489
+ }
490
+ export interface DownloadFailedEvent {
491
+ /**
492
+ * Emit when a download fail.
493
+ *
494
+ * @since 4.0.0
495
+ */
496
+ version: string;
497
+ }
498
+ export interface DownloadCompleteEvent {
499
+ /**
500
+ * Emit when a new update is available.
501
+ *
502
+ * @since 4.0.0
503
+ */
504
+ bundle: BundleInfo;
505
+ }
506
+ export interface UpdateFailedEvent {
507
+ /**
508
+ * Emit when a update failed to install.
509
+ *
510
+ * @since 4.0.0
511
+ */
512
+ bundle: BundleInfo;
513
+ }
514
+ export interface AppReadyEvent {
515
+ /**
516
+ * Emitted when the app is ready to use.
517
+ *
518
+ * @since 5.2.0
519
+ */
520
+ bundle: BundleInfo;
521
+ status: string;
522
+ }
523
+ export interface LatestVersion {
524
+ /**
525
+ * Result of getLatest method
526
+ *
527
+ * @since 4.0.0
528
+ */
529
+ version: string;
530
+ major?: boolean;
531
+ message?: string;
532
+ sessionKey?: string;
533
+ error?: string;
534
+ old?: string;
535
+ url?: string;
536
+ }
537
+ export interface BundleInfo {
538
+ id: string;
539
+ version: string;
540
+ downloaded: string;
541
+ checksum: string;
542
+ status: BundleStatus;
543
+ }
544
+ export interface SetChannelOptions {
545
+ channel: string;
546
+ triggerAutoUpdate?: boolean;
547
+ }
548
+ export interface UnsetChannelOptions {
549
+ triggerAutoUpdate?: boolean;
550
+ }
551
+ export interface SetCustomIdOptions {
552
+ customId: string;
553
+ }
554
+ export interface DelayCondition {
555
+ /**
556
+ * Set up delay conditions in setMultiDelay
557
+ * @param value is useless for @param kind "kill", optional for "background" (default value: "0") and required for "nativeVersion" and "date"
558
+ */
559
+ kind: DelayUntilNext;
560
+ value?: string;
561
+ }
562
+ export interface AppReadyResult {
563
+ bundle: BundleInfo;
564
+ }
565
+ export interface UpdateUrl {
566
+ url: string;
567
+ }
568
+ export interface StatsUrl {
569
+ url: string;
570
+ }
571
+ export interface ChannelUrl {
572
+ url: string;
573
+ }
574
+ export interface DownloadOptions {
575
+ /**
576
+ * 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.)
577
+ */
578
+ url: string;
579
+ /**
580
+ * The version code/name of this bundle/version
581
+ */
582
+ version: string;
583
+ sessionKey?: string;
584
+ checksum?: string;
585
+ }
586
+ export interface BundleId {
587
+ id: string;
588
+ }
589
+ export interface BundleListResult {
590
+ bundles: BundleInfo[];
591
+ }
592
+ export interface ResetOptions {
593
+ toLastSuccessful: boolean;
594
+ }
595
+ export interface CurrentBundleResult {
596
+ bundle: BundleInfo;
597
+ native: string;
598
+ }
599
+ export interface MultiDelayConditions {
600
+ delayConditions: DelayCondition[];
601
+ }
602
+ export interface BuiltinVersion {
603
+ version: string;
604
+ }
605
+ export interface DeviceId {
606
+ deviceId: string;
607
+ }
608
+ export interface PluginVersion {
609
+ version: string;
610
+ }
611
+ export interface AutoUpdateEnabled {
612
+ enabled: boolean;
610
613
  }