1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 13:01:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Compare commits

...

4 Commits

Author SHA1 Message Date
sunnylqm
b747b1f356 v9.1.4 2023-10-30 22:58:41 +08:00
sunnylqm
7752581470 chore: throttle switchversion 2023-10-30 22:58:09 +08:00
sunnylqm
33eb89d2a7 v9.1.3 2023-10-28 18:28:54 +08:00
sunnylqm
d111bf5a9c chore: rename onPushyEvents 2023-10-28 18:28:23 +08:00
4 changed files with 10 additions and 8 deletions

View File

@@ -15,4 +15,4 @@ export const downloadAndInstallApk = noop;
export const setCustomEndpoints = noop;
export const getCurrentVersionInfo = noop;
export const simpleUpdate = (app) => app;
export const onEvents = noop;
export const onPushyEvents = noop;

View File

@@ -78,7 +78,7 @@ if (!uuid) {
const noop = () => {};
let reporter: UpdateEventsListener = noop;
export function onEvents(customReporter: UpdateEventsListener) {
export function onPushyEvents(customReporter: UpdateEventsListener) {
reporter = customReporter;
if (isRolledBack) {
report({
@@ -322,10 +322,12 @@ function assertHash(hash: string) {
return true;
}
let applyingUpdate = false;
export function switchVersion(hash: string) {
assertRelease();
if (assertHash(hash)) {
if (assertHash(hash) && !applyingUpdate) {
logger('switchVersion: ' + hash);
applyingUpdate = true;
PushyModule.reloadUpdate({ hash });
}
}

View File

@@ -16,20 +16,20 @@ import {
switchVersionLater,
markSuccess,
downloadAndInstallApk,
onEvents,
onPushyEvents,
} from './main';
import { UpdateEventsListener } from './type';
export function simpleUpdate(
WrappedComponent: ComponentType,
options: { appKey?: string; onEvents?: UpdateEventsListener } = {},
options: { appKey?: string; onPushyEvents?: UpdateEventsListener } = {},
) {
const { appKey, onEvents: eventListeners } = options;
const { appKey, onPushyEvents: eventListeners } = options;
if (!appKey) {
throw new Error('appKey is required for simpleUpdate()');
}
if (typeof eventListeners === 'function') {
onEvents(eventListeners);
onPushyEvents(eventListeners);
}
return __DEV__
? WrappedComponent

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "9.1.2",
"version": "9.1.4",
"description": "react-native hot update",
"main": "lib/index.ts",
"scripts": {