1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
react-native-pushy/lib/index.d.ts

80 lines
1.8 KiB
TypeScript
Raw Normal View History

2019-07-06 21:52:34 +08:00
export const downloadRootDir: string;
export const packageVersion: string;
export const currentVersion: string;
export const isFirstTime: boolean;
export const isRolledBack: boolean;
export interface ExpiredResult {
2020-10-06 23:40:51 +08:00
upToDate?: false;
2019-07-06 21:52:34 +08:00
expired: true;
downloadUrl: string;
}
export interface UpTodateResult {
2020-10-06 23:40:51 +08:00
expired?: false;
2019-07-06 21:52:34 +08:00
upToDate: true;
2021-10-04 12:27:54 +08:00
paused?: 'app' | 'package';
2019-07-06 21:52:34 +08:00
}
export interface UpdateAvailableResult {
2020-10-06 23:40:51 +08:00
expired?: false;
upToDate?: false;
2019-07-06 21:52:34 +08:00
update: true;
name: string; // version name
hash: string;
description: string;
metaInfo: string;
pdiffUrl: string;
2020-07-28 23:15:42 +08:00
diffUrl?: string;
2020-07-28 23:34:06 +08:00
}
2019-07-06 21:52:34 +08:00
2020-07-28 23:15:42 +08:00
export type CheckResult =
| ExpiredResult
| UpTodateResult
| UpdateAvailableResult;
2019-07-06 22:26:50 +08:00
export function checkUpdate(appkey: string): Promise<CheckResult>;
2019-07-06 21:52:34 +08:00
2020-07-28 23:15:42 +08:00
export function downloadUpdate(
2020-09-16 13:01:14 +08:00
info: UpdateAvailableResult,
eventListeners?: {
onDownloadProgress?: (data: ProgressData) => void;
},
2020-07-28 23:15:42 +08:00
): Promise<undefined | string>;
2019-07-06 21:52:34 +08:00
export function switchVersion(hash: string): void;
export function switchVersionLater(hash: string): void;
export function markSuccess(): void;
2020-07-28 23:15:42 +08:00
2020-10-06 23:40:51 +08:00
export function downloadAndInstallApk({
2020-09-27 22:16:27 +08:00
url,
onDownloadProgress,
}: {
url: string;
onDownloadProgress?: (data: ProgressData) => void;
2020-10-06 23:40:51 +08:00
}): Promise<void>;
2020-09-27 22:16:27 +08:00
2020-07-28 23:34:06 +08:00
/**
* @param {string} main - The main api endpoint
* @param {string[]} [backups] - The back up endpoints.
* @param {string} [backupQueryUrl] - An url that return a json file containing an array of endpoint.
* like: ["https://backup.api/1", "https://backup.api/2"]
*/
export function setCustomEndpoints({
main,
backups,
backupQueryUrl,
}: {
main: string;
2020-09-27 22:16:27 +08:00
backups?: string[];
2020-07-28 23:34:06 +08:00
backupQueryUrl?: string;
}): void;
2020-08-09 00:08:30 +08:00
2020-09-16 13:01:14 +08:00
interface ProgressData {
2020-09-24 22:44:37 +08:00
hash: string;
2020-08-09 00:08:30 +08:00
received: number;
total: number;
}