From 0f62af45456a81b949ce06a33ce10726d384d8dd Mon Sep 17 00:00:00 2001 From: martindonadieu Date: Sun, 26 Jun 2022 16:04:35 +0100 Subject: [PATCH] fix: definitions --- src/definitions.ts | 12 ++---------- src/web.ts | 16 ++++++---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/definitions.ts b/src/definitions.ts index 03c5e2584..e9cea1314 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -216,20 +216,12 @@ export interface CapacitorUpdaterPlugin { reload(): Promise; /** - * Skip updates in the next time the app goes into the background, only in auto-update + * Set delay to skip updates in the next time the app goes into the background * * @returns {Promise} an Promise resolved directly * @throws An error if the something went wrong */ - delayUpdate(): Promise; - - /** - * Allow update in the next time the app goes into the background, only in auto-update - * - * @returns {Promise} an Promise resolved directly - * @throws An error if the something went wrong - */ - cancelDelay(): Promise; + setDelay(options: {delay: boolean}): Promise; /** * Listen for download event in the App, let you know when the download is started, loading and finished diff --git a/src/web.ts b/src/web.ts index 4faede37a..5e5b29d51 100644 --- a/src/web.ts +++ b/src/web.ts @@ -2,7 +2,7 @@ import { WebPlugin } from '@capacitor/core'; import type { CapacitorUpdaterPlugin, VersionInfo } from './definitions'; -const VERSION_BUILTIN: VersionInfo = { status: 'success', version: '', downloaded: '1970-01-01T00:00:00.000Z', name: 'builtin' }; +const VERSION_BUILTIN: VersionInfo = { status: 'success', versionName: '', downloaded: '1970-01-01T00:00:00.000Z', folder: 'builtin' }; export class CapacitorUpdaterWeb extends WebPlugin @@ -11,7 +11,7 @@ export class CapacitorUpdaterWeb console.warn('Cannot download version in web', options); return VERSION_BUILTIN; } - async next(options: { version: string, versionName?: string }): Promise { + async next(options: { folder: string, versionName?: string }): Promise { console.warn('Cannot set next version in web', options); return VERSION_BUILTIN; } @@ -20,7 +20,7 @@ export class CapacitorUpdaterWeb console.warn('Cannot get isAutoUpdateEnabled version in web'); return { enabled: false }; } - async set(options: { version: string, versionName?: string }): Promise { + async set(options: { folder: string, versionName?: string }): Promise { console.warn('Cannot set version in web', options); return; } @@ -32,7 +32,7 @@ export class CapacitorUpdaterWeb console.warn('Cannot get version in web'); return { version: 'default'}; } - async delete(options: { version: string }): Promise { + async delete(options: { folder: string }): Promise { console.warn('Cannot delete version in web', options); } async list(): Promise<{ versions: VersionInfo[] }> { @@ -54,12 +54,8 @@ export class CapacitorUpdaterWeb console.warn('Cannot notify App Ready in web'); return VERSION_BUILTIN; } - async delayUpdate(): Promise { - console.warn('Cannot delay update in web'); - return; - } - async cancelDelay(): Promise { - console.warn('Cannot cancel delay update in web'); + async setDelay(options: { delay: boolean }): Promise { + console.warn('Cannot setDelay delay update in web', options); return; } }