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

46 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-02-20 13:03:12 +08:00
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
import { TurboModuleRegistry } from 'react-native';
2023-02-19 18:20:21 +08:00
export interface Spec extends TurboModule {
2023-02-20 13:03:12 +08:00
getConstants: () => {
2023-09-02 22:35:45 +08:00
downloadRootDir: string;
packageVersion: string;
currentVersion: string;
isFirstTime: boolean;
rolledBackVersion: string;
buildTime: string;
blockUpdate: Object;
uuid: string;
isUsingBundleUrl: boolean;
2023-02-19 18:20:21 +08:00
};
2023-03-15 23:27:25 +08:00
setLocalHashInfo(hash: string, info: string): Promise<void>;
2023-02-20 13:03:12 +08:00
getLocalHashInfo(hash: string): Promise<string>;
2023-03-15 23:27:25 +08:00
setUuid(uuid: string): Promise<void>;
2023-09-02 22:35:45 +08:00
setBlockUpdate(options: { reason: string; until: number }): Promise<void>;
2023-03-15 23:27:25 +08:00
reloadUpdate(options: { hash: string }): Promise<void>;
setNeedUpdate(options: { hash: string }): Promise<void>;
markSuccess(): Promise<void>;
2023-02-20 13:03:12 +08:00
downloadPatchFromPpk(options: {
2023-09-02 22:35:45 +08:00
updateUrl: string;
hash: string;
originHash: string;
2023-02-20 13:03:12 +08:00
}): Promise<void>;
downloadPatchFromPackage(options: {
2023-09-02 22:35:45 +08:00
updateUrl: string;
hash: string;
2023-02-20 13:03:12 +08:00
}): Promise<void>;
downloadFullUpdate(options: {
2023-09-02 22:35:45 +08:00
updateUrl: string;
hash: string;
2023-02-20 13:03:12 +08:00
}): Promise<void>;
downloadAndInstallApk(options: {
2023-09-02 22:35:45 +08:00
url: string;
target: string;
hash: string;
2023-02-20 13:03:12 +08:00
}): Promise<void>;
2023-02-20 14:36:08 +08:00
addListener(eventName: string): void;
removeListeners(count: number): void;
2023-02-19 18:20:21 +08:00
}
2023-09-02 22:35:45 +08:00
export default TurboModuleRegistry.get<Spec>('Pushy') as Spec | null;