1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-12-19 04:05:08 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
sunnylqm
2019-11-16 00:31:30 +08:00
parent b489199572
commit ddc12186b0
60 changed files with 1142 additions and 1162 deletions

View File

@@ -1,14 +1,14 @@
import { NativeAppEventEmitter, NativeModules } from 'react-native';
const HotUpdate = NativeModules.HotUpdate || {};
const Pushy = NativeModules.Pushy || {};
const host = 'https://update.reactnative.cn/api';
export const downloadRootDir = HotUpdate.downloadRootDir;
export const packageVersion = HotUpdate.packageVersion;
export const currentVersion = HotUpdate.currentVersion;
export const isFirstTime = HotUpdate.isFirstTime;
export const isRolledBack = HotUpdate.isRolledBack;
export const buildTime = HotUpdate.buildTime;
export const downloadRootDir = Pushy.downloadRootDir;
export const packageVersion = Pushy.packageVersion;
export const currentVersion = Pushy.currentVersion;
export const isFirstTime = Pushy.isFirstTime;
export const isRolledBack = Pushy.isRolledBack;
export const buildTime = Pushy.buildTime;
/*
Return json:
@@ -69,18 +69,18 @@ export async function downloadUpdate(options) {
}
if (options.diffUrl) {
await HotUpdate.downloadPatchFromPpk({
await Pushy.downloadPatchFromPpk({
updateUrl: options.diffUrl,
hashName: options.hash,
originHashName: currentVersion,
});
} else if (options.pdiffUrl) {
await HotUpdate.downloadPatchFromPackage({
await Pushy.downloadPatchFromPackage({
updateUrl: options.pdiffUrl,
hashName: options.hash,
});
} else {
await HotUpdate.downloadUpdate({
await Pushy.downloadUpdate({
updateUrl: options.updateUrl,
hashName: options.hash,
});
@@ -90,19 +90,19 @@ export async function downloadUpdate(options) {
export function switchVersion(hash) {
assertRelease();
HotUpdate.reloadUpdate({ hashName: hash });
Pushy.reloadUpdate({ hashName: hash });
}
export function switchVersionLater(hash) {
assertRelease();
HotUpdate.setNeedUpdate({ hashName: hash });
Pushy.setNeedUpdate({ hashName: hash });
}
export function markSuccess() {
assertRelease();
HotUpdate.markSuccess();
Pushy.markSuccess();
}
NativeAppEventEmitter.addListener('RCTHotUpdateDownloadProgress', params => {});
NativeAppEventEmitter.addListener('RCTPushyDownloadProgress', params => {});
NativeAppEventEmitter.addListener('RCTHotUpdateUnzipProgress', params => {});
NativeAppEventEmitter.addListener('RCTPushyUnzipProgress', params => {});