react-native-update 9.1.2 → 9.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.web.js CHANGED
@@ -15,4 +15,4 @@ export const downloadAndInstallApk = noop;
15
15
  export const setCustomEndpoints = noop;
16
16
  export const getCurrentVersionInfo = noop;
17
17
  export const simpleUpdate = (app) => app;
18
- export const onEvents = noop;
18
+ export const onPushyEvents = noop;
package/lib/main.ts CHANGED
@@ -78,7 +78,7 @@ if (!uuid) {
78
78
  const noop = () => {};
79
79
  let reporter: UpdateEventsListener = noop;
80
80
 
81
- export function onEvents(customReporter: UpdateEventsListener) {
81
+ export function onPushyEvents(customReporter: UpdateEventsListener) {
82
82
  reporter = customReporter;
83
83
  if (isRolledBack) {
84
84
  report({
@@ -322,10 +322,12 @@ function assertHash(hash: string) {
322
322
  return true;
323
323
  }
324
324
 
325
+ let applyingUpdate = false;
325
326
  export function switchVersion(hash: string) {
326
327
  assertRelease();
327
- if (assertHash(hash)) {
328
+ if (assertHash(hash) && !applyingUpdate) {
328
329
  logger('switchVersion: ' + hash);
330
+ applyingUpdate = true;
329
331
  PushyModule.reloadUpdate({ hash });
330
332
  }
331
333
  }
@@ -16,20 +16,20 @@ import {
16
16
  switchVersionLater,
17
17
  markSuccess,
18
18
  downloadAndInstallApk,
19
- onEvents,
19
+ onPushyEvents,
20
20
  } from './main';
21
21
  import { UpdateEventsListener } from './type';
22
22
 
23
23
  export function simpleUpdate(
24
24
  WrappedComponent: ComponentType,
25
- options: { appKey?: string; onEvents?: UpdateEventsListener } = {},
25
+ options: { appKey?: string; onPushyEvents?: UpdateEventsListener } = {},
26
26
  ) {
27
- const { appKey, onEvents: eventListeners } = options;
27
+ const { appKey, onPushyEvents: eventListeners } = options;
28
28
  if (!appKey) {
29
29
  throw new Error('appKey is required for simpleUpdate()');
30
30
  }
31
31
  if (typeof eventListeners === 'function') {
32
- onEvents(eventListeners);
32
+ onPushyEvents(eventListeners);
33
33
  }
34
34
  return __DEV__
35
35
  ? WrappedComponent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "9.1.2",
3
+ "version": "9.1.4",
4
4
  "description": "react-native hot update",
5
5
  "main": "lib/index.ts",
6
6
  "scripts": {