Skip to content

Commit

Permalink
fix: definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Jun 26, 2022
1 parent 9e54db5 commit 0f62af4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
12 changes: 2 additions & 10 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,12 @@ export interface CapacitorUpdaterPlugin {
reload(): Promise<void>;

/**
* 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<void>} an Promise resolved directly
* @throws An error if the something went wrong
*/
delayUpdate(): Promise<void>;

/**
* Allow update in the next time the app goes into the background, only in auto-update
*
* @returns {Promise<void>} an Promise resolved directly
* @throws An error if the something went wrong
*/
cancelDelay(): Promise<void>;
setDelay(options: {delay: boolean}): Promise<void>;

/**
* Listen for download event in the App, let you know when the download is started, loading and finished
Expand Down
16 changes: 6 additions & 10 deletions src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<VersionInfo> {
async next(options: { folder: string, versionName?: string }): Promise<VersionInfo> {
console.warn('Cannot set next version in web', options);
return VERSION_BUILTIN;
}
Expand All @@ -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<void> {
async set(options: { folder: string, versionName?: string }): Promise<void> {
console.warn('Cannot set version in web', options);
return;
}
Expand All @@ -32,7 +32,7 @@ export class CapacitorUpdaterWeb
console.warn('Cannot get version in web');
return { version: 'default'};
}
async delete(options: { version: string }): Promise<void> {
async delete(options: { folder: string }): Promise<void> {
console.warn('Cannot delete version in web', options);
}
async list(): Promise<{ versions: VersionInfo[] }> {
Expand All @@ -54,12 +54,8 @@ export class CapacitorUpdaterWeb
console.warn('Cannot notify App Ready in web');
return VERSION_BUILTIN;
}
async delayUpdate(): Promise<void> {
console.warn('Cannot delay update in web');
return;
}
async cancelDelay(): Promise<void> {
console.warn('Cannot cancel delay update in web');
async setDelay(options: { delay: boolean }): Promise<void> {
console.warn('Cannot setDelay delay update in web', options);
return;
}
}

0 comments on commit 0f62af4

Please sign in to comment.