react-native-update 10.1.1 → 10.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.1.1",
3
+ "version": "10.1.3",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
package/src/context.ts CHANGED
@@ -12,7 +12,8 @@ export const defaultContext = {
12
12
  markSuccess: noop,
13
13
  dismissError: noop,
14
14
  downloadUpdate: asyncNoop,
15
- downloadAndInstallApk: noop,
15
+ downloadAndInstallApk: asyncNoop,
16
+ getCurrentVersionInfo: () => Promise.resolve({}),
16
17
  currentHash: '',
17
18
  packageVersion: '',
18
19
  };
@@ -24,7 +25,12 @@ export const PushyContext = createContext<{
24
25
  markSuccess: () => void;
25
26
  dismissError: () => void;
26
27
  downloadUpdate: () => Promise<void>;
27
- downloadAndInstallApk: (url: string) => void;
28
+ downloadAndInstallApk: (url: string) => Promise<void>;
29
+ getCurrentVersionInfo: () => Promise<{
30
+ name?: string;
31
+ description?: string;
32
+ metaInfo?: string;
33
+ }>;
28
34
  currentHash: string;
29
35
  packageVersion: string;
30
36
  client?: Pushy;
package/src/provider.tsx CHANGED
@@ -13,7 +13,12 @@ import {
13
13
  Linking,
14
14
  } from 'react-native';
15
15
  import { Pushy } from './client';
16
- import { currentVersion, isFirstTime, packageVersion } from './core';
16
+ import {
17
+ currentVersion,
18
+ isFirstTime,
19
+ packageVersion,
20
+ getCurrentVersionInfo,
21
+ } from './core';
17
22
  import { CheckResult, ProgressData } from './type';
18
23
  import { PushyContext } from './context';
19
24
 
@@ -88,9 +93,9 @@ export const PushyProvider = ({
88
93
  }, [client, showAlert, updateInfo]);
89
94
 
90
95
  const downloadAndInstallApk = useCallback(
91
- (downloadUrl: string) => {
96
+ async (downloadUrl: string) => {
92
97
  if (Platform.OS === 'android' && downloadUrl) {
93
- client.downloadAndInstallApk(downloadUrl, setProgress);
98
+ await client.downloadAndInstallApk(downloadUrl, setProgress);
94
99
  }
95
100
  },
96
101
  [client],
@@ -188,6 +193,7 @@ export const PushyProvider = ({
188
193
  currentHash: currentVersion,
189
194
  progress,
190
195
  downloadAndInstallApk,
196
+ getCurrentVersionInfo,
191
197
  }}
192
198
  >
193
199
  {children}