react-native-update 10.37.15 → 10.37.17
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/README-CN.md +72 -0
- package/README.md +61 -49
- package/bunfig.toml +2 -0
- package/harmony/har-wrapper/AppScope/app.json5 +8 -0
- package/harmony/har-wrapper/build-profile.json5 +35 -0
- package/harmony/har-wrapper/hvigor/hvigor-config.json5 +5 -0
- package/harmony/har-wrapper/hvigorfile.ts +6 -0
- package/harmony/har-wrapper/oh-package.json5 +4 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/cache-v2-77b153ce45aba0ed28ef.json +1415 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/cmakeFiles-v1-b65a07793384e0ce3e08.json +809 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/codemodel-v2-ce0e89410afd8bf3a057.json +60 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/directory-.-Release-f5ebdc15457944623624.json +14 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/index-2026-03-17T03-24-47-0088.json +89 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/target-rnupdate-Release-267153624504c9c3ffdd.json +222 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.ninja_deps +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.ninja_log +8 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeCache.txt +415 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeCCompiler.cmake +74 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeCXXCompiler.cmake +85 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeDetermineCompilerABI_C.bin +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeSystem.cmake +15 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CompilerIdC/CMakeCCompilerId.c +880 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CompilerIdC/CMakeCCompilerId.o +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +869 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CompilerIdCXX/CMakeCXXCompilerId.o +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/CMakeConfigureLog.yaml +388 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/TargetDirectories.txt +3 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/cmake.check_cache +1 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/rnupdate.dir/__w/react-native-update/react-native-update/android/jni/HDiffPatch/file_for_patch.c.o +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/rnupdate.dir/__w/react-native-update/react-native-update/android/jni/HDiffPatch/libHDiffPatch/HPatch/patch.c.o +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/rnupdate.dir/__w/react-native-update/react-native-update/android/jni/hpatch.c.o +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/rnupdate.dir/__w/react-native-update/react-native-update/android/jni/lzma/C/Lzma2Dec.c.o +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/rnupdate.dir/__w/react-native-update/react-native-update/android/jni/lzma/C/LzmaDec.c.o +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/rnupdate.dir/pushy.c.o +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/rules.ninja +64 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/additional_project_files.txt +0 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/build.ninja +206 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/build_file_index.txt +1 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/cmake_install.cmake +54 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/compile_commands.json +38 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/configure_fingerprint.json +1 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/hvigor_native_config.json +1 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/metadata_generation_command.txt +17 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/native_work_dir.txt +1 -0
- package/harmony/pushy/.cxx/default/default/release/arm64-v8a/output.log +14 -0
- package/harmony/pushy/.cxx/default/default/release/hvigor/arm64-v8a/summary.cmake +0 -0
- package/harmony/pushy/BuildProfile.ets +3 -5
- package/harmony/pushy/build-profile.json5 +8 -1
- package/harmony/pushy/oh-package-lock.json5 +1 -1
- package/harmony/pushy/src/main/cpp/CMakeLists.txt +42 -30
- package/harmony/pushy/src/main/ets/DownloadTask.ts +145 -106
- package/harmony/pushy/src/main/ets/Logger.ts +24 -7
- package/harmony/pushy.har +0 -0
- package/package.json +2 -1
- package/scripts/build-harmony-har.js +427 -0
- package/scripts/prepublish.ts +66 -4
- package/src/__tests__/core.test.ts +103 -0
- package/src/__tests__/setup.ts +37 -0
- package/src/__tests__/utils.test.ts +36 -0
- package/src/client.ts +14 -8
- package/src/core.ts +5 -5
- package/src/locales/en.ts +1 -0
- package/src/locales/zh.ts +1 -0
- package/src/utils.ts +13 -1
package/src/client.ts
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
assertWeb,
|
|
23
23
|
emptyObj,
|
|
24
24
|
enhancedFetch,
|
|
25
|
+
info,
|
|
25
26
|
joinUrls,
|
|
26
27
|
log,
|
|
27
28
|
noop,
|
|
@@ -189,7 +190,7 @@ export class Pushy {
|
|
|
189
190
|
};
|
|
190
191
|
assertDebug = (matter: string) => {
|
|
191
192
|
if (__DEV__ && !this.options.debug) {
|
|
192
|
-
|
|
193
|
+
info(this.t('dev_debug_disabled', { matter }));
|
|
193
194
|
return false;
|
|
194
195
|
}
|
|
195
196
|
return true;
|
|
@@ -345,9 +346,14 @@ export class Pushy {
|
|
|
345
346
|
const remoteEndpoints = await resp.json();
|
|
346
347
|
log('fetch endpoints:', remoteEndpoints);
|
|
347
348
|
if (Array.isArray(remoteEndpoints)) {
|
|
348
|
-
server.backups
|
|
349
|
-
|
|
350
|
-
)
|
|
349
|
+
const backups = server.backups || [];
|
|
350
|
+
const set = new Set(backups);
|
|
351
|
+
for (const endpoint of remoteEndpoints) {
|
|
352
|
+
set.add(endpoint);
|
|
353
|
+
}
|
|
354
|
+
if (set.size !== backups.length) {
|
|
355
|
+
server.backups = Array.from(set);
|
|
356
|
+
}
|
|
351
357
|
}
|
|
352
358
|
} catch (e: any) {
|
|
353
359
|
log('failed to fetch endpoints from: ', server.queryUrls);
|
|
@@ -356,7 +362,7 @@ export class Pushy {
|
|
|
356
362
|
return server.backups;
|
|
357
363
|
};
|
|
358
364
|
downloadUpdate = async (
|
|
359
|
-
|
|
365
|
+
updateInfo: CheckResult,
|
|
360
366
|
onDownloadProgress?: (data: ProgressData) => void,
|
|
361
367
|
) => {
|
|
362
368
|
const {
|
|
@@ -368,15 +374,15 @@ export class Pushy {
|
|
|
368
374
|
name,
|
|
369
375
|
description = '',
|
|
370
376
|
metaInfo,
|
|
371
|
-
} =
|
|
377
|
+
} = updateInfo;
|
|
372
378
|
if (
|
|
373
379
|
this.options.beforeDownloadUpdate &&
|
|
374
|
-
(await this.options.beforeDownloadUpdate(
|
|
380
|
+
(await this.options.beforeDownloadUpdate(updateInfo)) === false
|
|
375
381
|
) {
|
|
376
382
|
log('beforeDownloadUpdate returned false, skipping download');
|
|
377
383
|
return;
|
|
378
384
|
}
|
|
379
|
-
if (!
|
|
385
|
+
if (!updateInfo.update || !hash) {
|
|
380
386
|
return;
|
|
381
387
|
}
|
|
382
388
|
if (rolledBackVersion === hash) {
|
package/src/core.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
|
-
import { emptyModule, log } from './utils';
|
|
2
|
+
import { emptyModule, error, log } from './utils';
|
|
3
|
+
import i18n from './i18n';
|
|
3
4
|
const {
|
|
4
5
|
version: v,
|
|
5
6
|
} = require('react-native/Libraries/Core/ReactNativeVersion');
|
|
@@ -46,10 +47,9 @@ if (currentVersionInfoString) {
|
|
|
46
47
|
delete _currentVersionInfo.debugChannel;
|
|
47
48
|
setLocalHashInfo(currentVersion, _currentVersionInfo);
|
|
48
49
|
}
|
|
49
|
-
} catch (
|
|
50
|
-
|
|
51
|
-
'
|
|
52
|
-
currentVersionInfoString,
|
|
50
|
+
} catch (err) {
|
|
51
|
+
error(
|
|
52
|
+
i18n.t('error_parse_version_info', { info: currentVersionInfoString }),
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/locales/en.ts
CHANGED
|
@@ -44,6 +44,7 @@ export default {
|
|
|
44
44
|
|
|
45
45
|
// Error messages
|
|
46
46
|
error_appkey_required: 'appKey is required',
|
|
47
|
+
error_parse_version_info: 'Failed to parse currentVersionInfo: {{info}}',
|
|
47
48
|
error_update_check_failed: 'Update check failed',
|
|
48
49
|
error_cannot_connect_server:
|
|
49
50
|
'Can not connect to update server. Please check your network.',
|
package/src/locales/zh.ts
CHANGED
|
@@ -42,6 +42,7 @@ export default {
|
|
|
42
42
|
|
|
43
43
|
// Error messages
|
|
44
44
|
error_appkey_required: '需要提供 appKey',
|
|
45
|
+
error_parse_version_info: '解析 currentVersionInfo 失败: {{info}}',
|
|
45
46
|
error_update_check_failed: '更新检查失败',
|
|
46
47
|
error_cannot_connect_server: '无法连接到更新服务器。请检查网络连接。',
|
|
47
48
|
error_cannot_connect_backup:
|
package/src/utils.ts
CHANGED
|
@@ -5,6 +5,18 @@ export function log(...args: any[]) {
|
|
|
5
5
|
console.log(i18n.t('dev_log_prefix'), ...args);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export function info(...args: any[]) {
|
|
9
|
+
console.info(i18n.t('dev_log_prefix'), ...args);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function warn(...args: any[]) {
|
|
13
|
+
console.warn(i18n.t('dev_log_prefix'), ...args);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function error(...args: any[]) {
|
|
17
|
+
console.error(i18n.t('dev_log_prefix'), ...args);
|
|
18
|
+
}
|
|
19
|
+
|
|
8
20
|
export const isWeb = Platform.OS === 'web';
|
|
9
21
|
|
|
10
22
|
export function promiseAny<T>(promises: Promise<T>[]) {
|
|
@@ -93,7 +105,7 @@ export const testUrls = async (urls?: string[]) => {
|
|
|
93
105
|
|
|
94
106
|
export const assertWeb = () => {
|
|
95
107
|
if (isWeb) {
|
|
96
|
-
|
|
108
|
+
warn(i18n.t('dev_web_not_supported'));
|
|
97
109
|
return false;
|
|
98
110
|
}
|
|
99
111
|
return true;
|