react-native-update 9.2.2 → 9.2.4
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/lib/utils.ts +33 -6
- package/package.json +1 -1
- 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/lib/utils.ts
CHANGED
|
@@ -8,7 +8,7 @@ export function promiseAny<T>(promises: Promise<T>[]) {
|
|
|
8
8
|
return new Promise<T>((resolve, reject) => {
|
|
9
9
|
let count = 0;
|
|
10
10
|
|
|
11
|
-
promises.forEach(promise => {
|
|
11
|
+
promises.forEach((promise) => {
|
|
12
12
|
Promise.resolve(promise)
|
|
13
13
|
.then(resolve)
|
|
14
14
|
.catch(() => {
|
|
@@ -30,17 +30,44 @@ export function assertRelease() {
|
|
|
30
30
|
const ping =
|
|
31
31
|
Platform.OS === 'web'
|
|
32
32
|
? Promise.resolve
|
|
33
|
-
: async (url: string) =>
|
|
34
|
-
|
|
33
|
+
: async (url: string) => {
|
|
34
|
+
let pingFinished = false;
|
|
35
|
+
return Promise.race([
|
|
35
36
|
fetch(url, {
|
|
36
37
|
method: 'HEAD',
|
|
37
|
-
})
|
|
38
|
-
|
|
38
|
+
})
|
|
39
|
+
.then(({ status, statusText }) => {
|
|
40
|
+
pingFinished = true;
|
|
41
|
+
if (status === 200) {
|
|
42
|
+
return url;
|
|
43
|
+
}
|
|
44
|
+
logger('ping failed', url, status, statusText);
|
|
45
|
+
throw new Error('Ping failed');
|
|
46
|
+
})
|
|
47
|
+
.catch((e) => {
|
|
48
|
+
pingFinished = true;
|
|
49
|
+
logger('ping error', url, e);
|
|
50
|
+
throw e;
|
|
51
|
+
}),
|
|
52
|
+
new Promise((_, reject) =>
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
reject(new Error('Ping timeout'));
|
|
55
|
+
if (!pingFinished) {
|
|
56
|
+
logger('ping timeout', url);
|
|
57
|
+
}
|
|
58
|
+
}, 2000),
|
|
59
|
+
),
|
|
39
60
|
]);
|
|
61
|
+
};
|
|
40
62
|
|
|
41
63
|
export const testUrls = async (urls?: string[]) => {
|
|
42
64
|
if (!urls?.length) {
|
|
43
65
|
return null;
|
|
44
66
|
}
|
|
45
|
-
|
|
67
|
+
const ret = await promiseAny(urls.map(ping));
|
|
68
|
+
if (ret) {
|
|
69
|
+
return ret;
|
|
70
|
+
}
|
|
71
|
+
logger('all ping failed, use first url:', urls[0]);
|
|
72
|
+
return urls[0];
|
|
46
73
|
};
|
package/package.json
CHANGED
package/android/bin/jni/HDiffPatch/builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.class
DELETED
|
Binary file
|
|
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
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder$LenPriceTableEncoder.class
DELETED
|
Binary file
|
package/android/bin/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder$LiteralEncoder$Encoder2.class
DELETED
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|