react-native-update 10.10.0 → 10.10.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/provider.tsx +17 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.10.0",
3
+ "version": "10.10.2",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {
package/src/provider.tsx CHANGED
@@ -270,15 +270,28 @@ export const PushyProvider = ({
270
270
  } catch {
271
271
  return false;
272
272
  }
273
- if (payload && payload.type) {
273
+ if (payload && payload.type && payload.type.startsWith('__rnPushy')) {
274
+ const logger = options.logger || (() => {});
275
+ options.logger = ({ type, data }) => {
276
+ logger({ type, data });
277
+ Alert.alert(type, JSON.stringify(data));
278
+ };
274
279
  if (payload.type === '__rnPushyVersionHash') {
275
- await checkUpdate({ toHash: payload.data });
276
- return true;
280
+ checkUpdate({ toHash: payload.data }).then(() => {
281
+ if (updateInfoRef.current && updateInfoRef.current.upToDate) {
282
+ Alert.alert(
283
+ '提示',
284
+ '当前尚未检测到更新版本,如果是首次扫码,请等待服务器端生成补丁包后再试(约10秒)',
285
+ );
286
+ }
287
+ options.logger = logger;
288
+ });
277
289
  }
290
+ return true;
278
291
  }
279
292
  return false;
280
293
  },
281
- [checkUpdate],
294
+ [checkUpdate, options],
282
295
  );
283
296
 
284
297
  return (