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

50 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-02-19 18:20:21 +08:00
/**
* @format
* @flow strict-local
*/
'use strict';
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: () => {
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-02-20 13:03:12 +08:00
setLocalHashInfo(hash: string, info: string): void;
getLocalHashInfo(hash: string): Promise<string>;
2023-02-19 18:20:21 +08:00
setUuid(uuid: string): void;
2023-02-20 13:03:12 +08:00
setBlockUpdate(options: { reason: string, until: number }): void;
downloadPatchFromPpk(options: {
updateUrl: string,
2023-02-19 18:20:21 +08:00
hash: string,
2023-02-20 13:03:12 +08:00
originHash: string,
}): Promise<void>;
downloadPatchFromPackage(options: {
updateUrl: string,
hash: string,
}): Promise<void>;
downloadFullUpdate(options: {
updateUrl: string,
hash: string,
}): Promise<void>;
reloadUpdate(options: { hash: string }): void;
setNeedUpdate(options: { hash: string }): void;
2023-02-19 18:20:21 +08:00
markSuccess(): void;
2023-02-20 13:03:12 +08:00
downloadAndInstallApk(options: {
url: string,
target: string,
hash: string,
}): Promise<void>;
2023-02-19 18:20:21 +08:00
}
2023-02-20 13:03:12 +08:00
export default (TurboModuleRegistry.get<Spec>('Pushy'): ?Spec);