react-native-update 9.2.0 → 9.2.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.
- package/android/.project +28 -0
- package/android/bin/.project +34 -0
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +13 -0
- package/android/bin/jni/HDiffPatch/builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/CRC.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZ/BinTree.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZ/InWindow.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZ/OutWindow.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Base.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Decoder$LenDecoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Decoder$LiteralDecoder$Decoder2.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Decoder$LiteralDecoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Decoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder$LenEncoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder$LenPriceTableEncoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder$LiteralEncoder$Encoder2.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder$LiteralEncoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder$Optimal.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/RangeCoder/Decoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/Compression/RangeCoder/Encoder.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/ICodeProgress.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaAlone$CommandLine.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaAlone.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaBench$CBenchRandomGenerator.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaBench$CBitRandomGenerator.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaBench$CProgressInfo.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaBench$CRandomGenerator.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaBench$CrcOutStream.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaBench$MyInputStream.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaBench$MyOutputStream.class +0 -0
- package/android/bin/jni/lzma/Java/SevenZip/LzmaBench.class +0 -0
- package/android/bin/src/main/java/cn/reactnative/modules/update/DownloadTask.class +0 -0
- package/android/bin/src/main/java/cn/reactnative/modules/update/DownloadTaskParams.class +0 -0
- package/android/bin/src/main/java/cn/reactnative/modules/update/PushyFileProvider.class +0 -0
- package/android/bin/src/main/java/cn/reactnative/modules/update/SafeZipFile$SafeZipEntryIterator.class +0 -0
- package/android/bin/src/main/java/cn/reactnative/modules/update/SafeZipFile.class +0 -0
- package/android/bin/src/main/java/cn/reactnative/modules/update/UpdateContext$DownloadFileListener.class +0 -0
- package/android/bin/src/main/java/cn/reactnative/modules/update/UpdateContext.class +0 -0
- package/android/bin/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.class +0 -0
- package/android/bin/src/main/java/cn/reactnative/modules/update/UpdatePackage.class +0 -0
- package/android/bin/src/newarch/cn/reactnative/modules/update/UpdateModule.class +0 -0
- package/android/bin/src/oldarch/cn/reactnative/modules/update/UpdateModule.class +0 -0
- package/ios/RCTPushy/RCTPushy.mm +1 -2
- package/lib/endpoint.ts +3 -3
- package/lib/main.ts +5 -5
- package/lib/utils.ts +20 -6
- package/package.json +3 -2
package/android/.project
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>react-native-update</name>
|
|
4
|
+
<comment>Project react-native-update created by Buildship.</comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
</buildSpec>
|
|
14
|
+
<natures>
|
|
15
|
+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
16
|
+
</natures>
|
|
17
|
+
<filteredResources>
|
|
18
|
+
<filter>
|
|
19
|
+
<id>1727963310481</id>
|
|
20
|
+
<name></name>
|
|
21
|
+
<type>30</type>
|
|
22
|
+
<matcher>
|
|
23
|
+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
24
|
+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
25
|
+
</matcher>
|
|
26
|
+
</filter>
|
|
27
|
+
</filteredResources>
|
|
28
|
+
</projectDescription>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>react-native-update</name>
|
|
4
|
+
<comment>Project react-native-update created by Buildship.</comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
<buildCommand>
|
|
14
|
+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
15
|
+
<arguments>
|
|
16
|
+
</arguments>
|
|
17
|
+
</buildCommand>
|
|
18
|
+
</buildSpec>
|
|
19
|
+
<natures>
|
|
20
|
+
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
21
|
+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
22
|
+
</natures>
|
|
23
|
+
<filteredResources>
|
|
24
|
+
<filter>
|
|
25
|
+
<id>1727963310481</id>
|
|
26
|
+
<name></name>
|
|
27
|
+
<type>30</type>
|
|
28
|
+
<matcher>
|
|
29
|
+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
30
|
+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
31
|
+
</matcher>
|
|
32
|
+
</filter>
|
|
33
|
+
</filteredResources>
|
|
34
|
+
</projectDescription>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
arguments=--init-script /var/folders/l6/0fn3x28s5s585ld3p04gsy1h0000gn/T/db3b08fc4a9ef609cb16b96b200fa13e563f396e9bb1ed0905fdab7bc3bc513b.gradle --init-script /var/folders/l6/0fn3x28s5s585ld3p04gsy1h0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
|
|
2
|
+
auto.sync=false
|
|
3
|
+
build.scans.enabled=false
|
|
4
|
+
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(8.9))
|
|
5
|
+
connection.project.dir=
|
|
6
|
+
eclipse.preferences.version=1
|
|
7
|
+
gradle.user.home=
|
|
8
|
+
java.home=/Users/sunny/.sdkman/candidates/java/17.0.9-zulu/zulu-17.jdk/Contents/Home
|
|
9
|
+
jvm.arguments=
|
|
10
|
+
offline.mode=false
|
|
11
|
+
override.workspace.settings=true
|
|
12
|
+
show.console.view=true
|
|
13
|
+
show.executions.view=true
|
package/android/bin/jni/HDiffPatch/builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.class
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Decoder$LiteralDecoder$Decoder2.class
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder$LenPriceTableEncoder.class
ADDED
|
Binary file
|
package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder$LiteralEncoder$Encoder2.class
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/ios/RCTPushy/RCTPushy.mm
CHANGED
|
@@ -349,8 +349,7 @@ RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options
|
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
RCT_EXPORT_METHOD(markSuccess:
|
|
353
|
-
resolver:(RCTPromiseResolveBlock)resolve
|
|
352
|
+
RCT_EXPORT_METHOD(markSuccess:(RCTPromiseResolveBlock)resolve
|
|
354
353
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
355
354
|
{
|
|
356
355
|
|
package/lib/endpoint.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger } from './utils';
|
|
1
|
+
import { logger, promiseAny } from './utils';
|
|
2
2
|
|
|
3
3
|
let currentEndpoint = 'https://update.react-native.cn/api';
|
|
4
4
|
let backupEndpoints: string[] = [
|
|
@@ -13,8 +13,8 @@ let backupEndpointsQueryUrls = [
|
|
|
13
13
|
export async function updateBackupEndpoints() {
|
|
14
14
|
if (backupEndpointsQueryUrls) {
|
|
15
15
|
try {
|
|
16
|
-
const resp = await
|
|
17
|
-
backupEndpointsQueryUrls.map(
|
|
16
|
+
const resp = await promiseAny(
|
|
17
|
+
backupEndpointsQueryUrls.map(queryUrl => fetch(queryUrl)),
|
|
18
18
|
);
|
|
19
19
|
const remoteEndpoints = await resp.json();
|
|
20
20
|
if (Array.isArray(remoteEndpoints)) {
|
package/lib/main.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
UpdateAvailableResult,
|
|
17
17
|
UpdateEventsListener,
|
|
18
18
|
} from './type';
|
|
19
|
-
import { assertRelease, logger, testUrls } from './utils';
|
|
19
|
+
import { assertRelease, logger, promiseAny, testUrls } from './utils';
|
|
20
20
|
export { setCustomEndpoints };
|
|
21
21
|
const {
|
|
22
22
|
version: v,
|
|
@@ -167,8 +167,8 @@ export async function checkUpdate(APPKEY: string) {
|
|
|
167
167
|
const backupEndpoints = await updateBackupEndpoints();
|
|
168
168
|
if (backupEndpoints) {
|
|
169
169
|
try {
|
|
170
|
-
resp = await
|
|
171
|
-
backupEndpoints.map(
|
|
170
|
+
resp = await promiseAny(
|
|
171
|
+
backupEndpoints.map(endpoint =>
|
|
172
172
|
fetch(getCheckUrl(APPKEY, endpoint), fetchPayload),
|
|
173
173
|
),
|
|
174
174
|
);
|
|
@@ -205,7 +205,7 @@ function checkOperation(
|
|
|
205
205
|
if (!Array.isArray(op)) {
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
|
-
op.forEach(
|
|
208
|
+
op.forEach(action => {
|
|
209
209
|
if (action.type === 'block') {
|
|
210
210
|
blockUpdate = {
|
|
211
211
|
reason: action.reason,
|
|
@@ -250,7 +250,7 @@ export async function downloadUpdate(
|
|
|
250
250
|
const downloadCallback = eventListeners.onDownloadProgress;
|
|
251
251
|
progressHandler = eventEmitter.addListener(
|
|
252
252
|
'RCTPushyDownloadProgress',
|
|
253
|
-
|
|
253
|
+
progressData => {
|
|
254
254
|
if (progressData.hash === options.hash) {
|
|
255
255
|
downloadCallback(progressData);
|
|
256
256
|
}
|
package/lib/utils.ts
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
import { Platform } from
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
2
|
|
|
3
3
|
export function logger(...args: any[]) {
|
|
4
4
|
console.log('Pushy: ', ...args);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
export function promiseAny<T>(promises: Promise<T>[]) {
|
|
8
|
+
return new Promise<T>((resolve, reject) => {
|
|
9
|
+
let count = 0;
|
|
10
|
+
|
|
11
|
+
promises.forEach(promise => {
|
|
12
|
+
Promise.resolve(promise)
|
|
13
|
+
.then(resolve)
|
|
14
|
+
.catch(() => {
|
|
15
|
+
count++;
|
|
16
|
+
if (count === promises.length) {
|
|
17
|
+
reject(new Error('All promises were rejected'));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
7
24
|
export function assertRelease() {
|
|
8
25
|
if (__DEV__) {
|
|
9
26
|
throw new Error('react-native-update 只能在 RELEASE 版本中运行.');
|
|
@@ -17,16 +34,13 @@ const ping =
|
|
|
17
34
|
Promise.race([
|
|
18
35
|
fetch(url, {
|
|
19
36
|
method: 'HEAD',
|
|
20
|
-
})
|
|
21
|
-
.then(({ status }) => (status === 200 ? url : null))
|
|
22
|
-
.catch(() => null),
|
|
37
|
+
}).then(({ status }) => (status === 200 ? url : null)),
|
|
23
38
|
new Promise(r => setTimeout(() => r(null), 2000)),
|
|
24
39
|
]);
|
|
25
40
|
|
|
26
|
-
|
|
27
41
|
export const testUrls = async (urls?: string[]) => {
|
|
28
42
|
if (!urls?.length) {
|
|
29
43
|
return null;
|
|
30
44
|
}
|
|
31
|
-
return
|
|
45
|
+
return promiseAny(urls.map(ping)).catch(() => null);
|
|
32
46
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.2",
|
|
4
4
|
"description": "react-native hot update",
|
|
5
5
|
"main": "lib/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -67,5 +67,6 @@
|
|
|
67
67
|
"react-native": "^0.72.6",
|
|
68
68
|
"ts-jest": "^29.0.3",
|
|
69
69
|
"typescript": "^5.2.2"
|
|
70
|
-
}
|
|
70
|
+
},
|
|
71
|
+
"packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
|
|
71
72
|
}
|