react-native-update 10.37.15 → 10.37.16

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.
Files changed (68) hide show
  1. package/README-CN.md +72 -0
  2. package/README.md +61 -49
  3. package/bunfig.toml +2 -0
  4. package/harmony/har-wrapper/AppScope/app.json5 +8 -0
  5. package/harmony/har-wrapper/build-profile.json5 +35 -0
  6. package/harmony/har-wrapper/hvigor/hvigor-config.json5 +5 -0
  7. package/harmony/har-wrapper/hvigorfile.ts +6 -0
  8. package/harmony/har-wrapper/oh-package.json5 +4 -0
  9. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/cache-v2-77b153ce45aba0ed28ef.json +1415 -0
  10. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/cmakeFiles-v1-b65a07793384e0ce3e08.json +809 -0
  11. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/codemodel-v2-ce0e89410afd8bf3a057.json +60 -0
  12. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/directory-.-Release-f5ebdc15457944623624.json +14 -0
  13. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/index-2026-03-16T14-00-08-0134.json +89 -0
  14. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.cmake/api/v1/reply/target-rnupdate-Release-267153624504c9c3ffdd.json +222 -0
  15. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.ninja_deps +0 -0
  16. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/.ninja_log +8 -0
  17. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeCache.txt +415 -0
  18. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeCCompiler.cmake +74 -0
  19. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeCXXCompiler.cmake +85 -0
  20. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeDetermineCompilerABI_C.bin +0 -0
  21. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
  22. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CMakeSystem.cmake +15 -0
  23. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CompilerIdC/CMakeCCompilerId.c +880 -0
  24. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CompilerIdC/CMakeCCompilerId.o +0 -0
  25. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +869 -0
  26. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/3.28.2/CompilerIdCXX/CMakeCXXCompilerId.o +0 -0
  27. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/CMakeConfigureLog.yaml +388 -0
  28. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/TargetDirectories.txt +3 -0
  29. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/cmake.check_cache +1 -0
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/rnupdate.dir/pushy.c.o +0 -0
  36. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/CMakeFiles/rules.ninja +64 -0
  37. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/additional_project_files.txt +0 -0
  38. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/build.ninja +206 -0
  39. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/build_file_index.txt +1 -0
  40. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/cmake_install.cmake +54 -0
  41. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/compile_commands.json +38 -0
  42. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/configure_fingerprint.json +1 -0
  43. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/hvigor_native_config.json +1 -0
  44. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/metadata_generation_command.txt +17 -0
  45. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/native_work_dir.txt +1 -0
  46. package/harmony/pushy/.cxx/default/default/release/arm64-v8a/output.log +14 -0
  47. package/harmony/pushy/.cxx/default/default/release/hvigor/arm64-v8a/summary.cmake +0 -0
  48. package/harmony/pushy/BuildProfile.ets +3 -5
  49. package/harmony/pushy/build-profile.json5 +8 -1
  50. package/harmony/pushy/oh-package-lock.json5 +1 -1
  51. package/harmony/pushy/src/main/cpp/CMakeLists.txt +42 -30
  52. package/harmony/pushy/src/main/ets/DownloadTask.ts +145 -106
  53. package/harmony/pushy/src/main/ets/Logger.ts +24 -7
  54. package/harmony/pushy/src/main/ets/PushyFileJSBundleProvider.ets +1 -1
  55. package/harmony/pushy/src/main/ets/PushyTurboModule.ts +9 -73
  56. package/harmony/pushy/src/main/ets/UpdateContext.ts +206 -70
  57. package/harmony/pushy.har +0 -0
  58. package/package.json +2 -1
  59. package/scripts/build-harmony-har.js +427 -0
  60. package/scripts/prepublish.ts +66 -4
  61. package/src/__tests__/core.test.ts +103 -0
  62. package/src/__tests__/setup.ts +37 -0
  63. package/src/__tests__/utils.test.ts +36 -0
  64. package/src/client.ts +14 -8
  65. package/src/core.ts +5 -5
  66. package/src/locales/en.ts +1 -0
  67. package/src/locales/zh.ts +1 -0
  68. 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
- console.info(this.t('dev_debug_disabled', { matter }));
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 = Array.from(
349
- new Set([...(server.backups || []), ...remoteEndpoints]),
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
- info: CheckResult,
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
- } = info;
377
+ } = updateInfo;
372
378
  if (
373
379
  this.options.beforeDownloadUpdate &&
374
- (await this.options.beforeDownloadUpdate(info)) === false
380
+ (await this.options.beforeDownloadUpdate(updateInfo)) === false
375
381
  ) {
376
382
  log('beforeDownloadUpdate returned false, skipping download');
377
383
  return;
378
384
  }
379
- if (!info.update || !hash) {
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 (error) {
50
- console.error(
51
- 'Failed to parse currentVersionInfo:',
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
- console.warn(i18n.t('dev_web_not_supported'));
108
+ warn(i18n.t('dev_web_not_supported'));
97
109
  return false;
98
110
  }
99
111
  return true;