@hot-updater/react-native 0.5.4 → 0.5.5
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/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/runUpdateProcess.d.ts +2 -2
- package/dist/wrap.d.ts +1 -1
- package/package.json +3 -3
- package/src/runUpdateProcess.ts +4 -4
- package/src/wrap.tsx +3 -3
package/dist/index.js
CHANGED
|
@@ -1771,11 +1771,11 @@ const runUpdateProcess = async ({ reloadOnForceUpdate = false, ...checkForUpdate
|
|
|
1771
1771
|
status: "UP_TO_DATE"
|
|
1772
1772
|
};
|
|
1773
1773
|
const isUpdated = await updateBundle(updateInfo.id, updateInfo.fileUrl);
|
|
1774
|
-
if (isUpdated && updateInfo.
|
|
1774
|
+
if (isUpdated && updateInfo.shouldForceUpdate && reloadOnForceUpdate) reload();
|
|
1775
1775
|
if (!isUpdated) throw new Error("New update was found but failed to download the bundle.");
|
|
1776
1776
|
return {
|
|
1777
1777
|
status: updateInfo.status,
|
|
1778
|
-
|
|
1778
|
+
shouldForceUpdate: updateInfo.shouldForceUpdate,
|
|
1779
1779
|
id: updateInfo.id
|
|
1780
1780
|
};
|
|
1781
1781
|
};
|
|
@@ -1845,11 +1845,11 @@ function wrap(config) {
|
|
|
1845
1845
|
setStatus("UPDATING");
|
|
1846
1846
|
const isSuccess = await updateBundle(updateInfo.id, updateInfo.fileUrl);
|
|
1847
1847
|
if (!isSuccess) throw new Error("New update was found but failed to download the bundle.");
|
|
1848
|
-
if (updateInfo.
|
|
1848
|
+
if (updateInfo.shouldForceUpdate && reloadOnForceUpdate) reload();
|
|
1849
1849
|
restConfig.onUpdateProcessCompleted?.({
|
|
1850
1850
|
id: updateInfo.id,
|
|
1851
1851
|
status: updateInfo.status,
|
|
1852
|
-
|
|
1852
|
+
shouldForceUpdate: updateInfo.shouldForceUpdate
|
|
1853
1853
|
});
|
|
1854
1854
|
setStatus("UPDATE_PROCESS_COMPLETED");
|
|
1855
1855
|
} catch (error) {
|
package/dist/index.mjs
CHANGED
|
@@ -1739,11 +1739,11 @@ const runUpdateProcess = async ({ reloadOnForceUpdate = false, ...checkForUpdate
|
|
|
1739
1739
|
status: "UP_TO_DATE"
|
|
1740
1740
|
};
|
|
1741
1741
|
const isUpdated = await updateBundle(updateInfo.id, updateInfo.fileUrl);
|
|
1742
|
-
if (isUpdated && updateInfo.
|
|
1742
|
+
if (isUpdated && updateInfo.shouldForceUpdate && reloadOnForceUpdate) reload();
|
|
1743
1743
|
if (!isUpdated) throw new Error("New update was found but failed to download the bundle.");
|
|
1744
1744
|
return {
|
|
1745
1745
|
status: updateInfo.status,
|
|
1746
|
-
|
|
1746
|
+
shouldForceUpdate: updateInfo.shouldForceUpdate,
|
|
1747
1747
|
id: updateInfo.id
|
|
1748
1748
|
};
|
|
1749
1749
|
};
|
|
@@ -1813,11 +1813,11 @@ function wrap(config) {
|
|
|
1813
1813
|
setStatus("UPDATING");
|
|
1814
1814
|
const isSuccess = await updateBundle(updateInfo.id, updateInfo.fileUrl);
|
|
1815
1815
|
if (!isSuccess) throw new Error("New update was found but failed to download the bundle.");
|
|
1816
|
-
if (updateInfo.
|
|
1816
|
+
if (updateInfo.shouldForceUpdate && reloadOnForceUpdate) reload();
|
|
1817
1817
|
restConfig.onUpdateProcessCompleted?.({
|
|
1818
1818
|
id: updateInfo.id,
|
|
1819
1819
|
status: updateInfo.status,
|
|
1820
|
-
|
|
1820
|
+
shouldForceUpdate: updateInfo.shouldForceUpdate
|
|
1821
1821
|
});
|
|
1822
1822
|
setStatus("UPDATE_PROCESS_COMPLETED");
|
|
1823
1823
|
} catch (error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CheckForUpdateConfig } from "./checkUpdate";
|
|
2
2
|
export type RunUpdateProcessResponse = {
|
|
3
3
|
status: "ROLLBACK" | "UPDATE";
|
|
4
|
-
|
|
4
|
+
shouldForceUpdate: boolean;
|
|
5
5
|
id: string;
|
|
6
6
|
} | {
|
|
7
7
|
status: "UP_TO_DATE";
|
|
@@ -9,7 +9,7 @@ export type RunUpdateProcessResponse = {
|
|
|
9
9
|
export interface RunUpdateProcessConfig extends CheckForUpdateConfig {
|
|
10
10
|
/**
|
|
11
11
|
* If `true`, the app will be reloaded when the downloaded bundle is a force update.
|
|
12
|
-
* If `false`,
|
|
12
|
+
* If `false`, shouldForceUpdate will be returned as true but the app won't reload.
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
15
|
reloadOnForceUpdate?: boolean;
|
package/dist/wrap.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface HotUpdaterConfig extends CheckForUpdateConfig {
|
|
|
30
30
|
onProgress?: (progress: number) => void;
|
|
31
31
|
/**
|
|
32
32
|
* When a force update exists, the app will automatically reload.
|
|
33
|
-
* If `false`, When a force update exists, the app will not reload. `
|
|
33
|
+
* If `false`, When a force update exists, the app will not reload. `shouldForceUpdate` will be returned as `true` in `onUpdateProcessCompleted`.
|
|
34
34
|
* If `true`, When a force update exists, the app will automatically reload.
|
|
35
35
|
* @default true
|
|
36
36
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/react-native",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "React Native OTA solution for self-hosted",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"react-native-builder-bob": "^0.33.1"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@hot-updater/js": "0.5.
|
|
79
|
-
"@hot-updater/core": "0.5.
|
|
78
|
+
"@hot-updater/js": "0.5.5",
|
|
79
|
+
"@hot-updater/core": "0.5.5"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"build": "rslib build",
|
package/src/runUpdateProcess.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { reload, updateBundle } from "./native";
|
|
|
4
4
|
export type RunUpdateProcessResponse =
|
|
5
5
|
| {
|
|
6
6
|
status: "ROLLBACK" | "UPDATE";
|
|
7
|
-
|
|
7
|
+
shouldForceUpdate: boolean;
|
|
8
8
|
id: string;
|
|
9
9
|
}
|
|
10
10
|
| {
|
|
@@ -14,7 +14,7 @@ export type RunUpdateProcessResponse =
|
|
|
14
14
|
export interface RunUpdateProcessConfig extends CheckForUpdateConfig {
|
|
15
15
|
/**
|
|
16
16
|
* If `true`, the app will be reloaded when the downloaded bundle is a force update.
|
|
17
|
-
* If `false`,
|
|
17
|
+
* If `false`, shouldForceUpdate will be returned as true but the app won't reload.
|
|
18
18
|
* @default false
|
|
19
19
|
*/
|
|
20
20
|
reloadOnForceUpdate?: boolean;
|
|
@@ -32,7 +32,7 @@ export const runUpdateProcess = async ({
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const isUpdated = await updateBundle(updateInfo.id, updateInfo.fileUrl);
|
|
35
|
-
if (isUpdated && updateInfo.
|
|
35
|
+
if (isUpdated && updateInfo.shouldForceUpdate && reloadOnForceUpdate) {
|
|
36
36
|
reload();
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@ export const runUpdateProcess = async ({
|
|
|
41
41
|
}
|
|
42
42
|
return {
|
|
43
43
|
status: updateInfo.status,
|
|
44
|
-
|
|
44
|
+
shouldForceUpdate: updateInfo.shouldForceUpdate,
|
|
45
45
|
id: updateInfo.id,
|
|
46
46
|
};
|
|
47
47
|
};
|
package/src/wrap.tsx
CHANGED
|
@@ -34,7 +34,7 @@ export interface HotUpdaterConfig extends CheckForUpdateConfig {
|
|
|
34
34
|
onProgress?: (progress: number) => void;
|
|
35
35
|
/**
|
|
36
36
|
* When a force update exists, the app will automatically reload.
|
|
37
|
-
* If `false`, When a force update exists, the app will not reload. `
|
|
37
|
+
* If `false`, When a force update exists, the app will not reload. `shouldForceUpdate` will be returned as `true` in `onUpdateProcessCompleted`.
|
|
38
38
|
* If `true`, When a force update exists, the app will automatically reload.
|
|
39
39
|
* @default true
|
|
40
40
|
*/
|
|
@@ -85,14 +85,14 @@ export function wrap<P>(
|
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
if (updateInfo.
|
|
88
|
+
if (updateInfo.shouldForceUpdate && reloadOnForceUpdate) {
|
|
89
89
|
reload();
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
restConfig.onUpdateProcessCompleted?.({
|
|
93
93
|
id: updateInfo.id,
|
|
94
94
|
status: updateInfo.status,
|
|
95
|
-
|
|
95
|
+
shouldForceUpdate: updateInfo.shouldForceUpdate,
|
|
96
96
|
});
|
|
97
97
|
setStatus("UPDATE_PROCESS_COMPLETED");
|
|
98
98
|
} catch (error) {
|