1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-08 10:15:14 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
Files
react-native-update/src/type.ts
2024-03-02 12:24:41 +08:00

77 lines
1.4 KiB
TypeScript

export interface CheckResult {
upToDate?: true;
expired?: true;
downloadUrl?: string;
update?: true;
name?: string; // version name
hash?: string;
description?: string;
metaInfo?: string;
pdiffUrl?: string;
pdiffUrls?: string[];
diffUrl?: string;
diffUrls?: string[];
updateUrl?: string;
updateUrls?: string[];
paused?: 'app' | 'package';
message?: string;
}
export interface ProgressData {
hash: string;
received: number;
total: number;
}
export type EventType =
| 'rollback'
| 'errorChecking'
| 'checking'
| 'downloading'
| 'errorUpdate'
| 'markSuccess'
| 'downloadingApk'
| 'rejectStoragePermission'
| 'errorStoragePermission'
| 'errowDownloadAndInstallApk';
export interface EventData {
currentVersion: string;
cInfo: {
pushy: string;
rn: string;
os: string;
uuid: string;
};
packageVersion: string;
buildTime: number;
message?: string;
rolledBackVersion?: string;
newVersion?: string;
[key: string]: any;
}
export type UpdateEventsLogger = ({
type,
data,
}: {
type: EventType;
data: EventData;
}) => void;
export interface PushyServerConfig {
main: string;
backups?: string[];
queryUrl?: string;
}
export interface PushyOptions {
appKey: string;
server?: PushyServerConfig;
logger?: UpdateEventsLogger;
useAlert?: boolean;
strategy?: 'onAppStart' | 'onAppResume' | 'both';
autoMarkSuccess?: boolean;
dismissErrorAfter?: number;
}