react-native-update 10.11.5 → 10.11.7

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.
@@ -610,7 +610,7 @@ RCT_EXPORT_METHOD(markSuccess:
610
610
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
611
611
  (const facebook::react::ObjCTurboModule::InitParams &)params
612
612
  {
613
- return std::make_shared<facebook::react::NativeUpdateSpecJSI>(params);
613
+ return std::make_shared<facebook::react::NativePushySpecJSI>(params);
614
614
  }
615
615
  #endif
616
616
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.11.5",
3
+ "version": "10.11.7",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {
package/src/client.ts CHANGED
@@ -126,7 +126,7 @@ export class Pushy {
126
126
  PushyModule.markSuccess();
127
127
  this.report({ type: 'markSuccess' });
128
128
  };
129
- switchVersion = (hash: string) => {
129
+ switchVersion = async (hash: string) => {
130
130
  if (__DEV__) {
131
131
  console.warn(
132
132
  '您调用了switchVersion方法,但是当前是开发环境,不会进行任何操作。',
@@ -136,11 +136,11 @@ export class Pushy {
136
136
  if (this.assertHash(hash) && !this.applyingUpdate) {
137
137
  log('switchVersion: ' + hash);
138
138
  this.applyingUpdate = true;
139
- PushyModule.reloadUpdate({ hash });
139
+ return PushyModule.reloadUpdate({ hash });
140
140
  }
141
141
  };
142
142
 
143
- switchVersionLater = (hash: string) => {
143
+ switchVersionLater = async (hash: string) => {
144
144
  if (__DEV__) {
145
145
  console.warn(
146
146
  '您调用了switchVersionLater方法,但是当前是开发环境,不会进行任何操作。',
@@ -149,7 +149,7 @@ export class Pushy {
149
149
  }
150
150
  if (this.assertHash(hash)) {
151
151
  log('switchVersionLater: ' + hash);
152
- PushyModule.setNeedUpdate({ hash });
152
+ return PushyModule.setNeedUpdate({ hash });
153
153
  }
154
154
  };
155
155
  checkUpdate = async (extra?: Record<string, any>) => {
package/src/context.ts CHANGED
@@ -7,8 +7,8 @@ const asyncNoop = () => Promise.resolve();
7
7
 
8
8
  export const defaultContext = {
9
9
  checkUpdate: asyncNoop,
10
- switchVersion: noop,
11
- switchVersionLater: noop,
10
+ switchVersion: asyncNoop,
11
+ switchVersionLater: asyncNoop,
12
12
  markSuccess: noop,
13
13
  dismissError: noop,
14
14
  downloadUpdate: asyncNoop,
@@ -21,8 +21,8 @@ export const defaultContext = {
21
21
 
22
22
  export const PushyContext = createContext<{
23
23
  checkUpdate: () => Promise<void>;
24
- switchVersion: () => void;
25
- switchVersionLater: () => void;
24
+ switchVersion: () => Promise<void>;
25
+ switchVersionLater: () => Promise<void>;
26
26
  markSuccess: () => void;
27
27
  dismissError: () => void;
28
28
  downloadUpdate: () => Promise<void>;
package/src/provider.tsx CHANGED
@@ -73,18 +73,18 @@ export const PushyProvider = ({
73
73
  );
74
74
 
75
75
  const switchVersion = useCallback(
76
- (info: CheckResult | undefined = updateInfoRef.current) => {
76
+ async (info: CheckResult | undefined = updateInfoRef.current) => {
77
77
  if (info && info.hash) {
78
- client.switchVersion(info.hash);
78
+ return client.switchVersion(info.hash);
79
79
  }
80
80
  },
81
81
  [client],
82
82
  );
83
83
 
84
84
  const switchVersionLater = useCallback(
85
- (info: CheckResult | undefined = updateInfoRef.current) => {
85
+ async (info: CheckResult | undefined = updateInfoRef.current) => {
86
86
  if (info && info.hash) {
87
- client.switchVersionLater(info.hash);
87
+ return client.switchVersionLater(info.hash);
88
88
  }
89
89
  },
90
90
  [client],