mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-07 20:55:14 +08:00
feat: ts
This commit is contained in:
71
lib/type.ts
Normal file
71
lib/type.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
export interface ExpiredResult {
|
||||
upToDate?: false;
|
||||
expired: true;
|
||||
downloadUrl: string;
|
||||
}
|
||||
|
||||
export interface UpTodateResult {
|
||||
expired?: false;
|
||||
upToDate: true;
|
||||
paused?: 'app' | 'package';
|
||||
}
|
||||
|
||||
export interface UpdateAvailableResult {
|
||||
expired?: false;
|
||||
upToDate?: false;
|
||||
update: true;
|
||||
name: string; // version name
|
||||
hash: string;
|
||||
description: string;
|
||||
metaInfo: string;
|
||||
pdiffUrl: string;
|
||||
diffUrl?: string;
|
||||
updateUrl?: string;
|
||||
}
|
||||
|
||||
export type CheckResult =
|
||||
| ExpiredResult
|
||||
| UpTodateResult
|
||||
| UpdateAvailableResult
|
||||
| {};
|
||||
|
||||
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 UpdateEventsListener = ({
|
||||
type,
|
||||
data,
|
||||
}: {
|
||||
type: EventType;
|
||||
data: EventData;
|
||||
}) => void;
|
Reference in New Issue
Block a user