react-native-update 10.59.2 → 10.61.0

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 (877) hide show
  1. package/README-CN.md +13 -7
  2. package/README.md +15 -6
  3. package/android/build.gradle +25 -33
  4. package/android/jni/Android.mk +18 -24
  5. package/android/jni/Application.mk +3 -1
  6. package/android/lib/arm64-v8a/librnpushy.so +0 -0
  7. package/android/lib/armeabi-v7a/librnpushy.so +0 -0
  8. package/android/lib/x86/librnpushy.so +0 -0
  9. package/android/lib/x86_64/librnpushy.so +0 -0
  10. package/android/proguard.pro +9 -7
  11. package/android/src/main/java/cn/reactnative/modules/update/ApkInstaller.java +3 -8
  12. package/android/src/main/java/cn/reactnative/modules/update/ArchiveLimits.java +24 -6
  13. package/android/src/main/java/cn/reactnative/modules/update/BundlePreparationResult.java +2 -0
  14. package/android/src/main/java/cn/reactnative/modules/update/BundledResourceCopier.java +50 -51
  15. package/android/src/main/java/cn/reactnative/modules/update/CleanupKeepNames.java +12 -13
  16. package/android/src/main/java/cn/reactnative/modules/update/CopyGroupResult.java +3 -0
  17. package/android/src/main/java/cn/reactnative/modules/update/CrashHold.java +22 -30
  18. package/android/src/main/java/cn/reactnative/modules/update/DownloadTask.java +284 -452
  19. package/android/src/main/java/cn/reactnative/modules/update/DownloadTaskParams.java +8 -4
  20. package/android/src/main/java/cn/reactnative/modules/update/ErrorCodes.java +32 -3
  21. package/android/src/main/java/cn/reactnative/modules/update/FileOperationException.java +1 -1
  22. package/android/src/main/java/cn/reactnative/modules/update/FlowBridge.java +39 -8
  23. package/android/src/main/java/cn/reactnative/modules/update/HttpClients.java +63 -0
  24. package/android/src/main/java/cn/reactnative/modules/update/HttpUtils.java +0 -45
  25. package/android/src/main/java/cn/reactnative/modules/update/InstallRecord.java +68 -116
  26. package/android/src/main/java/cn/reactnative/modules/update/NativeCore.java +10 -2
  27. package/android/src/main/java/cn/reactnative/modules/update/PatchFailedException.java +1 -1
  28. package/android/src/main/java/cn/reactnative/modules/update/PushyRuntime.java +53 -62
  29. package/android/src/main/java/cn/reactnative/modules/update/ReactReloadManager.java +9 -24
  30. package/android/src/main/java/cn/reactnative/modules/update/ResumePlan.java +31 -0
  31. package/android/src/main/java/cn/reactnative/modules/update/SafeZipFile.java +42 -80
  32. package/android/src/main/java/cn/reactnative/modules/update/StateSerialRunner.java +22 -39
  33. package/android/src/main/java/cn/reactnative/modules/update/SyncCoordinator.java +474 -500
  34. package/android/src/main/java/cn/reactnative/modules/update/Texts.java +15 -1
  35. package/android/src/main/java/cn/reactnative/modules/update/Threads.java +44 -0
  36. package/android/src/main/java/cn/reactnative/modules/update/UpdateContext.java +265 -188
  37. package/android/src/main/java/cn/reactnative/modules/update/UpdateEventEmitter.java +1 -1
  38. package/android/src/main/java/cn/reactnative/modules/update/UpdateFileUtils.java +75 -17
  39. package/android/src/main/java/cn/reactnative/modules/update/{UpdateModuleImpl.java → UpdateModule.java} +114 -96
  40. package/android/src/main/java/cn/reactnative/modules/update/UpdatePackage.java +16 -19
  41. package/android/src/main/java/cn/reactnative/modules/update/VersionScopedKeys.java +64 -0
  42. package/android/src/oldarch/cn/reactnative/modules/update/NativePushySpec.java +71 -0
  43. package/cpp/android_jni/archive_limits_jni.cpp +83 -0
  44. package/cpp/android_jni/install_record_jni.cpp +89 -0
  45. package/cpp/android_jni/jni_log.h +30 -0
  46. package/cpp/android_jni/jni_natives.h +46 -0
  47. package/cpp/android_jni/jni_registration.cpp +146 -0
  48. package/cpp/android_jni/jni_util.h +160 -0
  49. package/cpp/android_jni/resume_plan_jni.cpp +58 -0
  50. package/cpp/android_jni/update_core_android.cpp +448 -0
  51. package/cpp/android_jni/update_flow_jni.cpp +150 -0
  52. package/{android/jni → cpp/hpatch}/hpatch.c +5 -5
  53. package/{android/jni → cpp/hpatch}/hpatch.h +4 -1
  54. package/cpp/patch_core/archive_limits.cpp +194 -0
  55. package/cpp/patch_core/archive_limits.h +101 -10
  56. package/cpp/patch_core/archive_patch_core.cpp +98 -15
  57. package/cpp/patch_core/archive_patch_core.h +51 -0
  58. package/cpp/patch_core/digest.h +5 -4
  59. package/cpp/patch_core/error_codes.h +15 -11
  60. package/cpp/patch_core/install_record.cpp +430 -0
  61. package/cpp/patch_core/install_record.h +165 -9
  62. package/cpp/patch_core/native_texts.h +102 -0
  63. package/cpp/patch_core/patch_core.cpp +62 -16
  64. package/cpp/patch_core/patch_core.h +27 -7
  65. package/cpp/patch_core/patch_manifest.cpp +201 -0
  66. package/cpp/patch_core/patch_manifest.h +74 -0
  67. package/cpp/patch_core/resume_plan.cpp +226 -0
  68. package/cpp/patch_core/resume_plan.h +88 -0
  69. package/cpp/patch_core/state_ops.h +5 -3
  70. package/cpp/update_flow_core/flow_json.cpp +82 -8
  71. package/cpp/update_flow_core/flow_json.h +21 -0
  72. package/cpp/update_flow_core/native_config.cpp +436 -0
  73. package/cpp/update_flow_core/native_config.h +84 -0
  74. package/cpp/update_flow_core/native_round.cpp +321 -0
  75. package/cpp/update_flow_core/native_round.h +94 -0
  76. package/cpp/update_flow_core/round_engine.cpp +456 -0
  77. package/cpp/update_flow_core/round_engine.h +106 -0
  78. package/cpp/update_flow_core/update_flow_core.cpp +5 -14
  79. package/cpp/update_flow_core/update_flow_core.h +2 -2
  80. package/harmony/hvigor-plugin.ts +11 -19
  81. package/harmony/pushy/src/main/cpp/CMakeLists.txt +19 -26
  82. package/harmony/pushy/src/main/cpp/PushyPackage.h +2 -2
  83. package/harmony/pushy/src/main/cpp/PushyTurboModule.cpp +57 -94
  84. package/harmony/pushy/src/main/cpp/pushy.cpp +817 -518
  85. package/harmony/pushy/src/main/ets/ArchiveLimits.ts +55 -75
  86. package/harmony/pushy/src/main/ets/DownloadTask.ts +279 -539
  87. package/harmony/pushy/src/main/ets/DownloadTaskParams.ts +6 -6
  88. package/harmony/pushy/src/main/ets/ErrorCodes.ts +3 -15
  89. package/harmony/pushy/src/main/ets/EventHub.ts +1 -1
  90. package/harmony/pushy/src/main/ets/InstallRecord.ts +54 -151
  91. package/harmony/pushy/src/main/ets/Logger.ts +20 -34
  92. package/harmony/pushy/src/main/ets/NativePatchCore.ts +150 -41
  93. package/harmony/pushy/src/main/ets/PushyConfiguration.ts +8 -85
  94. package/harmony/pushy/src/main/ets/PushyFileJSBundleProvider.ets +8 -3
  95. package/harmony/pushy/src/main/ets/PushyTurboModule.ts +11 -25
  96. package/harmony/pushy/src/main/ets/SaveFile.ts +99 -18
  97. package/harmony/pushy/src/main/ets/SyncCoordinator.ts +291 -543
  98. package/harmony/pushy/src/main/ets/Texts.ts +8 -7
  99. package/harmony/pushy/src/main/ets/UpdateContext.ts +245 -152
  100. package/harmony/pushy.har +0 -0
  101. package/ios/RCTPushy/RCTPushy+Launch.mm +190 -0
  102. package/ios/RCTPushy/RCTPushy.h +12 -0
  103. package/ios/RCTPushy/RCTPushy.mm +135 -2666
  104. package/ios/RCTPushy/RCTPushyCommon.h +28 -0
  105. package/ios/RCTPushy/RCTPushyConfiguration.h +0 -8
  106. package/ios/RCTPushy/RCTPushyConfiguration.mm +40 -123
  107. package/ios/RCTPushy/RCTPushyDownloader.mm +152 -198
  108. package/ios/RCTPushy/RCTPushyInstallRecord.mm +101 -0
  109. package/ios/RCTPushy/RCTPushyInstaller.mm +732 -0
  110. package/ios/RCTPushy/RCTPushyInternal.h +185 -0
  111. package/ios/RCTPushy/RCTPushyOrchestrator.mm +969 -0
  112. package/ios/RCTPushy/RCTPushyState.mm +382 -0
  113. package/package.json +46 -25
  114. package/react-native-update.podspec +73 -82
  115. package/src/client.ts +126 -1633
  116. package/src/clientActivation.ts +324 -0
  117. package/src/clientCheck.ts +405 -0
  118. package/src/clientDownload.ts +448 -0
  119. package/src/clientNativeConfig.ts +171 -0
  120. package/src/clientReporter.ts +398 -0
  121. package/src/clientState.ts +51 -0
  122. package/src/context.ts +1 -1
  123. package/src/core.ts +39 -10
  124. package/src/endpoint.ts +22 -8
  125. package/src/error.ts +18 -35
  126. package/src/i18n.ts +18 -83
  127. package/src/locales/en.ts +1 -5
  128. package/src/locales/zh.ts +1 -5
  129. package/src/provider.tsx +86 -67
  130. package/src/telemetry.ts +0 -13
  131. package/src/type.ts +0 -15
  132. package/src/updateFlowCore.ts +116 -10
  133. package/src/utils.ts +49 -42
  134. package/android/jni/HDiffPatch/.travis.yml +0 -33
  135. package/android/jni/HDiffPatch/CHANGELOG.md +0 -153
  136. package/android/jni/HDiffPatch/Makefile +0 -157
  137. package/android/jni/HDiffPatch/_atosize.h +0 -83
  138. package/android/jni/HDiffPatch/_clock_for_demo.h +0 -47
  139. package/android/jni/HDiffPatch/_dir_ignore.h +0 -191
  140. package/android/jni/HDiffPatch/builds/android_ndk_jni_mk/Android.mk +0 -37
  141. package/android/jni/HDiffPatch/builds/android_ndk_jni_mk/Application.mk +0 -7
  142. package/android/jni/HDiffPatch/builds/android_ndk_jni_mk/build_libs.bat +0 -1
  143. package/android/jni/HDiffPatch/builds/android_ndk_jni_mk/build_libs.sh +0 -1
  144. package/android/jni/HDiffPatch/builds/android_ndk_jni_mk/hpatch.c +0 -18
  145. package/android/jni/HDiffPatch/builds/android_ndk_jni_mk/hpatch.h +0 -20
  146. package/android/jni/HDiffPatch/builds/android_ndk_jni_mk/hpatch_jni.c +0 -28
  147. package/android/jni/HDiffPatch/builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.java +0 -8
  148. package/android/jni/HDiffPatch/builds/codeblocks/HDiffPatch.workspace +0 -8
  149. package/android/jni/HDiffPatch/builds/codeblocks/HDiffZ.cbp +0 -219
  150. package/android/jni/HDiffPatch/builds/codeblocks/HPatchZ.cbp +0 -156
  151. package/android/jni/HDiffPatch/builds/codeblocks/unitTest.cbp +0 -65
  152. package/android/jni/HDiffPatch/builds/vc/HDiffPatch.sln +0 -105
  153. package/android/jni/HDiffPatch/builds/vc/HDiffZ.vcxproj +0 -237
  154. package/android/jni/HDiffPatch/builds/vc/HDiffZ.vcxproj.user +0 -3
  155. package/android/jni/HDiffPatch/builds/vc/HPatchZ.vcxproj +0 -318
  156. package/android/jni/HDiffPatch/builds/vc/HPatchZ.vcxproj.user +0 -3
  157. package/android/jni/HDiffPatch/builds/vc/unitTest.vcxproj +0 -182
  158. package/android/jni/HDiffPatch/builds/vc/unitTest.vcxproj.user +0 -3
  159. package/android/jni/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/contents.xcworkspacedata +0 -30
  160. package/android/jni/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  161. package/android/jni/HDiffPatch/builds/xcode/bestParams.xcodeproj/project.pbxproj +0 -408
  162. package/android/jni/HDiffPatch/builds/xcode/bestParams.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  163. package/android/jni/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.pbxproj +0 -573
  164. package/android/jni/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  165. package/android/jni/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  166. package/android/jni/HDiffPatch/builds/xcode/hpatchz.xcodeproj/project.pbxproj +0 -396
  167. package/android/jni/HDiffPatch/builds/xcode/hpatchz.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  168. package/android/jni/HDiffPatch/builds/xcode/lz4.xcodeproj/project.pbxproj +0 -268
  169. package/android/jni/HDiffPatch/builds/xcode/lz4.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  170. package/android/jni/HDiffPatch/builds/xcode/lzma.xcodeproj/project.pbxproj +0 -361
  171. package/android/jni/HDiffPatch/builds/xcode/lzma.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  172. package/android/jni/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.pbxproj +0 -301
  173. package/android/jni/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  174. package/android/jni/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  175. package/android/jni/HDiffPatch/builds/xcode/unitTest.xcodeproj/project.pbxproj +0 -411
  176. package/android/jni/HDiffPatch/builds/xcode/unitTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  177. package/android/jni/HDiffPatch/builds/xcode/zstd.xcodeproj/project.pbxproj +0 -504
  178. package/android/jni/HDiffPatch/builds/xcode/zstd.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  179. package/android/jni/HDiffPatch/checksum_plugin_demo.h +0 -344
  180. package/android/jni/HDiffPatch/compress_parallel.cpp +0 -166
  181. package/android/jni/HDiffPatch/compress_parallel.h +0 -59
  182. package/android/jni/HDiffPatch/compress_plugin_demo.h +0 -1152
  183. package/android/jni/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.cpp +0 -797
  184. package/android/jni/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.h +0 -65
  185. package/android/jni/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.cpp +0 -200
  186. package/android/jni/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.h +0 -178
  187. package/android/jni/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.cpp +0 -357
  188. package/android/jni/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.h +0 -87
  189. package/android/jni/HDiffPatch/dirDiffPatch/dir_diff/file_for_dirDiff.h +0 -151
  190. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.c +0 -770
  191. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.h +0 -236
  192. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_private.h +0 -47
  193. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.c +0 -112
  194. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.h +0 -53
  195. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.c +0 -331
  196. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.h +0 -144
  197. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/new_stream.c +0 -176
  198. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/new_stream.h +0 -84
  199. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.c +0 -146
  200. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.h +0 -61
  201. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.c +0 -152
  202. package/android/jni/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.h +0 -76
  203. package/android/jni/HDiffPatch/hdiffz.cpp +0 -1570
  204. package/android/jni/HDiffPatch/hpatch_dir_listener.h +0 -290
  205. package/android/jni/HDiffPatch/hpatchz.c +0 -1221
  206. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/diff.cpp +0 -1025
  207. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/diff.h +0 -116
  208. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/diff_types.h +0 -72
  209. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.cpp +0 -213
  210. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.h +0 -63
  211. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.cpp +0 -170
  212. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.h +0 -86
  213. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/config.h +0 -89
  214. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c +0 -13
  215. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c.inc.h +0 -398
  216. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.h +0 -194
  217. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.c +0 -13
  218. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.h +0 -204
  219. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort_private.h +0 -207
  220. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/sssort.c.inc.h +0 -815
  221. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/trsort.c.inc.h +0 -586
  222. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/utils.c.inc.h +0 -381
  223. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c +0 -352
  224. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.h +0 -137
  225. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/bloom_filter.h +0 -137
  226. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/covers.h +0 -70
  227. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp +0 -628
  228. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.h +0 -87
  229. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp +0 -363
  230. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.h +0 -139
  231. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/mem_buf.h +0 -68
  232. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/pack_uint.h +0 -115
  233. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.cpp +0 -342
  234. package/android/jni/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.h +0 -94
  235. package/android/jni/HDiffPatch/libHDiffPatch/HPatch/checksum_plugin.h +0 -52
  236. package/android/jni/HDiffPatch/libParallel/parallel_channel.cpp +0 -174
  237. package/android/jni/HDiffPatch/libParallel/parallel_channel.h +0 -73
  238. package/android/jni/HDiffPatch/libParallel/parallel_import.cpp +0 -367
  239. package/android/jni/HDiffPatch/libParallel/parallel_import.h +0 -92
  240. package/android/jni/lzma/Asm/arm/7zCrcOpt.asm +0 -100
  241. package/android/jni/lzma/Asm/x86/7zAsm.asm +0 -147
  242. package/android/jni/lzma/Asm/x86/7zCrcOpt.asm +0 -147
  243. package/android/jni/lzma/Asm/x86/AesOpt.asm +0 -237
  244. package/android/jni/lzma/Asm/x86/LzmaDecOpt.asm +0 -1258
  245. package/android/jni/lzma/Asm/x86/XzCrc64Opt.asm +0 -205
  246. package/android/jni/lzma/C/7z.h +0 -202
  247. package/android/jni/lzma/C/7zAlloc.c +0 -80
  248. package/android/jni/lzma/C/7zAlloc.h +0 -19
  249. package/android/jni/lzma/C/7zArcIn.c +0 -1771
  250. package/android/jni/lzma/C/7zBuf.c +0 -36
  251. package/android/jni/lzma/C/7zBuf.h +0 -35
  252. package/android/jni/lzma/C/7zBuf2.c +0 -52
  253. package/android/jni/lzma/C/7zCrc.c +0 -128
  254. package/android/jni/lzma/C/7zCrc.h +0 -25
  255. package/android/jni/lzma/C/7zCrcOpt.c +0 -115
  256. package/android/jni/lzma/C/7zDec.c +0 -591
  257. package/android/jni/lzma/C/7zFile.c +0 -286
  258. package/android/jni/lzma/C/7zFile.h +0 -83
  259. package/android/jni/lzma/C/7zStream.c +0 -176
  260. package/android/jni/lzma/C/7zVersion.h +0 -27
  261. package/android/jni/lzma/C/7zVersion.rc +0 -55
  262. package/android/jni/lzma/C/Aes.c +0 -306
  263. package/android/jni/lzma/C/Aes.h +0 -38
  264. package/android/jni/lzma/C/AesOpt.c +0 -184
  265. package/android/jni/lzma/C/Alloc.c +0 -455
  266. package/android/jni/lzma/C/Alloc.h +0 -51
  267. package/android/jni/lzma/C/Bcj2.c +0 -257
  268. package/android/jni/lzma/C/Bcj2.h +0 -146
  269. package/android/jni/lzma/C/Bcj2Enc.c +0 -311
  270. package/android/jni/lzma/C/Bra.c +0 -230
  271. package/android/jni/lzma/C/Bra.h +0 -64
  272. package/android/jni/lzma/C/Bra86.c +0 -82
  273. package/android/jni/lzma/C/BraIA64.c +0 -53
  274. package/android/jni/lzma/C/CpuArch.c +0 -218
  275. package/android/jni/lzma/C/CpuArch.h +0 -336
  276. package/android/jni/lzma/C/Delta.c +0 -64
  277. package/android/jni/lzma/C/Delta.h +0 -19
  278. package/android/jni/lzma/C/DllSecur.c +0 -108
  279. package/android/jni/lzma/C/DllSecur.h +0 -20
  280. package/android/jni/lzma/C/LzFind.c +0 -1127
  281. package/android/jni/lzma/C/LzFind.h +0 -121
  282. package/android/jni/lzma/C/LzFindMt.c +0 -853
  283. package/android/jni/lzma/C/LzFindMt.h +0 -101
  284. package/android/jni/lzma/C/LzHash.h +0 -57
  285. package/android/jni/lzma/C/Lzma2DecMt.c +0 -1082
  286. package/android/jni/lzma/C/Lzma2DecMt.h +0 -79
  287. package/android/jni/lzma/C/Lzma2Enc.c +0 -803
  288. package/android/jni/lzma/C/Lzma2Enc.h +0 -55
  289. package/android/jni/lzma/C/Lzma86.h +0 -111
  290. package/android/jni/lzma/C/Lzma86Dec.c +0 -54
  291. package/android/jni/lzma/C/Lzma86Enc.c +0 -106
  292. package/android/jni/lzma/C/LzmaEnc.c +0 -2976
  293. package/android/jni/lzma/C/LzmaEnc.h +0 -76
  294. package/android/jni/lzma/C/LzmaLib.c +0 -40
  295. package/android/jni/lzma/C/LzmaLib.h +0 -131
  296. package/android/jni/lzma/C/MtCoder.c +0 -601
  297. package/android/jni/lzma/C/MtCoder.h +0 -141
  298. package/android/jni/lzma/C/MtDec.c +0 -1138
  299. package/android/jni/lzma/C/MtDec.h +0 -201
  300. package/android/jni/lzma/C/Ppmd.h +0 -85
  301. package/android/jni/lzma/C/Ppmd7.c +0 -712
  302. package/android/jni/lzma/C/Ppmd7.h +0 -142
  303. package/android/jni/lzma/C/Ppmd7Dec.c +0 -191
  304. package/android/jni/lzma/C/Ppmd7Enc.c +0 -187
  305. package/android/jni/lzma/C/RotateDefs.h +0 -30
  306. package/android/jni/lzma/C/Sha256.c +0 -248
  307. package/android/jni/lzma/C/Sha256.h +0 -26
  308. package/android/jni/lzma/C/Sort.c +0 -141
  309. package/android/jni/lzma/C/Sort.h +0 -18
  310. package/android/jni/lzma/C/Threads.c +0 -95
  311. package/android/jni/lzma/C/Threads.h +0 -70
  312. package/android/jni/lzma/C/ThreadsP.c +0 -396
  313. package/android/jni/lzma/C/ThreadsP.h +0 -31
  314. package/android/jni/lzma/C/Util/7z/7z.dsp +0 -241
  315. package/android/jni/lzma/C/Util/7z/7z.dsw +0 -29
  316. package/android/jni/lzma/C/Util/7z/7zMain.c +0 -686
  317. package/android/jni/lzma/C/Util/7z/Precomp.c +0 -4
  318. package/android/jni/lzma/C/Util/7z/Precomp.h +0 -10
  319. package/android/jni/lzma/C/Util/7z/makefile +0 -40
  320. package/android/jni/lzma/C/Util/7z/makefile.gcc +0 -75
  321. package/android/jni/lzma/C/Util/Lzma/LzmaUtil.c +0 -258
  322. package/android/jni/lzma/C/Util/Lzma/LzmaUtil.dsp +0 -168
  323. package/android/jni/lzma/C/Util/Lzma/LzmaUtil.dsw +0 -29
  324. package/android/jni/lzma/C/Util/Lzma/makefile +0 -28
  325. package/android/jni/lzma/C/Util/Lzma/makefile.gcc +0 -44
  326. package/android/jni/lzma/C/Util/LzmaLib/LzmaLib.def +0 -4
  327. package/android/jni/lzma/C/Util/LzmaLib/LzmaLib.dsp +0 -178
  328. package/android/jni/lzma/C/Util/LzmaLib/LzmaLib.dsw +0 -29
  329. package/android/jni/lzma/C/Util/LzmaLib/LzmaLibExports.c +0 -14
  330. package/android/jni/lzma/C/Util/LzmaLib/makefile +0 -34
  331. package/android/jni/lzma/C/Util/LzmaLib/resource.rc +0 -3
  332. package/android/jni/lzma/C/Util/SfxSetup/Precomp.c +0 -4
  333. package/android/jni/lzma/C/Util/SfxSetup/Precomp.h +0 -10
  334. package/android/jni/lzma/C/Util/SfxSetup/SfxSetup.c +0 -640
  335. package/android/jni/lzma/C/Util/SfxSetup/SfxSetup.dsp +0 -231
  336. package/android/jni/lzma/C/Util/SfxSetup/SfxSetup.dsw +0 -29
  337. package/android/jni/lzma/C/Util/SfxSetup/makefile +0 -37
  338. package/android/jni/lzma/C/Util/SfxSetup/makefile_con +0 -38
  339. package/android/jni/lzma/C/Util/SfxSetup/resource.rc +0 -5
  340. package/android/jni/lzma/C/Util/SfxSetup/setup.ico +0 -0
  341. package/android/jni/lzma/C/Xz.c +0 -90
  342. package/android/jni/lzma/C/Xz.h +0 -460
  343. package/android/jni/lzma/C/XzCrc64.c +0 -86
  344. package/android/jni/lzma/C/XzCrc64.h +0 -26
  345. package/android/jni/lzma/C/XzCrc64Opt.c +0 -69
  346. package/android/jni/lzma/C/XzDec.c +0 -2766
  347. package/android/jni/lzma/C/XzEnc.c +0 -1329
  348. package/android/jni/lzma/C/XzEnc.h +0 -60
  349. package/android/jni/lzma/C/XzIn.c +0 -319
  350. package/android/jni/lzma/CPP/7zip/7zip.mak +0 -240
  351. package/android/jni/lzma/CPP/7zip/Aes.mak +0 -7
  352. package/android/jni/lzma/CPP/7zip/Archive/7z/7zCompressionMode.cpp +0 -3
  353. package/android/jni/lzma/CPP/7zip/Archive/7z/7zCompressionMode.h +0 -76
  354. package/android/jni/lzma/CPP/7zip/Archive/7z/7zDecode.cpp +0 -569
  355. package/android/jni/lzma/CPP/7zip/Archive/7z/7zDecode.h +0 -70
  356. package/android/jni/lzma/CPP/7zip/Archive/7z/7zEncode.cpp +0 -678
  357. package/android/jni/lzma/CPP/7zip/Archive/7z/7zEncode.h +0 -92
  358. package/android/jni/lzma/CPP/7zip/Archive/7z/7zExtract.cpp +0 -423
  359. package/android/jni/lzma/CPP/7zip/Archive/7z/7zFolderInStream.cpp +0 -139
  360. package/android/jni/lzma/CPP/7zip/Archive/7z/7zFolderInStream.h +0 -61
  361. package/android/jni/lzma/CPP/7zip/Archive/7z/7zHandler.cpp +0 -763
  362. package/android/jni/lzma/CPP/7zip/Archive/7z/7zHandler.h +0 -181
  363. package/android/jni/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp +0 -942
  364. package/android/jni/lzma/CPP/7zip/Archive/7z/7zHeader.cpp +0 -19
  365. package/android/jni/lzma/CPP/7zip/Archive/7z/7zHeader.h +0 -148
  366. package/android/jni/lzma/CPP/7zip/Archive/7z/7zIn.cpp +0 -1666
  367. package/android/jni/lzma/CPP/7zip/Archive/7z/7zIn.h +0 -445
  368. package/android/jni/lzma/CPP/7zip/Archive/7z/7zItem.h +0 -202
  369. package/android/jni/lzma/CPP/7zip/Archive/7z/7zOut.cpp +0 -901
  370. package/android/jni/lzma/CPP/7zip/Archive/7z/7zOut.h +0 -335
  371. package/android/jni/lzma/CPP/7zip/Archive/7z/7zProperties.cpp +0 -174
  372. package/android/jni/lzma/CPP/7zip/Archive/7z/7zProperties.h +0 -22
  373. package/android/jni/lzma/CPP/7zip/Archive/7z/7zRegister.cpp +0 -21
  374. package/android/jni/lzma/CPP/7zip/Archive/7z/7zSpecStream.cpp +0 -22
  375. package/android/jni/lzma/CPP/7zip/Archive/7z/7zSpecStream.h +0 -35
  376. package/android/jni/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp +0 -2500
  377. package/android/jni/lzma/CPP/7zip/Archive/7z/7zUpdate.h +0 -139
  378. package/android/jni/lzma/CPP/7zip/Archive/7z/StdAfx.cpp +0 -3
  379. package/android/jni/lzma/CPP/7zip/Archive/7z/StdAfx.h +0 -8
  380. package/android/jni/lzma/CPP/7zip/Archive/Archive.def +0 -12
  381. package/android/jni/lzma/CPP/7zip/Archive/Archive2.def +0 -19
  382. package/android/jni/lzma/CPP/7zip/Archive/ArchiveExports.cpp +0 -151
  383. package/android/jni/lzma/CPP/7zip/Archive/Common/CoderMixer2.cpp +0 -1125
  384. package/android/jni/lzma/CPP/7zip/Archive/Common/CoderMixer2.h +0 -447
  385. package/android/jni/lzma/CPP/7zip/Archive/Common/DummyOutStream.cpp +0 -17
  386. package/android/jni/lzma/CPP/7zip/Archive/Common/DummyOutStream.h +0 -25
  387. package/android/jni/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp +0 -232
  388. package/android/jni/lzma/CPP/7zip/Archive/Common/HandlerOut.h +0 -110
  389. package/android/jni/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +0 -46
  390. package/android/jni/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.h +0 -67
  391. package/android/jni/lzma/CPP/7zip/Archive/Common/ItemNameUtils.cpp +0 -88
  392. package/android/jni/lzma/CPP/7zip/Archive/Common/ItemNameUtils.h +0 -28
  393. package/android/jni/lzma/CPP/7zip/Archive/Common/MultiStream.cpp +0 -191
  394. package/android/jni/lzma/CPP/7zip/Archive/Common/MultiStream.h +0 -89
  395. package/android/jni/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +0 -18
  396. package/android/jni/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.h +0 -37
  397. package/android/jni/lzma/CPP/7zip/Archive/Common/ParseProperties.cpp +0 -3
  398. package/android/jni/lzma/CPP/7zip/Archive/Common/ParseProperties.h +0 -6
  399. package/android/jni/lzma/CPP/7zip/Archive/Common/StdAfx.h +0 -8
  400. package/android/jni/lzma/CPP/7zip/Archive/DllExports2.cpp +0 -122
  401. package/android/jni/lzma/CPP/7zip/Archive/IArchive.h +0 -608
  402. package/android/jni/lzma/CPP/7zip/Archive/Icons/7z.ico +0 -0
  403. package/android/jni/lzma/CPP/7zip/Archive/LzmaHandler.cpp +0 -629
  404. package/android/jni/lzma/CPP/7zip/Archive/SplitHandler.cpp +0 -359
  405. package/android/jni/lzma/CPP/7zip/Archive/StdAfx.h +0 -8
  406. package/android/jni/lzma/CPP/7zip/Archive/XzHandler.cpp +0 -1308
  407. package/android/jni/lzma/CPP/7zip/Archive/XzHandler.h +0 -11
  408. package/android/jni/lzma/CPP/7zip/Asm.mak +0 -9
  409. package/android/jni/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsp +0 -1910
  410. package/android/jni/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsw +0 -29
  411. package/android/jni/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.cpp +0 -3
  412. package/android/jni/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.h +0 -8
  413. package/android/jni/lzma/CPP/7zip/Bundles/Alone7z/makefile +0 -154
  414. package/android/jni/lzma/CPP/7zip/Bundles/Alone7z/resource.rc +0 -7
  415. package/android/jni/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp +0 -3
  416. package/android/jni/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h +0 -8
  417. package/android/jni/lzma/CPP/7zip/Bundles/Format7zExtractR/makefile +0 -96
  418. package/android/jni/lzma/CPP/7zip/Bundles/Format7zExtractR/resource.rc +0 -5
  419. package/android/jni/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.cpp +0 -3
  420. package/android/jni/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.h +0 -8
  421. package/android/jni/lzma/CPP/7zip/Bundles/Format7zR/makefile +0 -116
  422. package/android/jni/lzma/CPP/7zip/Bundles/Format7zR/resource.rc +0 -5
  423. package/android/jni/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +0 -799
  424. package/android/jni/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp +0 -477
  425. package/android/jni/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsw +0 -29
  426. package/android/jni/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.cpp +0 -3
  427. package/android/jni/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.h +0 -8
  428. package/android/jni/lzma/CPP/7zip/Bundles/LzmaCon/makefile +0 -59
  429. package/android/jni/lzma/CPP/7zip/Bundles/LzmaCon/makefile.gcc +0 -195
  430. package/android/jni/lzma/CPP/7zip/Bundles/LzmaCon/resource.rc +0 -3
  431. package/android/jni/lzma/CPP/7zip/Bundles/LzmaSpec/LzmaSpec.cpp +0 -715
  432. package/android/jni/lzma/CPP/7zip/Bundles/SFXCon/7z.ico +0 -0
  433. package/android/jni/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +0 -912
  434. package/android/jni/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsw +0 -29
  435. package/android/jni/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp +0 -482
  436. package/android/jni/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.cpp +0 -3
  437. package/android/jni/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.h +0 -8
  438. package/android/jni/lzma/CPP/7zip/Bundles/SFXCon/makefile +0 -134
  439. package/android/jni/lzma/CPP/7zip/Bundles/SFXCon/resource.rc +0 -5
  440. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.cpp +0 -246
  441. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.h +0 -86
  442. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +0 -137
  443. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h +0 -11
  444. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp +0 -803
  445. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsw +0 -29
  446. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp +0 -364
  447. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.cpp +0 -3
  448. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.h +0 -13
  449. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/makefile +0 -117
  450. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/resource.h +0 -6
  451. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/resource.rc +0 -16
  452. package/android/jni/lzma/CPP/7zip/Bundles/SFXSetup/setup.ico +0 -0
  453. package/android/jni/lzma/CPP/7zip/Bundles/SFXWin/7z.ico +0 -0
  454. package/android/jni/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp +0 -988
  455. package/android/jni/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsw +0 -29
  456. package/android/jni/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp +0 -241
  457. package/android/jni/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.cpp +0 -3
  458. package/android/jni/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.h +0 -14
  459. package/android/jni/lzma/CPP/7zip/Bundles/SFXWin/makefile +0 -153
  460. package/android/jni/lzma/CPP/7zip/Bundles/SFXWin/resource.h +0 -1
  461. package/android/jni/lzma/CPP/7zip/Bundles/SFXWin/resource.rc +0 -50
  462. package/android/jni/lzma/CPP/7zip/Common/CWrappers.cpp +0 -250
  463. package/android/jni/lzma/CPP/7zip/Common/CWrappers.h +0 -120
  464. package/android/jni/lzma/CPP/7zip/Common/CreateCoder.cpp +0 -536
  465. package/android/jni/lzma/CPP/7zip/Common/CreateCoder.h +0 -192
  466. package/android/jni/lzma/CPP/7zip/Common/FilePathAutoRename.cpp +0 -46
  467. package/android/jni/lzma/CPP/7zip/Common/FilePathAutoRename.h +0 -10
  468. package/android/jni/lzma/CPP/7zip/Common/FileStreams.cpp +0 -475
  469. package/android/jni/lzma/CPP/7zip/Common/FileStreams.h +0 -166
  470. package/android/jni/lzma/CPP/7zip/Common/FilterCoder.cpp +0 -435
  471. package/android/jni/lzma/CPP/7zip/Common/FilterCoder.h +0 -205
  472. package/android/jni/lzma/CPP/7zip/Common/InBuffer.cpp +0 -163
  473. package/android/jni/lzma/CPP/7zip/Common/InBuffer.h +0 -92
  474. package/android/jni/lzma/CPP/7zip/Common/InOutTempBuffer.cpp +0 -127
  475. package/android/jni/lzma/CPP/7zip/Common/InOutTempBuffer.h +0 -48
  476. package/android/jni/lzma/CPP/7zip/Common/LimitedStreams.cpp +0 -367
  477. package/android/jni/lzma/CPP/7zip/Common/LimitedStreams.h +0 -252
  478. package/android/jni/lzma/CPP/7zip/Common/LockedStream.cpp +0 -3
  479. package/android/jni/lzma/CPP/7zip/Common/LockedStream.h +0 -6
  480. package/android/jni/lzma/CPP/7zip/Common/MethodId.cpp +0 -3
  481. package/android/jni/lzma/CPP/7zip/Common/MethodId.h +0 -10
  482. package/android/jni/lzma/CPP/7zip/Common/MethodProps.cpp +0 -509
  483. package/android/jni/lzma/CPP/7zip/Common/MethodProps.h +0 -264
  484. package/android/jni/lzma/CPP/7zip/Common/OffsetStream.cpp +0 -39
  485. package/android/jni/lzma/CPP/7zip/Common/OffsetStream.h +0 -26
  486. package/android/jni/lzma/CPP/7zip/Common/OutBuffer.cpp +0 -111
  487. package/android/jni/lzma/CPP/7zip/Common/OutBuffer.h +0 -66
  488. package/android/jni/lzma/CPP/7zip/Common/ProgressUtils.cpp +0 -51
  489. package/android/jni/lzma/CPP/7zip/Common/ProgressUtils.h +0 -35
  490. package/android/jni/lzma/CPP/7zip/Common/PropId.cpp +0 -108
  491. package/android/jni/lzma/CPP/7zip/Common/RegisterArc.h +0 -78
  492. package/android/jni/lzma/CPP/7zip/Common/RegisterCodec.h +0 -106
  493. package/android/jni/lzma/CPP/7zip/Common/StdAfx.h +0 -8
  494. package/android/jni/lzma/CPP/7zip/Common/StreamBinder.cpp +0 -156
  495. package/android/jni/lzma/CPP/7zip/Common/StreamBinder.h +0 -60
  496. package/android/jni/lzma/CPP/7zip/Common/StreamObjects.cpp +0 -285
  497. package/android/jni/lzma/CPP/7zip/Common/StreamObjects.h +0 -157
  498. package/android/jni/lzma/CPP/7zip/Common/StreamUtils.cpp +0 -56
  499. package/android/jni/lzma/CPP/7zip/Common/StreamUtils.h +0 -13
  500. package/android/jni/lzma/CPP/7zip/Common/UniqBlocks.cpp +0 -57
  501. package/android/jni/lzma/CPP/7zip/Common/UniqBlocks.h +0 -26
  502. package/android/jni/lzma/CPP/7zip/Common/VirtThread.cpp +0 -48
  503. package/android/jni/lzma/CPP/7zip/Common/VirtThread.h +0 -24
  504. package/android/jni/lzma/CPP/7zip/Compress/Bcj2Coder.cpp +0 -666
  505. package/android/jni/lzma/CPP/7zip/Compress/Bcj2Coder.h +0 -120
  506. package/android/jni/lzma/CPP/7zip/Compress/Bcj2Register.cpp +0 -24
  507. package/android/jni/lzma/CPP/7zip/Compress/BcjCoder.cpp +0 -24
  508. package/android/jni/lzma/CPP/7zip/Compress/BcjCoder.h +0 -31
  509. package/android/jni/lzma/CPP/7zip/Compress/BcjRegister.cpp +0 -17
  510. package/android/jni/lzma/CPP/7zip/Compress/BranchMisc.cpp +0 -23
  511. package/android/jni/lzma/CPP/7zip/Compress/BranchMisc.h +0 -35
  512. package/android/jni/lzma/CPP/7zip/Compress/BranchRegister.cpp +0 -41
  513. package/android/jni/lzma/CPP/7zip/Compress/ByteSwap.cpp +0 -92
  514. package/android/jni/lzma/CPP/7zip/Compress/CodecExports.cpp +0 -344
  515. package/android/jni/lzma/CPP/7zip/Compress/CopyCoder.cpp +0 -120
  516. package/android/jni/lzma/CPP/7zip/Compress/CopyCoder.h +0 -49
  517. package/android/jni/lzma/CPP/7zip/Compress/CopyRegister.cpp +0 -15
  518. package/android/jni/lzma/CPP/7zip/Compress/DeltaFilter.cpp +0 -128
  519. package/android/jni/lzma/CPP/7zip/Compress/Lzma2Decoder.cpp +0 -265
  520. package/android/jni/lzma/CPP/7zip/Compress/Lzma2Decoder.h +0 -96
  521. package/android/jni/lzma/CPP/7zip/Compress/Lzma2Encoder.cpp +0 -122
  522. package/android/jni/lzma/CPP/7zip/Compress/Lzma2Encoder.h +0 -42
  523. package/android/jni/lzma/CPP/7zip/Compress/Lzma2Register.cpp +0 -22
  524. package/android/jni/lzma/CPP/7zip/Compress/LzmaDecoder.cpp +0 -343
  525. package/android/jni/lzma/CPP/7zip/Compress/LzmaDecoder.h +0 -113
  526. package/android/jni/lzma/CPP/7zip/Compress/LzmaEncoder.cpp +0 -182
  527. package/android/jni/lzma/CPP/7zip/Compress/LzmaEncoder.h +0 -46
  528. package/android/jni/lzma/CPP/7zip/Compress/LzmaRegister.cpp +0 -22
  529. package/android/jni/lzma/CPP/7zip/Compress/PpmdDecoder.cpp +0 -170
  530. package/android/jni/lzma/CPP/7zip/Compress/PpmdDecoder.h +0 -86
  531. package/android/jni/lzma/CPP/7zip/Compress/PpmdEncoder.cpp +0 -152
  532. package/android/jni/lzma/CPP/7zip/Compress/PpmdEncoder.h +0 -58
  533. package/android/jni/lzma/CPP/7zip/Compress/PpmdRegister.cpp +0 -22
  534. package/android/jni/lzma/CPP/7zip/Compress/StdAfx.h +0 -8
  535. package/android/jni/lzma/CPP/7zip/Compress/XzDecoder.cpp +0 -150
  536. package/android/jni/lzma/CPP/7zip/Compress/XzDecoder.h +0 -92
  537. package/android/jni/lzma/CPP/7zip/Compress/XzEncoder.cpp +0 -245
  538. package/android/jni/lzma/CPP/7zip/Compress/XzEncoder.h +0 -46
  539. package/android/jni/lzma/CPP/7zip/Crc.mak +0 -8
  540. package/android/jni/lzma/CPP/7zip/Crc64.mak +0 -8
  541. package/android/jni/lzma/CPP/7zip/Crypto/7zAes.cpp +0 -280
  542. package/android/jni/lzma/CPP/7zip/Crypto/7zAes.h +0 -118
  543. package/android/jni/lzma/CPP/7zip/Crypto/7zAesRegister.cpp +0 -17
  544. package/android/jni/lzma/CPP/7zip/Crypto/MyAes.cpp +0 -112
  545. package/android/jni/lzma/CPP/7zip/Crypto/MyAes.h +0 -57
  546. package/android/jni/lzma/CPP/7zip/Crypto/MyAesReg.cpp +0 -16
  547. package/android/jni/lzma/CPP/7zip/Crypto/RandGen.cpp +0 -233
  548. package/android/jni/lzma/CPP/7zip/Crypto/RandGen.h +0 -40
  549. package/android/jni/lzma/CPP/7zip/Crypto/StdAfx.h +0 -8
  550. package/android/jni/lzma/CPP/7zip/GuiCommon.rc +0 -84
  551. package/android/jni/lzma/CPP/7zip/Guid.txt +0 -220
  552. package/android/jni/lzma/CPP/7zip/ICoder.h +0 -399
  553. package/android/jni/lzma/CPP/7zip/IDecl.h +0 -28
  554. package/android/jni/lzma/CPP/7zip/IPassword.h +0 -23
  555. package/android/jni/lzma/CPP/7zip/IProgress.h +0 -19
  556. package/android/jni/lzma/CPP/7zip/IStream.h +0 -127
  557. package/android/jni/lzma/CPP/7zip/LzmaDec.mak +0 -5
  558. package/android/jni/lzma/CPP/7zip/MyVersion.h +0 -2
  559. package/android/jni/lzma/CPP/7zip/MyVersionInfo.rc +0 -2
  560. package/android/jni/lzma/CPP/7zip/PropID.h +0 -127
  561. package/android/jni/lzma/CPP/7zip/SubBuild.mak +0 -3
  562. package/android/jni/lzma/CPP/7zip/UI/Client7z/Client7z.cpp +0 -993
  563. package/android/jni/lzma/CPP/7zip/UI/Client7z/Client7z.dsp +0 -235
  564. package/android/jni/lzma/CPP/7zip/UI/Client7z/Client7z.dsw +0 -29
  565. package/android/jni/lzma/CPP/7zip/UI/Client7z/StdAfx.cpp +0 -3
  566. package/android/jni/lzma/CPP/7zip/UI/Client7z/StdAfx.h +0 -8
  567. package/android/jni/lzma/CPP/7zip/UI/Client7z/makefile +0 -28
  568. package/android/jni/lzma/CPP/7zip/UI/Client7z/resource.rc +0 -3
  569. package/android/jni/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +0 -1295
  570. package/android/jni/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.h +0 -136
  571. package/android/jni/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +0 -1715
  572. package/android/jni/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.h +0 -403
  573. package/android/jni/lzma/CPP/7zip/UI/Common/ArchiveName.cpp +0 -155
  574. package/android/jni/lzma/CPP/7zip/UI/Common/ArchiveName.h +0 -10
  575. package/android/jni/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp +0 -161
  576. package/android/jni/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.h +0 -112
  577. package/android/jni/lzma/CPP/7zip/UI/Common/Bench.cpp +0 -3618
  578. package/android/jni/lzma/CPP/7zip/UI/Common/Bench.h +0 -77
  579. package/android/jni/lzma/CPP/7zip/UI/Common/DefaultName.cpp +0 -37
  580. package/android/jni/lzma/CPP/7zip/UI/Common/DefaultName.h +0 -11
  581. package/android/jni/lzma/CPP/7zip/UI/Common/DirItem.h +0 -190
  582. package/android/jni/lzma/CPP/7zip/UI/Common/EnumDirItems.cpp +0 -1096
  583. package/android/jni/lzma/CPP/7zip/UI/Common/EnumDirItems.h +0 -42
  584. package/android/jni/lzma/CPP/7zip/UI/Common/ExitCode.h +0 -27
  585. package/android/jni/lzma/CPP/7zip/UI/Common/Extract.cpp +0 -482
  586. package/android/jni/lzma/CPP/7zip/UI/Common/Extract.h +0 -94
  587. package/android/jni/lzma/CPP/7zip/UI/Common/ExtractMode.h +0 -34
  588. package/android/jni/lzma/CPP/7zip/UI/Common/ExtractingFilePath.cpp +0 -280
  589. package/android/jni/lzma/CPP/7zip/UI/Common/ExtractingFilePath.h +0 -31
  590. package/android/jni/lzma/CPP/7zip/UI/Common/HashCalc.cpp +0 -347
  591. package/android/jni/lzma/CPP/7zip/UI/Common/HashCalc.h +0 -110
  592. package/android/jni/lzma/CPP/7zip/UI/Common/IFileExtractCallback.h +0 -114
  593. package/android/jni/lzma/CPP/7zip/UI/Common/LoadCodecs.cpp +0 -1074
  594. package/android/jni/lzma/CPP/7zip/UI/Common/LoadCodecs.h +0 -424
  595. package/android/jni/lzma/CPP/7zip/UI/Common/OpenArchive.cpp +0 -3553
  596. package/android/jni/lzma/CPP/7zip/UI/Common/OpenArchive.h +0 -436
  597. package/android/jni/lzma/CPP/7zip/UI/Common/PropIDUtils.cpp +0 -668
  598. package/android/jni/lzma/CPP/7zip/UI/Common/PropIDUtils.h +0 -18
  599. package/android/jni/lzma/CPP/7zip/UI/Common/Property.h +0 -14
  600. package/android/jni/lzma/CPP/7zip/UI/Common/SetProperties.cpp +0 -80
  601. package/android/jni/lzma/CPP/7zip/UI/Common/SetProperties.h +0 -10
  602. package/android/jni/lzma/CPP/7zip/UI/Common/SortUtils.cpp +0 -25
  603. package/android/jni/lzma/CPP/7zip/UI/Common/SortUtils.h +0 -10
  604. package/android/jni/lzma/CPP/7zip/UI/Common/StdAfx.h +0 -8
  605. package/android/jni/lzma/CPP/7zip/UI/Common/TempFiles.cpp +0 -19
  606. package/android/jni/lzma/CPP/7zip/UI/Common/TempFiles.h +0 -16
  607. package/android/jni/lzma/CPP/7zip/UI/Common/Update.cpp +0 -1704
  608. package/android/jni/lzma/CPP/7zip/UI/Common/Update.h +0 -200
  609. package/android/jni/lzma/CPP/7zip/UI/Common/UpdateAction.cpp +0 -64
  610. package/android/jni/lzma/CPP/7zip/UI/Common/UpdateAction.h +0 -66
  611. package/android/jni/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp +0 -771
  612. package/android/jni/lzma/CPP/7zip/UI/Common/UpdateCallback.h +0 -162
  613. package/android/jni/lzma/CPP/7zip/UI/Common/UpdatePair.cpp +0 -233
  614. package/android/jni/lzma/CPP/7zip/UI/Common/UpdatePair.h +0 -27
  615. package/android/jni/lzma/CPP/7zip/UI/Common/UpdateProduce.cpp +0 -70
  616. package/android/jni/lzma/CPP/7zip/UI/Common/UpdateProduce.h +0 -55
  617. package/android/jni/lzma/CPP/7zip/UI/Common/WorkDir.cpp +0 -94
  618. package/android/jni/lzma/CPP/7zip/UI/Common/WorkDir.h +0 -26
  619. package/android/jni/lzma/CPP/7zip/UI/Common/ZipRegistry.h +0 -130
  620. package/android/jni/lzma/CPP/7zip/UI/Console/BenchCon.cpp +0 -41
  621. package/android/jni/lzma/CPP/7zip/UI/Console/BenchCon.h +0 -14
  622. package/android/jni/lzma/CPP/7zip/UI/Console/Console.mak +0 -43
  623. package/android/jni/lzma/CPP/7zip/UI/Console/Console.manifest +0 -13
  624. package/android/jni/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp +0 -69
  625. package/android/jni/lzma/CPP/7zip/UI/Console/ConsoleClose.h +0 -33
  626. package/android/jni/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp +0 -825
  627. package/android/jni/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.h +0 -164
  628. package/android/jni/lzma/CPP/7zip/UI/Console/HashCon.cpp +0 -367
  629. package/android/jni/lzma/CPP/7zip/UI/Console/HashCon.h +0 -48
  630. package/android/jni/lzma/CPP/7zip/UI/Console/List.cpp +0 -1359
  631. package/android/jni/lzma/CPP/7zip/UI/Console/List.h +0 -27
  632. package/android/jni/lzma/CPP/7zip/UI/Console/Main.cpp +0 -1154
  633. package/android/jni/lzma/CPP/7zip/UI/Console/MainAr.cpp +0 -175
  634. package/android/jni/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp +0 -115
  635. package/android/jni/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.h +0 -66
  636. package/android/jni/lzma/CPP/7zip/UI/Console/PercentPrinter.cpp +0 -183
  637. package/android/jni/lzma/CPP/7zip/UI/Console/PercentPrinter.h +0 -62
  638. package/android/jni/lzma/CPP/7zip/UI/Console/StdAfx.cpp +0 -3
  639. package/android/jni/lzma/CPP/7zip/UI/Console/StdAfx.h +0 -8
  640. package/android/jni/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp +0 -702
  641. package/android/jni/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.h +0 -124
  642. package/android/jni/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp +0 -110
  643. package/android/jni/lzma/CPP/7zip/UI/Console/UserInputUtils.h +0 -27
  644. package/android/jni/lzma/CPP/7zip/UI/Console/makefile +0 -64
  645. package/android/jni/lzma/CPP/7zip/UI/Console/resource.rc +0 -7
  646. package/android/jni/lzma/CPP/7zip/UI/Explorer/MyMessages.cpp +0 -37
  647. package/android/jni/lzma/CPP/7zip/UI/Explorer/MyMessages.h +0 -16
  648. package/android/jni/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp +0 -1025
  649. package/android/jni/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h +0 -21
  650. package/android/jni/lzma/CPP/7zip/UI/FileManager/BrowseDialogRes.h +0 -9
  651. package/android/jni/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp +0 -64
  652. package/android/jni/lzma/CPP/7zip/UI/FileManager/ComboDialog.h +0 -28
  653. package/android/jni/lzma/CPP/7zip/UI/FileManager/ComboDialogRes.h +0 -4
  654. package/android/jni/lzma/CPP/7zip/UI/FileManager/DialogSize.h +0 -16
  655. package/android/jni/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp +0 -1037
  656. package/android/jni/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h +0 -328
  657. package/android/jni/lzma/CPP/7zip/UI/FileManager/FormatUtils.cpp +0 -28
  658. package/android/jni/lzma/CPP/7zip/UI/FileManager/FormatUtils.h +0 -14
  659. package/android/jni/lzma/CPP/7zip/UI/FileManager/LangUtils.h +0 -40
  660. package/android/jni/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h +0 -76
  661. package/android/jni/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp +0 -122
  662. package/android/jni/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h +0 -69
  663. package/android/jni/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.rc +0 -91
  664. package/android/jni/lzma/CPP/7zip/UI/FileManager/OverwriteDialogRes.h +0 -17
  665. package/android/jni/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp +0 -58
  666. package/android/jni/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h +0 -28
  667. package/android/jni/lzma/CPP/7zip/UI/FileManager/PasswordDialog.rc +0 -14
  668. package/android/jni/lzma/CPP/7zip/UI/FileManager/PasswordDialogRes.h +0 -5
  669. package/android/jni/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp +0 -196
  670. package/android/jni/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h +0 -170
  671. package/android/jni/lzma/CPP/7zip/UI/FileManager/ProgressDialog.rc +0 -12
  672. package/android/jni/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +0 -1337
  673. package/android/jni/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h +0 -351
  674. package/android/jni/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.rc +0 -40
  675. package/android/jni/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h +0 -48
  676. package/android/jni/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc +0 -80
  677. package/android/jni/lzma/CPP/7zip/UI/FileManager/ProgressDialogRes.h +0 -3
  678. package/android/jni/lzma/CPP/7zip/UI/FileManager/PropertyName.cpp +0 -23
  679. package/android/jni/lzma/CPP/7zip/UI/FileManager/PropertyName.h +0 -10
  680. package/android/jni/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h +0 -95
  681. package/android/jni/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp +0 -255
  682. package/android/jni/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h +0 -62
  683. package/android/jni/lzma/CPP/7zip/UI/FileManager/resource.h +0 -177
  684. package/android/jni/lzma/CPP/7zip/UI/FileManager/resourceGui.h +0 -15
  685. package/android/jni/lzma/CPP/7zip/UI/GUI/Extract.rc +0 -59
  686. package/android/jni/lzma/CPP/7zip/UI/GUI/ExtractDialog.cpp +0 -418
  687. package/android/jni/lzma/CPP/7zip/UI/GUI/ExtractDialog.h +0 -113
  688. package/android/jni/lzma/CPP/7zip/UI/GUI/ExtractDialog.rc +0 -98
  689. package/android/jni/lzma/CPP/7zip/UI/GUI/ExtractDialogRes.h +0 -24
  690. package/android/jni/lzma/CPP/7zip/UI/GUI/ExtractGUI.cpp +0 -280
  691. package/android/jni/lzma/CPP/7zip/UI/GUI/ExtractGUI.h +0 -38
  692. package/android/jni/lzma/CPP/7zip/UI/GUI/ExtractRes.h +0 -51
  693. package/android/jni/lzma/CPP/7zip/UI/GUI/HashGUI.h +0 -27
  694. package/android/jni/lzma/CPP/7zip/UI/GUI/resource2.h +0 -2
  695. package/android/jni/lzma/CPP/Build.mak +0 -156
  696. package/android/jni/lzma/CPP/Common/AutoPtr.h +0 -35
  697. package/android/jni/lzma/CPP/Common/CRC.cpp +0 -7
  698. package/android/jni/lzma/CPP/Common/C_FileIO.cpp +0 -92
  699. package/android/jni/lzma/CPP/Common/C_FileIO.h +0 -53
  700. package/android/jni/lzma/CPP/Common/ComTry.h +0 -21
  701. package/android/jni/lzma/CPP/Common/CommandLineParser.cpp +0 -197
  702. package/android/jni/lzma/CPP/Common/CommandLineParser.h +0 -63
  703. package/android/jni/lzma/CPP/Common/Common.h +0 -43
  704. package/android/jni/lzma/CPP/Common/CrcReg.cpp +0 -98
  705. package/android/jni/lzma/CPP/Common/Defs.h +0 -15
  706. package/android/jni/lzma/CPP/Common/DynamicBuffer.h +0 -64
  707. package/android/jni/lzma/CPP/Common/IntToString.cpp +0 -193
  708. package/android/jni/lzma/CPP/Common/IntToString.h +0 -28
  709. package/android/jni/lzma/CPP/Common/Lang.h +0 -23
  710. package/android/jni/lzma/CPP/Common/ListFileUtils.cpp +0 -132
  711. package/android/jni/lzma/CPP/Common/ListFileUtils.h +0 -18
  712. package/android/jni/lzma/CPP/Common/MyBuffer.h +0 -259
  713. package/android/jni/lzma/CPP/Common/MyBuffer2.h +0 -100
  714. package/android/jni/lzma/CPP/Common/MyCom.h +0 -277
  715. package/android/jni/lzma/CPP/Common/MyException.h +0 -14
  716. package/android/jni/lzma/CPP/Common/MyGuidDef.h +0 -54
  717. package/android/jni/lzma/CPP/Common/MyInitGuid.h +0 -45
  718. package/android/jni/lzma/CPP/Common/MyLinux.h +0 -42
  719. package/android/jni/lzma/CPP/Common/MyString.cpp +0 -1659
  720. package/android/jni/lzma/CPP/Common/MyString.h +0 -868
  721. package/android/jni/lzma/CPP/Common/MyTypes.h +0 -35
  722. package/android/jni/lzma/CPP/Common/MyUnknown.h +0 -17
  723. package/android/jni/lzma/CPP/Common/MyVector.cpp +0 -3
  724. package/android/jni/lzma/CPP/Common/MyVector.h +0 -634
  725. package/android/jni/lzma/CPP/Common/MyWindows.cpp +0 -145
  726. package/android/jni/lzma/CPP/Common/MyWindows.h +0 -231
  727. package/android/jni/lzma/CPP/Common/NewHandler.cpp +0 -163
  728. package/android/jni/lzma/CPP/Common/NewHandler.h +0 -88
  729. package/android/jni/lzma/CPP/Common/Sha256Reg.cpp +0 -40
  730. package/android/jni/lzma/CPP/Common/StdAfx.h +0 -8
  731. package/android/jni/lzma/CPP/Common/StdInStream.cpp +0 -89
  732. package/android/jni/lzma/CPP/Common/StdInStream.h +0 -38
  733. package/android/jni/lzma/CPP/Common/StdOutStream.cpp +0 -163
  734. package/android/jni/lzma/CPP/Common/StdOutStream.h +0 -71
  735. package/android/jni/lzma/CPP/Common/StringConvert.cpp +0 -319
  736. package/android/jni/lzma/CPP/Common/StringConvert.h +0 -88
  737. package/android/jni/lzma/CPP/Common/StringToInt.cpp +0 -144
  738. package/android/jni/lzma/CPP/Common/StringToInt.h +0 -21
  739. package/android/jni/lzma/CPP/Common/TextConfig.cpp +0 -124
  740. package/android/jni/lzma/CPP/Common/TextConfig.h +0 -19
  741. package/android/jni/lzma/CPP/Common/UTFConvert.cpp +0 -288
  742. package/android/jni/lzma/CPP/Common/UTFConvert.h +0 -12
  743. package/android/jni/lzma/CPP/Common/Wildcard.cpp +0 -676
  744. package/android/jni/lzma/CPP/Common/Wildcard.h +0 -149
  745. package/android/jni/lzma/CPP/Common/XzCrc64Init.cpp +0 -7
  746. package/android/jni/lzma/CPP/Common/XzCrc64Reg.cpp +0 -42
  747. package/android/jni/lzma/CPP/Windows/COM.h +0 -70
  748. package/android/jni/lzma/CPP/Windows/CommonDialog.cpp +0 -185
  749. package/android/jni/lzma/CPP/Windows/CommonDialog.h +0 -23
  750. package/android/jni/lzma/CPP/Windows/Control/ComboBox.cpp +0 -66
  751. package/android/jni/lzma/CPP/Windows/Control/ComboBox.h +0 -65
  752. package/android/jni/lzma/CPP/Windows/Control/CommandBar.h +0 -52
  753. package/android/jni/lzma/CPP/Windows/Control/Dialog.cpp +0 -251
  754. package/android/jni/lzma/CPP/Windows/Control/Dialog.h +0 -170
  755. package/android/jni/lzma/CPP/Windows/Control/Edit.h +0 -19
  756. package/android/jni/lzma/CPP/Windows/Control/ImageList.cpp +0 -10
  757. package/android/jni/lzma/CPP/Windows/Control/ImageList.h +0 -87
  758. package/android/jni/lzma/CPP/Windows/Control/ListView.cpp +0 -155
  759. package/android/jni/lzma/CPP/Windows/Control/ListView.h +0 -146
  760. package/android/jni/lzma/CPP/Windows/Control/ProgressBar.h +0 -35
  761. package/android/jni/lzma/CPP/Windows/Control/PropertyPage.cpp +0 -143
  762. package/android/jni/lzma/CPP/Windows/Control/PropertyPage.h +0 -50
  763. package/android/jni/lzma/CPP/Windows/Control/ReBar.h +0 -34
  764. package/android/jni/lzma/CPP/Windows/Control/Static.h +0 -28
  765. package/android/jni/lzma/CPP/Windows/Control/StatusBar.h +0 -42
  766. package/android/jni/lzma/CPP/Windows/Control/StdAfx.h +0 -8
  767. package/android/jni/lzma/CPP/Windows/Control/ToolBar.h +0 -43
  768. package/android/jni/lzma/CPP/Windows/Control/Trackbar.h +0 -27
  769. package/android/jni/lzma/CPP/Windows/Control/Window2.cpp +0 -200
  770. package/android/jni/lzma/CPP/Windows/Control/Window2.h +0 -51
  771. package/android/jni/lzma/CPP/Windows/DLL.cpp +0 -109
  772. package/android/jni/lzma/CPP/Windows/DLL.h +0 -58
  773. package/android/jni/lzma/CPP/Windows/Defs.h +0 -17
  774. package/android/jni/lzma/CPP/Windows/ErrorMsg.cpp +0 -66
  775. package/android/jni/lzma/CPP/Windows/ErrorMsg.h +0 -15
  776. package/android/jni/lzma/CPP/Windows/FileDir.cpp +0 -714
  777. package/android/jni/lzma/CPP/Windows/FileDir.h +0 -117
  778. package/android/jni/lzma/CPP/Windows/FileFind.cpp +0 -749
  779. package/android/jni/lzma/CPP/Windows/FileFind.h +0 -161
  780. package/android/jni/lzma/CPP/Windows/FileIO.cpp +0 -432
  781. package/android/jni/lzma/CPP/Windows/FileIO.h +0 -212
  782. package/android/jni/lzma/CPP/Windows/FileLink.cpp +0 -440
  783. package/android/jni/lzma/CPP/Windows/FileMapping.cpp +0 -12
  784. package/android/jni/lzma/CPP/Windows/FileMapping.h +0 -66
  785. package/android/jni/lzma/CPP/Windows/FileName.cpp +0 -839
  786. package/android/jni/lzma/CPP/Windows/FileName.h +0 -115
  787. package/android/jni/lzma/CPP/Windows/FileSystem.cpp +0 -131
  788. package/android/jni/lzma/CPP/Windows/FileSystem.h +0 -27
  789. package/android/jni/lzma/CPP/Windows/Handle.h +0 -37
  790. package/android/jni/lzma/CPP/Windows/MemoryLock.cpp +0 -112
  791. package/android/jni/lzma/CPP/Windows/MemoryLock.h +0 -40
  792. package/android/jni/lzma/CPP/Windows/NtCheck.h +0 -46
  793. package/android/jni/lzma/CPP/Windows/PropVariant.cpp +0 -347
  794. package/android/jni/lzma/CPP/Windows/PropVariant.h +0 -114
  795. package/android/jni/lzma/CPP/Windows/PropVariantConv.cpp +0 -138
  796. package/android/jni/lzma/CPP/Windows/PropVariantConv.h +0 -37
  797. package/android/jni/lzma/CPP/Windows/Registry.cpp +0 -390
  798. package/android/jni/lzma/CPP/Windows/Registry.h +0 -84
  799. package/android/jni/lzma/CPP/Windows/ResourceString.cpp +0 -103
  800. package/android/jni/lzma/CPP/Windows/ResourceString.h +0 -16
  801. package/android/jni/lzma/CPP/Windows/SecurityUtils.cpp +0 -181
  802. package/android/jni/lzma/CPP/Windows/SecurityUtils.h +0 -167
  803. package/android/jni/lzma/CPP/Windows/Shell.cpp +0 -358
  804. package/android/jni/lzma/CPP/Windows/Shell.h +0 -94
  805. package/android/jni/lzma/CPP/Windows/StdAfx.h +0 -8
  806. package/android/jni/lzma/CPP/Windows/Synchronization.cpp +0 -10
  807. package/android/jni/lzma/CPP/Windows/Synchronization.h +0 -164
  808. package/android/jni/lzma/CPP/Windows/System.cpp +0 -142
  809. package/android/jni/lzma/CPP/Windows/System.h +0 -40
  810. package/android/jni/lzma/CPP/Windows/Thread.h +0 -38
  811. package/android/jni/lzma/CPP/Windows/TimeUtils.cpp +0 -213
  812. package/android/jni/lzma/CPP/Windows/TimeUtils.h +0 -32
  813. package/android/jni/lzma/CPP/Windows/Window.cpp +0 -179
  814. package/android/jni/lzma/CPP/Windows/Window.h +0 -284
  815. package/android/jni/lzma/CS/7zip/Common/CRC.cs +0 -55
  816. package/android/jni/lzma/CS/7zip/Common/CommandLineParser.cs +0 -274
  817. package/android/jni/lzma/CS/7zip/Common/InBuffer.cs +0 -72
  818. package/android/jni/lzma/CS/7zip/Common/OutBuffer.cs +0 -47
  819. package/android/jni/lzma/CS/7zip/Compress/LZ/IMatchFinder.cs +0 -24
  820. package/android/jni/lzma/CS/7zip/Compress/LZ/LzBinTree.cs +0 -367
  821. package/android/jni/lzma/CS/7zip/Compress/LZ/LzInWindow.cs +0 -132
  822. package/android/jni/lzma/CS/7zip/Compress/LZ/LzOutWindow.cs +0 -110
  823. package/android/jni/lzma/CS/7zip/Compress/LZMA/LzmaBase.cs +0 -76
  824. package/android/jni/lzma/CS/7zip/Compress/LZMA/LzmaDecoder.cs +0 -398
  825. package/android/jni/lzma/CS/7zip/Compress/LZMA/LzmaEncoder.cs +0 -1480
  826. package/android/jni/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.cs +0 -364
  827. package/android/jni/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.csproj +0 -90
  828. package/android/jni/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.sln +0 -20
  829. package/android/jni/lzma/CS/7zip/Compress/LzmaAlone/LzmaBench.cs +0 -340
  830. package/android/jni/lzma/CS/7zip/Compress/LzmaAlone/Properties/AssemblyInfo.cs +0 -29
  831. package/android/jni/lzma/CS/7zip/Compress/LzmaAlone/Properties/Resources.cs +0 -70
  832. package/android/jni/lzma/CS/7zip/Compress/LzmaAlone/Properties/Settings.cs +0 -42
  833. package/android/jni/lzma/CS/7zip/Compress/RangeCoder/RangeCoder.cs +0 -234
  834. package/android/jni/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBit.cs +0 -117
  835. package/android/jni/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBitTree.cs +0 -157
  836. package/android/jni/lzma/CS/7zip/ICoder.cs +0 -157
  837. package/android/jni/lzma/DOC/7zC.txt +0 -187
  838. package/android/jni/lzma/DOC/7zFormat.txt +0 -469
  839. package/android/jni/lzma/DOC/Methods.txt +0 -173
  840. package/android/jni/lzma/DOC/installer.txt +0 -166
  841. package/android/jni/lzma/DOC/lzma-history.txt +0 -446
  842. package/android/jni/lzma/DOC/lzma-specification.txt +0 -1176
  843. package/android/jni/lzma/DOC/lzma.txt +0 -328
  844. package/android/jni/lzma/Java/SevenZip/CRC.java +0 -52
  845. package/android/jni/lzma/Java/SevenZip/Compression/LZ/BinTree.java +0 -382
  846. package/android/jni/lzma/Java/SevenZip/Compression/LZ/InWindow.java +0 -131
  847. package/android/jni/lzma/Java/SevenZip/Compression/LZ/OutWindow.java +0 -85
  848. package/android/jni/lzma/Java/SevenZip/Compression/LZMA/Base.java +0 -88
  849. package/android/jni/lzma/Java/SevenZip/Compression/LZMA/Decoder.java +0 -329
  850. package/android/jni/lzma/Java/SevenZip/Compression/LZMA/Encoder.java +0 -1416
  851. package/android/jni/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.java +0 -55
  852. package/android/jni/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.java +0 -99
  853. package/android/jni/lzma/Java/SevenZip/Compression/RangeCoder/Decoder.java +0 -88
  854. package/android/jni/lzma/Java/SevenZip/Compression/RangeCoder/Encoder.java +0 -151
  855. package/android/jni/lzma/Java/SevenZip/ICodeProgress.java +0 -6
  856. package/android/jni/lzma/Java/SevenZip/LzmaAlone.java +0 -253
  857. package/android/jni/lzma/Java/SevenZip/LzmaBench.java +0 -392
  858. package/android/jni/lzma/bin/7zS2.sfx +0 -0
  859. package/android/jni/lzma/bin/7zS2con.sfx +0 -0
  860. package/android/jni/lzma/bin/7zSD.sfx +0 -0
  861. package/android/jni/lzma/bin/7zdec.exe +0 -0
  862. package/android/jni/lzma/bin/7zr.exe +0 -0
  863. package/android/jni/lzma/bin/installer/config.txt +0 -5
  864. package/android/jni/lzma/bin/installer/cr.bat +0 -5
  865. package/android/jni/lzma/bin/lzma.exe +0 -0
  866. package/android/jni/lzma/bin/x64/7zr.exe +0 -0
  867. package/android/src/main/java/cn/reactnative/modules/update/ArchivePatchPlanResult.java +0 -6
  868. package/android/src/main/java/cn/reactnative/modules/update/PushyConfiguration.java +0 -104
  869. package/android/src/main/java/cn/reactnative/modules/update/UiThreadRunner.java +0 -37
  870. package/android/src/newarch/cn/reactnative/modules/update/UpdateModule.java +0 -121
  871. package/android/src/oldarch/cn/reactnative/modules/update/UpdateModule.java +0 -125
  872. package/cpp/patch_core/jni_natives.h +0 -27
  873. package/cpp/patch_core/jni_registration.cpp +0 -103
  874. package/cpp/patch_core/jni_util.h +0 -60
  875. package/cpp/patch_core/patch_core_android.cpp +0 -97
  876. package/cpp/patch_core/update_core_android.cpp +0 -485
  877. package/cpp/update_flow_core/update_flow_jni.cpp +0 -150
package/src/client.ts CHANGED
@@ -1,87 +1,22 @@
1
- import {
2
- DeviceEventEmitter,
3
- type EmitterSubscription,
4
- Platform,
5
- } from 'react-native';
6
- import {
7
- buildTime,
8
- cInfo,
9
- currentVersion,
10
- currentVersionInfo,
11
- getBundleHash,
12
- isFirstTime,
13
- isRolledBack,
14
- PushyModule,
15
- packageVersion,
16
- pushyNativeEventEmitter,
17
- rolledBackVersion,
18
- setLocalHashInfo,
19
- supportedDiffVersion,
20
- } from './core';
21
- import { dedupeEndpoints, executeEndpointFallback } from './endpoint';
22
- import {
23
- readErrorCode,
24
- toUpdateError,
25
- UpdateError,
26
- type UpdateErrorCode,
27
- } from './error';
28
- import {
29
- type ErrorReportContext,
30
- type ErrorReportingOptions,
31
- installGlobalErrorHandler,
32
- type SerializedException,
33
- serializeException,
34
- } from './errorReporting';
1
+ import { Platform } from 'react-native';
2
+ import { Activation } from './clientActivation';
3
+ import { Checker } from './clientCheck';
4
+ import { Downloader } from './clientDownload';
5
+ import { NativeConfigSync } from './clientNativeConfig';
6
+ import { type ReportEvent, Reporter } from './clientReporter';
7
+ import { createProcessState } from './clientState';
8
+ import { cInfo, isRolledBack, packageVersion, rolledBackVersion } from './core';
9
+ import { UpdateError } from './error';
35
10
  import i18n from './i18n';
36
- import {
37
- resolveServerEventHash,
38
- resolveServerEventType,
39
- truncateDetail,
40
- } from './telemetry';
41
- import type {
42
- BeforeReloadContext,
43
- CheckResult,
44
- ClientOptions,
45
- EventType,
46
- ProgressData,
47
- UpdateCheckState,
48
- UpdateServerConfig,
49
- } from './type';
50
- import {
51
- buildCheckFingerprint,
52
- buildCheckRequestBody,
53
- type DownloadPlan,
54
- type DownloadStrategyType,
55
- decideDownload,
56
- isMirrorRetryableCode,
57
- isValidCheckResult,
58
- } from './updateFlowCore';
59
- import {
60
- assertWeb,
61
- computeProgress,
62
- DEFAULT_FETCH_TIMEOUT_MS,
63
- fetchWithTimeout,
64
- info,
65
- log,
66
- noop,
67
- promiseAny,
68
- setDebugLogging,
69
- testUrls,
70
- warn,
71
- } from './utils';
11
+ import type { ClientOptions, UpdateServerConfig } from './type';
12
+ import { dedupeEndpoints } from './updateFlowCore';
13
+ import { assertWeb, info, log, noop, setDebugLogging } from './utils';
72
14
 
73
- /**
74
- * Receives every error the client reports, alongside the report event type.
75
- * The UpdateProvider subscribes to surface errors as lastError/Alert; user
76
- * code can subscribe too. Listeners run before any throwError rethrow.
77
- */
78
- export type UpdateErrorListener = (
79
- error: UpdateError,
80
- eventType: EventType
81
- ) => void;
15
+ export type { UpdateErrorListener } from './clientReporter';
82
16
 
17
+ // Pushy for China users, Cresc for international ones.
18
+ // <generated:service-presets> (scripts/contract.ts; bun scripts/generate-contract.ts)
83
19
  const SERVER_PRESETS = {
84
- // cn
85
20
  Pushy: {
86
21
  main: [
87
22
  'https://update.react-native.cn/api',
@@ -92,7 +27,6 @@ const SERVER_PRESETS = {
92
27
  'https://cdn.jsdelivr.net/gh/reactnativecn/react-native-update@master/endpoints.json',
93
28
  ],
94
29
  },
95
- // i18n
96
30
  Cresc: {
97
31
  main: ['https://api.cresc.dev', 'https://api.cresc.app'],
98
32
  queryUrls: [
@@ -100,30 +34,19 @@ const SERVER_PRESETS = {
100
34
  ],
101
35
  },
102
36
  };
37
+ // </generated:service-presets>
103
38
 
104
39
  const cloneServerConfig = (server: UpdateServerConfig): UpdateServerConfig => ({
105
40
  main: dedupeEndpoints([...(server.main || [])]),
106
41
  queryUrls: server.queryUrls ? [...server.queryUrls] : undefined,
107
42
  });
108
43
 
109
- // How long after a resolved reloadUpdate the process may still be alive before
110
- // the switch is considered not to have restarted the app (see switchVersion).
111
- const RELOAD_WATCHDOG_MS = 5000;
112
-
113
- // Non-2xx check responses are usually HTML error pages; keep only the head
114
- // for the error message (it can end up in an alert) and the logger.
115
- const MAX_HTTP_ERROR_TEXT = 200;
116
-
117
- const excludeConfiguredEndpoints = (
118
- endpoints: string[],
119
- configuredEndpoints: string[]
120
- ) => {
121
- const configured = new Set(configuredEndpoints);
122
- return endpoints.filter((endpoint) => !configured.has(endpoint));
123
- };
124
-
125
44
  assertWeb();
126
45
 
46
+ // Created once per evaluation of this module, i.e. once per process.
47
+ const processState = createProcessState();
48
+ export const sharedState = processState.shared;
49
+
127
50
  const createDefaultClientOptions = (): ClientOptions => ({
128
51
  appKey: '',
129
52
  autoMarkSuccess: true,
@@ -135,81 +58,6 @@ const createDefaultClientOptions = (): ClientOptions => ({
135
58
  disableErrorReporting: false,
136
59
  });
137
60
 
138
- export const sharedState: {
139
- progressHandlers: Record<string, EmitterSubscription>;
140
- downloadingTasks: Record<string, Promise<string | undefined>>;
141
- // Progress callbacks per hash: concurrent downloadUpdate callers of the
142
- // same hash each register theirs here instead of the second one being
143
- // silently dropped by the in-flight dedup.
144
- progressCallbacks: Record<string, Set<(data: ProgressData) => void>>;
145
- downloadedHash?: string;
146
- toHash?: string;
147
- apkStatus: 'downloading' | 'downloaded' | null;
148
- marked: boolean;
149
- applyingUpdate: boolean;
150
- } = {
151
- progressHandlers: {},
152
- downloadingTasks: {},
153
- progressCallbacks: {},
154
- downloadedHash: undefined,
155
- apkStatus: null,
156
- marked: false,
157
- applyingUpdate: false,
158
- };
159
-
160
- // A reset/new switch invalidates ownership of older async completions and
161
- // watchdogs before the process-wide applyingUpdate flag can be reused.
162
- let applyingUpdateGeneration = 0;
163
- let reloadWatchdogTimer: ReturnType<typeof setTimeout> | undefined;
164
-
165
- const clearReloadWatchdog = () => {
166
- if (reloadWatchdogTimer !== undefined) {
167
- clearTimeout(reloadWatchdogTimer);
168
- reloadWatchdogTimer = undefined;
169
- }
170
- };
171
-
172
- const beginApplyingUpdate = (): number => {
173
- clearReloadWatchdog();
174
- sharedState.applyingUpdate = true;
175
- return ++applyingUpdateGeneration;
176
- };
177
-
178
- const ownsApplyingUpdate = (generation: number): boolean =>
179
- generation === applyingUpdateGeneration && sharedState.applyingUpdate;
180
-
181
- const finishApplyingUpdate = (generation: number): boolean => {
182
- if (!ownsApplyingUpdate(generation)) {
183
- return false;
184
- }
185
- clearReloadWatchdog();
186
- sharedState.applyingUpdate = false;
187
- return true;
188
- };
189
-
190
- const invalidateApplyingUpdate = () => {
191
- applyingUpdateGeneration++;
192
- clearReloadWatchdog();
193
- sharedState.applyingUpdate = false;
194
- };
195
-
196
- const armReloadWatchdog = (generation: number, onTimeout: () => void) => {
197
- if (!ownsApplyingUpdate(generation)) {
198
- return;
199
- }
200
- clearReloadWatchdog();
201
- const timer = setTimeout(() => {
202
- // A cancelled callback may already be queued; both identities must match.
203
- if (reloadWatchdogTimer !== timer || !ownsApplyingUpdate(generation)) {
204
- return;
205
- }
206
- reloadWatchdogTimer = undefined;
207
- sharedState.applyingUpdate = false;
208
- onTimeout();
209
- }, RELOAD_WATCHDOG_MS);
210
- reloadWatchdogTimer = timer;
211
- };
212
-
213
61
  // The SDK is a process-level singleton: module-level sharedState, the global
214
62
  // i18n locale and the native update state are all per-process, so a second
215
63
  // client would silently share (and fight over) them. Constructing one is a
@@ -217,46 +65,43 @@ const armReloadWatchdog = (generation: number, onTimeout: () => void) => {
217
65
  // client (same type + appKey), which dev fast-refresh triggers legitimately.
218
66
  let activeClient: Pushy | undefined;
219
67
 
220
- const assertHash = (hash: string) => {
221
- if (!sharedState.downloadedHash) {
222
- log(`no downloaded hash yet, ignore switch to ${hash}`);
223
- return;
224
- }
225
- if (hash !== sharedState.downloadedHash) {
226
- log(`use downloaded hash ${sharedState.downloadedHash} first`);
227
- return;
228
- }
229
- return true;
230
- };
231
-
68
+ // The client is a facade: checking (clientCheck), downloading
69
+ // (clientDownload), activation (clientActivation), reporting (clientReporter)
70
+ // and the native config sync (clientNativeConfig) each own their part of the
71
+ // flow; this class owns the options and the process-level singleton, and
72
+ // keeps the public API.
232
73
  // for China users
233
74
  export class Pushy {
234
75
  options: ClientOptions = createDefaultClientOptions();
235
76
  clientType: 'Pushy' | 'Cresc' = 'Pushy';
236
- lastChecking?: number;
237
- lastRespJson?: Promise<CheckResult>;
238
- lastCheckFingerprint?: string;
239
- // Endpoint that most recently served a successful checkUpdate; telemetry
240
- // reuses it instead of re-running the fallback race.
241
- private lastWorkingEndpoint?: string;
242
- private syncedNativeConfigJson?: string;
243
- private pendingNativeConfigJson?: string;
244
- private nativeConfigSyncInFlight = false;
245
- private reportedInvalidUpdates = new Set<string>();
246
- private reportedExceptions = new WeakSet<object>();
247
- private globalErrorCleanup?: () => void;
248
-
249
77
  version = cInfo.rnu;
250
- loggerPromise = (() => {
251
- let resolve: (value?: unknown) => void = () => {};
252
- const promise = new Promise((res) => {
253
- resolve = res;
254
- });
255
- return {
256
- promise,
257
- resolve,
258
- };
259
- })();
78
+
79
+ // `options` is mutated in place, never replaced (see optionsVersion), so
80
+ // the reporter can hold it directly.
81
+ private readonly reporter = new Reporter({
82
+ options: this.options,
83
+ getEffectivePackageVersion: () => this.getEffectivePackageVersion(),
84
+ report: (event) => this.report(event),
85
+ telemetryEndpoint: () =>
86
+ this.checker.lastWorkingEndpoint || this.options.server?.main?.[0],
87
+ });
88
+ private readonly nativeConfig = new NativeConfigSync(this);
89
+ private readonly checker = new Checker(
90
+ this,
91
+ this.reporter,
92
+ this.nativeConfig,
93
+ processState
94
+ );
95
+ private readonly downloader = new Downloader(
96
+ this,
97
+ this.reporter,
98
+ processState
99
+ );
100
+ private readonly activation = new Activation(
101
+ this,
102
+ this.reporter,
103
+ processState
104
+ );
260
105
 
261
106
  constructor(options: ClientOptions, clientType?: 'Pushy' | 'Cresc') {
262
107
  this.clientType = clientType || 'Pushy';
@@ -329,7 +174,7 @@ export class Pushy {
329
174
  ? cloneServerConfig(value as UpdateServerConfig)
330
175
  : value;
331
176
  if (key === 'logger') {
332
- this.loggerPromise.resolve();
177
+ this.reporter.loggerPromise.resolve();
333
178
  }
334
179
  if (key === 'locale') {
335
180
  // The constructor applies the initial locale; a runtime switch (or
@@ -348,220 +193,14 @@ export class Pushy {
348
193
  log('onOptionsChange listener error:', e?.message || e);
349
194
  }
350
195
  }
351
- this.syncAutomaticErrorReporting();
352
- this.syncNativeConfig();
353
- };
354
-
355
- private syncAutomaticErrorReporting = (): void => {
356
- if (this.options.disableTelemetry || this.options.disableErrorReporting) {
357
- this.globalErrorCleanup?.();
358
- return;
359
- }
360
- this.enableErrorReporting();
361
- };
362
-
363
- /** Build the subset of options used by the native cold-start check. */
364
- private getNativeConfig = (): Record<string, unknown> | undefined => {
365
- if (
366
- Platform.OS === 'web' ||
367
- typeof PushyModule.syncNativeConfig !== 'function'
368
- ) {
369
- // Older natives lack the method; on web PushyModule is a noop Proxy
370
- // and the feature-detect would false-positive.
371
- return undefined;
372
- }
373
- const {
374
- appKey,
375
- server,
376
- updateStrategy,
377
- checkStrategy,
378
- disableNativeCheck,
379
- } = this.options;
380
- if (disableNativeCheck) {
381
- // Explicit opt-out: keep the identity fields so the persisted config
382
- // still describes this app, and let the orchestrators bail on `disabled`
383
- // before any IO.
384
- return { disabled: true, appKey, rnu: cInfo.rnu, rn: cInfo.rn };
385
- }
386
- if (!appKey || !server?.main?.length) {
387
- // Unusable rather than merely absent: the JS check would fail on these
388
- // options too (NO_ENDPOINTS / APPKEY_REQUIRED). The caller turns this
389
- // into an explicit disabled state.
390
- return undefined;
391
- }
392
- // An app that turned automatic checks off (checkStrategy: null) must not
393
- // be handed a version switch it never asked for. The cold-start check
394
- // still runs and still downloads — that is what keeps a bricked device
395
- // rescuable — but activation waits for the JS side, or for the server's
396
- // explicit per-version forceBoot directive (shouldActivateAfterDownload).
397
- const autoCheckEnabled = checkStrategy != null;
398
- return {
399
- appKey,
400
- packageVersion: this.getEffectivePackageVersion(),
401
- endpoints: server.main,
402
- queryUrls: server.queryUrls ?? [],
403
- // The native check may activate a downloaded version (next launch)
404
- // only under the silent strategies; alert-style strategies keep
405
- // activation with the JS side (§6/§10.1).
406
- afterDownload:
407
- autoCheckEnabled &&
408
- (updateStrategy === 'silentAndNow' ||
409
- updateStrategy === 'silentAndLater')
410
- ? 'setNeedUpdate'
411
- : 'none',
412
- rnu: cInfo.rnu,
413
- rn: cInfo.rn,
414
- };
415
- };
416
-
417
- private getNativeConfigJson = (): string | undefined => {
418
- const config = this.getNativeConfig();
419
- return config ? JSON.stringify(config) : undefined;
420
- };
421
-
422
- private flushNativeConfig = () => {
423
- if (this.options.nativeConfigSource === 'native') {
424
- this.pendingNativeConfigJson = undefined;
425
- return;
426
- }
427
- if (this.nativeConfigSyncInFlight) {
428
- return;
429
- }
430
- const configJson = this.pendingNativeConfigJson;
431
- this.pendingNativeConfigJson = undefined;
432
- if (!configJson || configJson === this.syncedNativeConfigJson) {
433
- return;
434
- }
435
- this.nativeConfigSyncInFlight = true;
436
- let syncResult: Promise<void>;
437
- try {
438
- syncResult = Promise.resolve(PushyModule.syncNativeConfig(configJson));
439
- } catch (e: any) {
440
- this.nativeConfigSyncInFlight = false;
441
- log('syncNativeConfig failed:', e?.message || e);
442
- return;
443
- }
444
- syncResult
445
- .then(() => {
446
- this.syncedNativeConfigJson = configJson;
447
- })
448
- .catch((e: any) => {
449
- log('syncNativeConfig failed:', e?.message || e);
450
- })
451
- .finally(() => {
452
- this.nativeConfigSyncInFlight = false;
453
- this.flushNativeConfig();
454
- });
455
- };
456
-
457
- /**
458
- * Tell the native cold-start orchestrator that this process already holds a
459
- * valid check response for the current config, so its delayed round (5s
460
- * after launch) does not repeat the request. Fire-and-forget: a failure
461
- * costs one duplicate check. Never called on a failed check — the native
462
- * rescue must keep running when JS could not reach the server.
463
- */
464
- private markJsCheckCompleted = () => {
465
- if (
466
- Platform.OS === 'web' ||
467
- typeof PushyModule.markJsCheckCompleted !== 'function'
468
- ) {
469
- return;
470
- }
471
- const configJson = this.getNativeConfigJson();
472
- if (!configJson) {
473
- return;
474
- }
475
- try {
476
- Promise.resolve(PushyModule.markJsCheckCompleted(configJson)).catch(
477
- (e: any) => {
478
- log('markJsCheckCompleted failed:', e?.message || e);
479
- }
480
- );
481
- } catch (e: any) {
482
- log('markJsCheckCompleted failed:', e?.message || e);
483
- }
484
- };
485
-
486
- private syncNativeConfig = () => {
487
- if (this.options.nativeConfigSource === 'native') {
488
- this.pendingNativeConfigJson = undefined;
489
- return;
490
- }
491
- if (
492
- Platform.OS === 'web' ||
493
- typeof PushyModule.syncNativeConfig !== 'function'
494
- ) {
495
- return;
496
- }
497
- const configJson = this.getNativeConfigJson();
498
- if (!configJson) {
499
- // No usable config (empty appKey / no endpoints) is almost always a
500
- // transient state while options are being assembled. Persisting a
501
- // disabled config over the last good one would switch off the
502
- // cold-start rescue for every later launch, so keep what native has.
503
- // (Web and older natives never reach this point — no method.)
504
- log('native check config unusable, keeping the last synced config');
505
- return;
506
- }
507
- // Always record the latest desired value, even when it matches the last
508
- // completed write. Example: A synced -> B in flight -> options revert to
509
- // A. Comparing only with synced(A) would drop the revert and leave native
510
- // storage at B after that in-flight write completes.
511
- // Coalesce rapid setOptions calls, but serialize bridge writes so an older
512
- // completion can never overwrite the newest desired configuration.
513
- this.pendingNativeConfigJson = configJson;
514
- this.flushNativeConfig();
196
+ this.reporter.syncAutomaticErrorReporting();
197
+ this.nativeConfig.syncNativeConfig();
515
198
  };
516
199
 
517
200
  /** Package version used by every server-side update decision. */
518
201
  getEffectivePackageVersion = () =>
519
202
  this.options.overridePackageVersion || packageVersion;
520
203
 
521
- private jsonValuesEqual = (left: unknown, right: unknown): boolean => {
522
- const compare = (a: unknown, b: unknown): boolean => {
523
- if (a === b) {
524
- return true;
525
- }
526
- if (Array.isArray(a) || Array.isArray(b)) {
527
- return (
528
- Array.isArray(a) &&
529
- Array.isArray(b) &&
530
- a.length === b.length &&
531
- a.every((value, index) => compare(value, b[index]))
532
- );
533
- }
534
- if (
535
- a === null ||
536
- b === null ||
537
- typeof a !== 'object' ||
538
- typeof b !== 'object'
539
- ) {
540
- return false;
541
- }
542
- const leftObject = a as Record<string, unknown>;
543
- const rightObject = b as Record<string, unknown>;
544
- // Match JSON.stringify semantics for request extras: object properties
545
- // whose value is undefined are omitted from the wire fingerprint.
546
- const leftKeys = Object.keys(leftObject)
547
- .filter((key) => leftObject[key] !== undefined)
548
- .sort();
549
- const rightKeys = Object.keys(rightObject)
550
- .filter((key) => rightObject[key] !== undefined)
551
- .sort();
552
- return (
553
- leftKeys.length === rightKeys.length &&
554
- leftKeys.every(
555
- (key, index) =>
556
- key === rightKeys[index] &&
557
- compare(leftObject[key], rightObject[key])
558
- )
559
- );
560
- };
561
-
562
- return compare(left, right);
563
- };
564
-
565
204
  private providerMounted = false;
566
205
  /**
567
206
  * Called by UpdateProvider on mount. A second concurrently mounted
@@ -592,503 +231,6 @@ export class Pushy {
592
231
  return i18n.t(key as any, values);
593
232
  };
594
233
 
595
- reportInvalidUpdateOnce = (
596
- reason: 'missingHash' | 'noArtifact',
597
- hash = ''
598
- ) => {
599
- const key = `${this.options.appKey}:${reason}:${hash}`;
600
- if (this.reportedInvalidUpdates.has(key)) {
601
- return;
602
- }
603
- this.reportedInvalidUpdates.add(key);
604
- this.report({
605
- type: 'errorUpdate',
606
- message:
607
- reason === 'missingHash'
608
- ? 'update response is missing a version hash'
609
- : 'update response contains no downloadable artifact',
610
- ...(hash ? { data: { newVersion: hash } } : {}),
611
- });
612
- };
613
-
614
- /**
615
- * Best-effort JS exception reporting for the currently running OTA release.
616
- * It is intentionally synchronous to call and never throws; the transport
617
- * runs in the background and preserves the app's existing error flow.
618
- */
619
- captureException = (
620
- error: unknown,
621
- context: ErrorReportContext = {}
622
- ): void => {
623
- try {
624
- if (
625
- __DEV__ ||
626
- this.options.disableTelemetry ||
627
- this.options.disableErrorReporting
628
- ) {
629
- return;
630
- }
631
- if (
632
- error !== null &&
633
- (typeof error === 'object' || typeof error === 'function')
634
- ) {
635
- const object = error as object;
636
- if (this.reportedExceptions.has(object)) {
637
- return;
638
- }
639
- this.reportedExceptions.add(object);
640
- }
641
- this.reportExceptionToServer(serializeException(error, context));
642
- } catch (e: any) {
643
- log('exception telemetry error:', e?.message || e);
644
- }
645
- };
646
-
647
- /**
648
- * Ensure uncaught JS exception capture is installed and return a runtime
649
- * cleanup function. Capture is installed automatically by default; this
650
- * method remains an idempotent compatibility hook. The wrapper always
651
- * chains the handler that was installed before it and only restores that
652
- * handler when no later integration has replaced ours.
653
- */
654
- enableErrorReporting = (
655
- options: ErrorReportingOptions = {}
656
- ): (() => void) => {
657
- if (
658
- options.captureGlobal === false ||
659
- this.options.disableTelemetry ||
660
- this.options.disableErrorReporting
661
- ) {
662
- return () => {};
663
- }
664
- if (this.globalErrorCleanup) {
665
- return this.globalErrorCleanup;
666
- }
667
- const uninstall = installGlobalErrorHandler((error, isFatal) => {
668
- this.captureException(error, { fatal: isFatal === true });
669
- });
670
- let active = true;
671
- const cleanup = () => {
672
- if (!active) {
673
- return;
674
- }
675
- active = false;
676
- uninstall();
677
- if (this.globalErrorCleanup === cleanup) {
678
- this.globalErrorCleanup = undefined;
679
- }
680
- };
681
- this.globalErrorCleanup = cleanup;
682
- return cleanup;
683
- };
684
-
685
- private reportExceptionToServer = (error: SerializedException): void => {
686
- try {
687
- if (
688
- __DEV__ ||
689
- this.options.disableTelemetry ||
690
- this.options.disableErrorReporting ||
691
- !currentVersion
692
- ) {
693
- return;
694
- }
695
- const { appKey } = this.options;
696
- const endpoint =
697
- this.lastWorkingEndpoint || this.options.server?.main?.[0];
698
- if (!appKey || !endpoint) {
699
- return;
700
- }
701
- fetchWithTimeout(
702
- `${endpoint}/report/${appKey}`,
703
- {
704
- method: 'POST',
705
- headers: { 'Content-Type': 'application/json' },
706
- body: JSON.stringify({
707
- type: 'js_exception',
708
- hash: currentVersion,
709
- packageVersion: this.getEffectivePackageVersion(),
710
- cInfo,
711
- error,
712
- }),
713
- },
714
- DEFAULT_FETCH_TIMEOUT_MS
715
- ).catch((e: any) => {
716
- log('exception telemetry report failed:', e?.message || e);
717
- });
718
- } catch (e: any) {
719
- log('exception telemetry error:', e?.message || e);
720
- }
721
- };
722
-
723
- report = async ({
724
- type,
725
- message = '',
726
- code,
727
- data = {},
728
- }: {
729
- type: EventType;
730
- message?: string;
731
- code?: UpdateErrorCode;
732
- data?: Record<string, string | number>;
733
- }) => {
734
- log(`${type} ${code ? `[${code}] ` : ''}${message}`);
735
- // Fire-and-forget server telemetry; must not wait for the logger below.
736
- this.reportToServer({ type, message, code, data });
737
- if (this.options.logger === noop) {
738
- // Wait briefly for a logger to arrive via setOptions (e.g. the rollback
739
- // report fires in the constructor before the user configures one), but
740
- // give up after a bound instead of retaining the closure forever when
741
- // no logger is ever provided.
742
- let timer: ReturnType<typeof setTimeout> | undefined;
743
- await Promise.race([
744
- this.loggerPromise.promise,
745
- new Promise<void>((resolve) => {
746
- timer = setTimeout(() => resolve(), 10 * 1000);
747
- }),
748
- ]);
749
- clearTimeout(timer);
750
- }
751
- const { logger = noop, appKey } = this.options;
752
- const overridePackageVersion = this.options.overridePackageVersion;
753
- try {
754
- logger({
755
- type,
756
- data: {
757
- appKey,
758
- currentVersion,
759
- cInfo,
760
- packageVersion,
761
- overridePackageVersion,
762
- buildTime,
763
- message,
764
- code,
765
- ...currentVersionInfo,
766
- ...data,
767
- },
768
- });
769
- } catch (e: any) {
770
- // A user-provided logger must never break the update flow, and report()
771
- // calls are fire-and-forget so a throw here would be an unhandled
772
- // rejection.
773
- log('logger error:', e?.message || e);
774
- }
775
- };
776
- /**
777
- * Best-effort lifecycle event reporting to the update server (aggregate
778
- * counts + sampled failure details power the version health view and the
779
- * rollback safety net server-side). Single POST to the last known working
780
- * endpoint, no retry, no fallback race; any failure is swallowed — telemetry
781
- * must never affect the update flow. Opt out with disableTelemetry.
782
- */
783
- private reportToServer = ({
784
- type,
785
- message = '',
786
- code,
787
- data = {},
788
- }: {
789
- type: EventType;
790
- message?: string;
791
- code?: UpdateErrorCode;
792
- data?: Record<string, string | number>;
793
- }) => {
794
- try {
795
- if (__DEV__ || this.options.disableTelemetry) {
796
- return;
797
- }
798
- const serverType = resolveServerEventType(type, code);
799
- if (!serverType) {
800
- return;
801
- }
802
- const { appKey } = this.options;
803
- const endpoint =
804
- this.lastWorkingEndpoint || this.options.server?.main?.[0];
805
- if (!appKey || !endpoint) {
806
- return;
807
- }
808
- const hash = resolveServerEventHash({ serverType, data, currentVersion });
809
- if (!hash) {
810
- return;
811
- }
812
- const send = (payloadType: typeof serverType, detail?: string) =>
813
- fetchWithTimeout(
814
- `${endpoint}/report/${appKey}`,
815
- {
816
- method: 'POST',
817
- headers: { 'Content-Type': 'application/json' },
818
- body: JSON.stringify({
819
- type: payloadType,
820
- hash,
821
- packageVersion: this.getEffectivePackageVersion(),
822
- cInfo,
823
- detail: truncateDetail(detail),
824
- }),
825
- },
826
- DEFAULT_FETCH_TIMEOUT_MS
827
- ).catch((e: any) => {
828
- log('telemetry report failed:', e?.message || e);
829
- });
830
- send(serverType, message || undefined);
831
- // A download that only succeeded after an incremental patch failed is
832
- // still a patch_fail signal server-side (diff quality), carried in
833
- // data.error alongside the downloadSuccess event.
834
- if (serverType === 'download_success' && data.error) {
835
- send('patch_fail', String(data.error));
836
- }
837
- } catch (e: any) {
838
- log('telemetry error:', e?.message || e);
839
- }
840
- };
841
- throwIfEnabled = (e: Error) => {
842
- if (this.options.throwError) {
843
- throw e;
844
- }
845
- };
846
- private errorListeners = new Set<UpdateErrorListener>();
847
- private emittedErrors = new WeakSet<Error>();
848
- /**
849
- * Subscribe to every error the client reports (regardless of throwError).
850
- * Returns an unsubscribe function.
851
- */
852
- onError = (listener: UpdateErrorListener) => {
853
- this.errorListeners.add(listener);
854
- return () => {
855
- this.errorListeners.delete(listener);
856
- };
857
- };
858
- /**
859
- * Whether this exact error object already went through emitError (and was
860
- * therefore delivered to onError subscribers). Lets UI layers decide if a
861
- * caught error still needs surfacing — checking `e.code` is not enough,
862
- * since axios/system errors carry their own code without ever entering the
863
- * pipeline.
864
- */
865
- wasEmitted = (e: unknown): boolean =>
866
- e instanceof Error && this.emittedErrors.has(e);
867
- /**
868
- * Single exit point for errors: reports to the logger (with the stable
869
- * code) and notifies onError listeners. Whether to also throw stays with
870
- * the caller (throwIfEnabled or an unconditional rethrow).
871
- */
872
- private emitError = (
873
- error: UpdateError,
874
- type: EventType,
875
- {
876
- message = error.message,
877
- data,
878
- }: { message?: string; data?: Record<string, string | number> } = {}
879
- ) => {
880
- this.emittedErrors.add(error);
881
- this.report({
882
- type,
883
- message,
884
- code: error.code,
885
- // Structured context from the error (e.g. HTTP status) reaches the
886
- // logger; explicit data wins on key conflicts.
887
- data: error.extra ? { ...error.extra, ...data } : data,
888
- });
889
- for (const listener of this.errorListeners) {
890
- try {
891
- listener(error, type);
892
- } catch (e: any) {
893
- log('onError listener error:', e?.message || e);
894
- }
895
- }
896
- };
897
- notifyAfterCheckUpdate = (state: UpdateCheckState) => {
898
- const { afterCheckUpdate } = this.options;
899
- if (!afterCheckUpdate) {
900
- return;
901
- }
902
- // 这里仅做状态通知,不阻塞原有检查流程
903
- Promise.resolve(afterCheckUpdate(state)).catch((error: any) => {
904
- log('afterCheckUpdate failed:', error?.message || error);
905
- });
906
- };
907
- runBeforeReload = async (context: BeforeReloadContext) => {
908
- const { beforeReload } = this.options;
909
- if (!beforeReload) {
910
- return true;
911
- }
912
- const shouldReload = await beforeReload(context);
913
- if (shouldReload === false) {
914
- log('beforeReload returned false, skipping reload');
915
- return false;
916
- }
917
- return true;
918
- };
919
- getCheckUrl = (endpoint: string) => {
920
- return `${endpoint}/checkUpdate/${this.options.appKey}`;
921
- };
922
- getConfiguredCheckEndpoints = () => {
923
- const { server } = this.options;
924
- if (!server) {
925
- return [];
926
- }
927
- return dedupeEndpoints(server.main);
928
- };
929
- getRemoteEndpoints = async () => {
930
- const { server } = this.options;
931
- if (!server?.queryUrls?.length) {
932
- return [];
933
- }
934
- try {
935
- // Race the parsed lists, not the raw responses: fetch resolves for
936
- // 404/403/5xx and anti-bot HTML too, and this path only runs once the
937
- // main endpoints are already failing — a mirror that answers first
938
- // with an error page must not beat the healthy one.
939
- const remoteEndpoints = await promiseAny(
940
- server.queryUrls.map(async (queryUrl) => {
941
- const resp = await fetchWithTimeout(
942
- queryUrl,
943
- {},
944
- DEFAULT_FETCH_TIMEOUT_MS
945
- );
946
- if (!resp.ok) {
947
- throw Error(`${queryUrl}: ${resp.status}`);
948
- }
949
- const list: unknown = await resp.json();
950
- if (!Array.isArray(list)) {
951
- throw Error(`${queryUrl}: not an endpoint list`);
952
- }
953
- return list;
954
- })
955
- );
956
- log('fetch endpoints:', remoteEndpoints);
957
- return excludeConfiguredEndpoints(
958
- dedupeEndpoints(
959
- remoteEndpoints.filter(
960
- // The list is fetched from a public mirror; it may add
961
- // endpoints but never move the check outside TLS.
962
- (endpoint): endpoint is string =>
963
- typeof endpoint === 'string' && /^https:\/\//i.test(endpoint)
964
- )
965
- ),
966
- this.getConfiguredCheckEndpoints()
967
- );
968
- } catch (e) {
969
- log('failed to fetch endpoints from: ', server.queryUrls, e);
970
- }
971
- return [];
972
- };
973
- requestCheckResult = async (
974
- endpoint: string,
975
- fetchPayload: Parameters<typeof fetch>[1],
976
- signal?: AbortSignal
977
- ) => {
978
- const resp = await fetchWithTimeout(
979
- this.getCheckUrl(endpoint),
980
- fetchPayload,
981
- DEFAULT_FETCH_TIMEOUT_MS,
982
- signal
983
- );
984
-
985
- if (!resp.ok) {
986
- const respText = (await resp.text()).slice(0, MAX_HTTP_ERROR_TEXT);
987
- throw new UpdateError(
988
- this.t('error_http_status', {
989
- status: resp.status,
990
- statusText: respText,
991
- }),
992
- 'HTTP_STATUS',
993
- { extra: { status: resp.status } }
994
- );
995
- }
996
-
997
- const result: unknown = await resp.json();
998
- if (!isValidCheckResult(result)) {
999
- // A 2xx that is not a verdict (`{"error": ...}`, a captive-portal page
1000
- // that parsed, ...) is a failed endpoint: throwing keeps the fallback
1001
- // moving to the next one instead of treating it as "no update".
1002
- throw new UpdateError(
1003
- this.t('error_invalid_check_response'),
1004
- 'INVALID_RESPONSE'
1005
- );
1006
- }
1007
- return result;
1008
- };
1009
- fetchCheckResult = async (fetchPayload: Parameters<typeof fetch>[1]) => {
1010
- const { endpoint, value } = await executeEndpointFallback<CheckResult>({
1011
- configuredEndpoints: this.getConfiguredCheckEndpoints(),
1012
- getRemoteEndpoints: this.getRemoteEndpoints,
1013
- tryEndpoint: async (currentEndpoint, signal) => {
1014
- try {
1015
- return await this.requestCheckResult(
1016
- currentEndpoint,
1017
- fetchPayload,
1018
- signal
1019
- );
1020
- } catch (e) {
1021
- log('check endpoint failed', currentEndpoint, e);
1022
- throw e;
1023
- }
1024
- },
1025
- onFirstFailure: ({ error }) => {
1026
- this.report({
1027
- type: 'errorChecking',
1028
- message: this.t('error_cannot_connect_backup', {
1029
- message: error.message,
1030
- }),
1031
- });
1032
- },
1033
- });
1034
-
1035
- log('check endpoint success', endpoint);
1036
- this.lastWorkingEndpoint = endpoint;
1037
- return value;
1038
- };
1039
- /**
1040
- * Reuse the native cold-start check's cached response when fresh
1041
- * (NATIVE_CHECKUPDATE_DESIGN §10.3) instead of re-checking. Returns
1042
- * undefined whenever the cache is absent, stale, or unreadable — any
1043
- * failure falls through to a normal network check.
1044
- */
1045
- private readNativeCheckCache = async (
1046
- requestBody: Record<string, any>
1047
- ): Promise<CheckResult | undefined> => {
1048
- try {
1049
- if (__DEV__ || typeof PushyModule.getNativeCheckCache !== 'function') {
1050
- return undefined;
1051
- }
1052
- const raw = await Promise.resolve(PushyModule.getNativeCheckCache());
1053
- if (!raw || typeof raw !== 'string') {
1054
- return undefined;
1055
- }
1056
- const entry = JSON.parse(raw);
1057
- const config = this.getNativeConfig();
1058
- const cachedRequest =
1059
- typeof entry?.request === 'string'
1060
- ? JSON.parse(entry.request)
1061
- : undefined;
1062
- const cachedConfig =
1063
- typeof entry?.config === 'string'
1064
- ? JSON.parse(entry.config)
1065
- : undefined;
1066
- if (
1067
- typeof entry?.ts !== 'number' ||
1068
- typeof entry?.body !== 'string' ||
1069
- !this.jsonValuesEqual(cachedRequest, requestBody) ||
1070
- !config ||
1071
- !this.jsonValuesEqual(cachedConfig, config)
1072
- ) {
1073
- return undefined;
1074
- }
1075
- const ageSeconds = Date.now() / 1000 - entry.ts;
1076
- if (ageSeconds < 0 || ageSeconds > 120) {
1077
- return undefined;
1078
- }
1079
- const result: unknown = JSON.parse(entry.body);
1080
- // Same schema gate as the network path: a native old enough to have
1081
- // cached a 200 `{"error": ...}` must not turn it into "no update".
1082
- if (!isValidCheckResult(result)) {
1083
- return undefined;
1084
- }
1085
- log('reusing native check response cache');
1086
- return result;
1087
- } catch {
1088
- return undefined;
1089
- }
1090
- };
1091
-
1092
234
  assertDebug = (matter: string) => {
1093
235
  if (__DEV__ && !this.options.debug) {
1094
236
  info(this.t('dev_debug_disabled', { matter }));
@@ -1096,733 +238,84 @@ export class Pushy {
1096
238
  }
1097
239
  return true;
1098
240
  };
1099
- markSuccess = async () => {
1100
- if (sharedState.marked || __DEV__ || !isFirstTime) {
1101
- return;
1102
- }
1103
- try {
1104
- await Promise.resolve(PushyModule.markSuccess());
1105
- } catch (e) {
1106
- const err = toUpdateError(e, 'MARK_SUCCESS_FAILED');
1107
- this.emitError(err, 'errorMarkSuccess');
1108
- throw err;
1109
- }
1110
- sharedState.marked = true;
1111
- this.report({ type: 'markSuccess' });
1112
- // 救砖回执:这个版本是被救援通道送进来的,且活过了健康确认——遥测里
1113
- // 一条 rescue 回执就是"这台设备被捞回来了"的证据。
1114
- if (currentVersionInfo.forceBootRescue) {
1115
- this.report({ type: 'forceBootRescue' });
1116
- }
1117
- if (currentVersionInfo.crashRescue) {
1118
- this.report({ type: 'crashRescue' });
1119
- }
1120
- };
241
+ // --- Reporting (clientReporter) ---
242
+ get loggerPromise() {
243
+ return this.reporter.loggerPromise;
244
+ }
245
+ report = (event: ReportEvent) => this.reporter.report(event);
246
+ reportInvalidUpdateOnce: Reporter['reportInvalidUpdateOnce'] = (...args) =>
247
+ this.reporter.reportInvalidUpdateOnce(...args);
248
+ captureException: Reporter['captureException'] = (...args) =>
249
+ this.reporter.captureException(...args);
250
+ enableErrorReporting: Reporter['enableErrorReporting'] = (...args) =>
251
+ this.reporter.enableErrorReporting(...args);
252
+ throwIfEnabled = (e: Error) => this.reporter.throwIfEnabled(e);
253
+ onError: Reporter['onError'] = (listener) => this.reporter.onError(listener);
254
+ wasEmitted = (e: unknown): boolean => this.reporter.wasEmitted(e);
255
+ private emitError: Reporter['emitError'] = (...args) =>
256
+ this.reporter.emitError(...args);
257
+ notifyAfterCheckUpdate: Reporter['notifyAfterCheckUpdate'] = (state) =>
258
+ this.reporter.notifyAfterCheckUpdate(state);
259
+
260
+ // --- Checking (clientCheck) ---
261
+ get lastChecking() {
262
+ return this.checker.lastChecking;
263
+ }
264
+ set lastChecking(value) {
265
+ this.checker.lastChecking = value;
266
+ }
267
+ get lastRespJson() {
268
+ return this.checker.lastRespJson;
269
+ }
270
+ set lastRespJson(value) {
271
+ this.checker.lastRespJson = value;
272
+ }
273
+ get lastCheckFingerprint() {
274
+ return this.checker.lastCheckFingerprint;
275
+ }
276
+ set lastCheckFingerprint(value) {
277
+ this.checker.lastCheckFingerprint = value;
278
+ }
279
+ getConfiguredCheckEndpoints = () =>
280
+ this.checker.getConfiguredCheckEndpoints();
281
+ getRemoteEndpoints = () => this.checker.getRemoteEndpoints();
282
+ requestCheckResult: Checker['requestCheckResult'] = (...args) =>
283
+ this.checker.requestCheckResult(...args);
284
+ fetchCheckResult: Checker['fetchCheckResult'] = (fetchPayload) =>
285
+ this.checker.fetchCheckResult(fetchPayload);
286
+ checkUpdate: Checker['checkUpdate'] = (extra) =>
287
+ this.checker.checkUpdate(extra);
288
+
289
+ // --- Downloading (clientDownload) ---
290
+ downloadUpdate: Downloader['downloadUpdate'] = (...args) =>
291
+ this.downloader.downloadUpdate(...args);
292
+ downloadAndInstallApk: Downloader['downloadAndInstallApk'] = (...args) =>
293
+ this.downloader.downloadAndInstallApk(...args);
294
+
295
+ // --- Activation (clientActivation) ---
296
+ runBeforeReload: Activation['runBeforeReload'] = (context) =>
297
+ this.activation.runBeforeReload(context);
298
+ markSuccess = () => this.activation.markSuccess();
299
+ /** The downloaded version switchVersion(Later) accepts; undefined before a download. */
300
+ getDownloadedHash = (): string | undefined =>
301
+ this.activation.getDownloadedHash();
1121
302
  /**
1122
303
  * Reload into a downloaded version. Resolves true once the native reload
1123
304
  * was requested, false when the call was ignored (not the downloaded hash,
1124
305
  * a switch already in progress, beforeReload declined, dev without debug).
1125
306
  */
1126
- switchVersion = async (hash: string): Promise<boolean> => {
1127
- if (!this.assertDebug('switchVersion()')) {
1128
- return false;
1129
- }
1130
- if (!assertHash(hash)) {
1131
- return false;
1132
- }
1133
- if (sharedState.applyingUpdate) {
1134
- log(`switchVersion: ${hash} ignored, a switch is already in progress`);
1135
- return false;
1136
- }
1137
- log(`switchVersion: ${hash}`);
1138
- const applyingGeneration = beginApplyingUpdate();
1139
- try {
1140
- if (!(await this.runBeforeReload({ type: 'switchVersion', hash }))) {
1141
- finishApplyingUpdate(applyingGeneration);
1142
- return false;
1143
- }
1144
- } catch (e) {
1145
- finishApplyingUpdate(applyingGeneration);
1146
- // A throw from the user's beforeReload hook is business-code failure,
1147
- // not an update-pipeline one: give it a distinct code so telemetry
1148
- // excludes it from the server-side patch-health stats.
1149
- const err = toUpdateError(e, 'USER_HOOK_ERROR');
1150
- this.emitError(err, 'errorSwitchVersion', {
1151
- data: { newVersion: hash },
1152
- });
1153
- throw err;
1154
- }
1155
- // resetToPackagedBundle may have completed while beforeReload awaited.
1156
- if (!ownsApplyingUpdate(applyingGeneration)) {
1157
- return false;
1158
- }
1159
- try {
1160
- await PushyModule.reloadUpdate({ hash });
1161
- } catch (e) {
1162
- // Do not let a superseded rejection clear a newer switch.
1163
- finishApplyingUpdate(applyingGeneration);
1164
- const err = toUpdateError(e, 'SWITCH_VERSION_FAILED');
1165
- this.emitError(err, 'errorSwitchVersion', {
1166
- data: { newVersion: hash },
1167
- });
1168
- throw err;
1169
- }
1170
- // A resolved reloadUpdate normally tears this JS context down right away.
1171
- // iOS has been seen resolving without restarting (89c638e); a stuck
1172
- // applyingUpdate would then silently swallow every later switchVersion,
1173
- // so release it once the process has outlived the reload and tell the
1174
- // logger (RESTART_FAILED: restart mechanics, not patch health).
1175
- armReloadWatchdog(applyingGeneration, () => {
1176
- this.report({
1177
- type: 'errorSwitchVersion',
1178
- code: 'RESTART_FAILED',
1179
- message: 'reloadUpdate resolved but the app did not restart',
1180
- data: { newVersion: hash },
1181
- });
1182
- });
1183
- return true;
1184
- };
1185
-
1186
- switchVersionLater = async (hash: string) => {
1187
- if (!this.assertDebug('switchVersionLater()')) {
1188
- return;
1189
- }
1190
- if (assertHash(hash)) {
1191
- log(`switchVersionLater: ${hash}`);
1192
- try {
1193
- return await PushyModule.setNeedUpdate({ hash });
1194
- } catch (e) {
1195
- const err = toUpdateError(e, 'SWITCH_VERSION_FAILED');
1196
- this.emitError(err, 'errorSwitchVersion', {
1197
- data: { newVersion: hash },
1198
- });
1199
- throw err;
1200
- }
1201
- }
1202
- };
1203
- checkUpdate = async (extra?: Record<string, any>) => {
1204
- if (!this.assertDebug('checkUpdate()')) {
1205
- this.notifyAfterCheckUpdate({ status: 'skipped' });
1206
- return;
1207
- }
1208
- if (!assertWeb()) {
1209
- this.notifyAfterCheckUpdate({ status: 'skipped' });
1210
- return;
1211
- }
1212
- if (
1213
- this.options.beforeCheckUpdate &&
1214
- (await this.options.beforeCheckUpdate()) === false
1215
- ) {
1216
- log('beforeCheckUpdate returned false, skipping check');
1217
- this.notifyAfterCheckUpdate({ status: 'skipped' });
1218
- return;
1219
- }
1220
- // 内容寻址的二进制身份,服务端据此精确判定 pdiff 适用性(取代 buildTime
1221
- // 启发式)。同步读 core 里已预取的值:还没算完就省略字段(服务端回退
1222
- // buildTime 启发式),下一次检查自然带上——绝不为它 await、拖慢或复杂化
1223
- // 检查流程。
1224
- const bundleHash = __DEV__ ? '' : getBundleHash();
1225
- const fetchBody = buildCheckRequestBody({
1226
- packageVersion: this.getEffectivePackageVersion(),
1227
- currentVersion,
1228
- buildTime,
1229
- cInfo,
1230
- supportedDiffVersion,
1231
- bundleHash,
1232
- isDev: __DEV__,
1233
- extra,
1234
- });
1235
- const stringifyBody = JSON.stringify(fetchBody);
1236
- // Identity of this check: only a check with the exact same request (same
1237
- // extra / test hash / bundleHash / binary identity) against the same
1238
- // endpoint set may share an in-flight or just-settled response. Two
1239
- // checks 2s apart with different `extra` are different questions.
1240
- const fingerprint = buildCheckFingerprint({
1241
- appKey: this.options.appKey,
1242
- endpoints: this.options.server?.main,
1243
- queryUrls: this.options.server?.queryUrls,
1244
- // The client uuid travels inside cInfo, i.e. inside `body`.
1245
- body: stringifyBody,
1246
- });
1247
- const now = Date.now();
1248
- if (
1249
- this.lastRespJson &&
1250
- this.lastChecking &&
1251
- this.lastCheckFingerprint === fingerprint &&
1252
- now - this.lastChecking < 1000 * 5
1253
- ) {
1254
- try {
1255
- const result = await this.lastRespJson;
1256
- this.notifyAfterCheckUpdate({ status: 'completed', result });
1257
- return result;
1258
- } catch (e: any) {
1259
- // The shared in-flight check failed. Its initiating call reports it
1260
- // through emitError/throw; this call must still honor its own
1261
- // contract — afterCheckUpdate always fires and throwError applies —
1262
- // without double-reporting the same error.
1263
- const err = toUpdateError(e, 'CHECK_FAILED');
1264
- this.notifyAfterCheckUpdate({ status: 'error', error: err });
1265
- this.throwIfEnabled(err);
1266
- return undefined;
1267
- }
1268
- }
1269
- this.lastChecking = now;
1270
- this.lastCheckFingerprint = fingerprint;
1271
- // harmony fetch body is not string
1272
- let body: any = fetchBody;
1273
- if (Platform.OS === 'ios' || Platform.OS === 'android') {
1274
- body = stringifyBody;
1275
- }
1276
- const fetchPayload = {
1277
- method: 'POST',
1278
- headers: {
1279
- Accept: 'application/json',
1280
- 'Content-Type': 'application/json',
1281
- },
1282
- body,
1283
- };
1284
- let respJsonPromise: Promise<CheckResult> | undefined;
1285
- try {
1286
- this.report({
1287
- type: 'checking',
1288
- message: `${this.options.appKey}: ${stringifyBody}`,
1289
- });
1290
- // The native cold-start check may have a fresh response on disk
1291
- // (§10.3); reuse it instead of re-checking. The read happens INSIDE
1292
- // the promise so no await lands between the dedup window above and the
1293
- // lastRespJson assignment below (the JS2-1 double-send lesson).
1294
- respJsonPromise = (async (): Promise<CheckResult> => {
1295
- // While bundleHash prefetch is still pending, the JS request omits
1296
- // that key whereas the native request always includes its synchronously
1297
- // computed value. That narrow first-launch window intentionally misses
1298
- // the cache rather than delaying checkUpdate for hashing.
1299
- const cached = await this.readNativeCheckCache(fetchBody);
1300
- return cached ?? (await this.fetchCheckResult(fetchPayload));
1301
- })();
1302
- this.lastRespJson = respJsonPromise;
1303
- const result: CheckResult = await respJsonPromise;
1304
-
1305
- log('checking result:', result);
1306
-
1307
- if (result?.bundleStatus === 'unknownBundle') {
1308
- // 服务端判定当前二进制内嵌 bundle 未注册,增量已被降级为全量。只面向
1309
- // 开发者(日志 + 遥测,控制台聚合是主渠道);终端用户无感知。
1310
- warn(this.t('warn_unknown_bundle'));
1311
- this.report({
1312
- type: 'bundleMismatch',
1313
- data: bundleHash ? { bundleHash } : {},
1314
- });
1315
- }
1316
-
1317
- this.notifyAfterCheckUpdate({ status: 'completed', result });
1318
- this.markJsCheckCompleted();
1319
- return result;
1320
- } catch (e: any) {
1321
- // A failed check must not keep vouching for an older response: clear
1322
- // the dedup slot so the next call re-asks the server — unless a newer
1323
- // check already owns the slot, which this failure says nothing about.
1324
- if (this.lastRespJson === respJsonPromise) {
1325
- this.lastRespJson = undefined;
1326
- this.lastCheckFingerprint = undefined;
1327
- }
1328
- const err = toUpdateError(e, 'CHECK_FAILED');
1329
- this.emitError(err, 'errorChecking', {
1330
- message: err.message || this.t('error_cannot_connect_server'),
1331
- });
1332
- this.notifyAfterCheckUpdate({ status: 'error', error: err });
1333
- this.throwIfEnabled(err);
1334
- // No silent fallback to a previous successful response: a stale result
1335
- // would let a server outage look like "still updatable" and drive the
1336
- // provider's auto-download off it. Return undefined so callers can
1337
- // distinguish "check failed" from a real empty result and keep their
1338
- // last good updateInfo.
1339
- return undefined;
1340
- }
1341
- };
1342
- downloadUpdate = async (
1343
- updateInfo: CheckResult,
1344
- onDownloadProgress?: (data: ProgressData) => void
1345
- ) => {
1346
- if (
1347
- this.options.beforeDownloadUpdate &&
1348
- (await this.options.beforeDownloadUpdate(updateInfo)) === false
1349
- ) {
1350
- log('beforeDownloadUpdate returned false, skipping download');
1351
- return;
1352
- }
1353
- const decision = decideDownload(
1354
- updateInfo,
1355
- { currentVersion, rolledBackVersion },
1356
- __DEV__
1357
- );
1358
- if (decision.action === 'none') {
1359
- if (decision.reason === 'alreadyCurrent') {
1360
- log(`current hash ${currentVersion}, ignored`);
1361
- } else if (decision.reason === 'rolledBack') {
1362
- log(`rolledback hash ${rolledBackVersion}, ignored`);
1363
- } else if (decision.reason === 'noArtifact') {
1364
- // A server response that advertises an update but provides no usable
1365
- // artifact is a bad release signal, not an ordinary no-update result.
1366
- // Keep the user flow silent and report at most once per bad release in
1367
- // this process: repeated checks must not inflate download_fail health.
1368
- this.reportInvalidUpdateOnce('noArtifact', updateInfo.hash || '');
1369
- }
1370
- return;
1371
- }
1372
- const { hash } = decision;
1373
- if (sharedState.downloadedHash === hash) {
1374
- log(`duplicated downloaded hash ${sharedState.downloadedHash}, ignored`);
1375
- return sharedState.downloadedHash;
1376
- }
1377
- // Deduplicate concurrent downloads of the same hash regardless of whether a
1378
- // progress callback was passed: all callers await the single in-flight
1379
- // promise instead of triggering parallel native downloads.
1380
- const existingTask = sharedState.downloadingTasks[hash];
1381
- if (existingTask) {
1382
- log(`download for hash ${hash} already in progress, reusing it`);
1383
- // The second caller's progress callback must still fire.
1384
- if (onDownloadProgress) {
1385
- sharedState.progressCallbacks[hash]?.add(onDownloadProgress);
1386
- }
1387
- return existingTask;
1388
- }
1389
- const task = this.performDownload(updateInfo, decision, onDownloadProgress);
1390
- sharedState.downloadingTasks[hash] = task;
1391
- try {
1392
- return await task;
1393
- } finally {
1394
- delete sharedState.downloadingTasks[hash];
1395
- }
1396
- };
307
+ switchVersion = (hash: string): Promise<boolean> =>
308
+ this.activation.switchVersion(hash);
309
+ switchVersionLater = (hash: string) =>
310
+ this.activation.switchVersionLater(hash);
311
+ restartApp = () => this.activation.restartApp();
1397
312
  /**
1398
- * Orders candidate mirrors for one artifact: the HEAD-race winner first
1399
- * (its post-redirect URL), then the remaining mirrors in configured order.
1400
- * Empty when there is nothing to try.
313
+ * Reset to the bundle packaged in the binary (see
314
+ * Activation.resetToPackagedBundle). Returns whether the reset happened;
315
+ * a false means the app still runs the hot-updated bundle.
1401
316
  */
1402
- private rankDownloadUrls = async (urls?: string[]): Promise<string[]> => {
1403
- if (!urls?.length) {
1404
- return [];
1405
- }
1406
- const winner = await testUrls(urls);
1407
- const ordered: string[] = [];
1408
- const push = (url?: string | null) => {
1409
- if (url && !ordered.includes(url)) {
1410
- ordered.push(url);
1411
- }
1412
- };
1413
- push(winner);
1414
- for (const url of urls) {
1415
- push(url);
1416
- }
1417
- return ordered;
1418
- };
1419
- private performDownload = async (
1420
- updateInfo: CheckResult,
1421
- plan: DownloadPlan,
1422
- onDownloadProgress?: (data: ProgressData) => void
1423
- ) => {
1424
- const { name, description = '', metaInfo } = updateInfo;
1425
- const { hash, attempts, devNoop } = plan;
1426
- if (devNoop) {
1427
- // Dev without a full package URL: nothing can be fetched, let alone
1428
- // installed. Say so and deliver nothing — faking a success here used to
1429
- // hand the caller a hash whose switchVersion the native side (rightly)
1430
- // rejects with SWITCH_VERSION_FAILED.
1431
- log(this.t('dev_incremental_update_disabled'));
1432
- return;
1433
- }
1434
- const patchStartTime = Date.now();
1435
- // One native listener per hash dispatching to a callback set, so
1436
- // concurrent callers deduped onto this task can each observe progress
1437
- // (they register via downloadUpdate).
1438
- const progressCallbacks = new Set<(data: ProgressData) => void>();
1439
- if (onDownloadProgress) {
1440
- progressCallbacks.add(onDownloadProgress);
1441
- }
1442
- sharedState.progressCallbacks[hash] = progressCallbacks;
1443
- const dispatchProgress = (data: ProgressData) => {
1444
- const callbacks = sharedState.progressCallbacks[hash];
1445
- if (!callbacks || callbacks.size === 0) {
1446
- return;
1447
- }
1448
- const payload = {
1449
- ...data,
1450
- progress: computeProgress(data.received, data.total),
1451
- };
1452
- callbacks.forEach((callback) => {
1453
- // One subscriber throwing must not starve the others or abort the
1454
- // download: business callbacks are isolated, the error is logged.
1455
- try {
1456
- callback(payload);
1457
- } catch (e) {
1458
- warn('onDownloadProgress callback threw', e);
1459
- }
1460
- });
1461
- };
1462
- // RN >= 0.87 types native event listeners as `(...args: readonly Object[])`,
1463
- // which a `(data: ProgressData) => void` callback is not assignable to. Take
1464
- // the raw event and narrow it here so this compiles on every RN version.
1465
- const onNativeProgress = (event: unknown) => {
1466
- const progressData = event as ProgressData;
1467
- if (progressData.hash === hash) {
1468
- dispatchProgress(progressData);
1469
- }
1470
- };
1471
- // @ts-expect-error harmony not in existing platforms
1472
- if (Platform.OS === 'harmony') {
1473
- sharedState.progressHandlers[hash] = DeviceEventEmitter.addListener(
1474
- 'RCTPushyDownloadProgress',
1475
- onNativeProgress
1476
- );
1477
- } else {
1478
- sharedState.progressHandlers[hash] = pushyNativeEventEmitter.addListener(
1479
- 'RCTPushyDownloadProgress',
1480
- onNativeProgress
1481
- );
1482
- }
1483
- const maxRetries = Math.max(0, Math.floor(this.options.maxRetries ?? 3));
1484
- let succeeded = '';
1485
- let lastError: UpdateError | undefined;
1486
- const errorMessages: string[] = [];
1487
- // A strategy whose bytes arrived but could not be applied fails the same
1488
- // way on every retry (same artifact, same base): remember it — with its
1489
- // message, so the final report still names it — and skip it on later
1490
- // attempts instead of downloading and patching it again.
1491
- const exhaustedStrategies = new Map<DownloadStrategyType, string>();
1492
- // Whether any strategy, in any attempt, failed at the patch stage. The
1493
- // downloadFallback report carries that as its code even when a later,
1494
- // unrelated transport failure happened to be the last error seen.
1495
- let patchFailed = false;
1496
-
1497
- // The ordered attempts come from decideDownload (the pure decision layer);
1498
- // this side only executes them: probe candidate URLs, run the matching
1499
- // native download, fall through to the next attempt on failure.
1500
- const runners: Record<
1501
- DownloadStrategyType,
1502
- (url: string) => Promise<void>
1503
- > = {
1504
- diff: (url) =>
1505
- PushyModule.downloadPatchFromPpk({
1506
- updateUrl: url,
1507
- hash,
1508
- originHash: currentVersion,
1509
- }),
1510
- pdiff: (url) =>
1511
- PushyModule.downloadPatchFromPackage({
1512
- updateUrl: url,
1513
- hash,
1514
- }),
1515
- full: (url) =>
1516
- PushyModule.downloadFullUpdate({
1517
- updateUrl: url,
1518
- hash,
1519
- }),
1520
- };
1521
- const errorKeys = {
1522
- diff: 'error_diff_failed',
1523
- pdiff: 'error_pdiff_failed',
1524
- full: 'error_full_patch_failed',
1525
- } as const;
1526
-
1527
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
1528
- if (attempt > 0) {
1529
- // Exponential backoff with jitter: a bad CDN edge otherwise gets
1530
- // every client back at the same 1/2/4s marks.
1531
- const backoffMs = Math.round(
1532
- Math.min(1000 * 2 ** (attempt - 1), 10000) *
1533
- (0.75 + Math.random() * 0.5)
1534
- );
1535
- log(`retry attempt ${attempt}/${maxRetries}, waiting ${backoffMs}ms`);
1536
- await new Promise<void>((r) => setTimeout(() => r(), backoffMs));
1537
- errorMessages.length = 0;
1538
- errorMessages.push(...exhaustedStrategies.values());
1539
- lastError = undefined;
1540
- succeeded = '';
1541
- }
1542
- this.report({
1543
- type: 'downloading',
1544
- data: {
1545
- newVersion: hash,
1546
- attempt,
1547
- },
1548
- });
1549
- for (const { type, urls } of attempts) {
1550
- if (succeeded) {
1551
- break;
1552
- }
1553
- if (exhaustedStrategies.has(type)) {
1554
- continue;
1555
- }
1556
- // The HEAD race only ranks mirrors; it is not proof that a mirror can
1557
- // serve the whole artifact (CDNs answer HEAD and GET differently, and
1558
- // a transfer can die mid-stream). Every mirror of the same artifact
1559
- // gets a real download attempt before the strategy is abandoned —
1560
- // the native cold-start path already behaves this way.
1561
- const orderedUrls = await this.rankDownloadUrls(urls);
1562
- for (const url of orderedUrls) {
1563
- log(`downloading ${type} from ${url}`);
1564
- try {
1565
- await runners[type](url);
1566
- succeeded = type;
1567
- break;
1568
- } catch (e: unknown) {
1569
- // The native rejection's stable code (e.g. PATCH_FAILED vs
1570
- // DOWNLOAD_FAILED — telemetry classifies on it) may sit on the
1571
- // `code` property or, from bridges that cannot set it, as a
1572
- // `[CODE] ` message prefix. Either way it survives into the
1573
- // i18n-wrapped error together with the original as cause.
1574
- const { code, message } = readErrorCode(e);
1575
- const errorMessage = this.t(errorKeys[type], {
1576
- message: message || String(e ?? ''),
1577
- });
1578
- errorMessages.push(errorMessage);
1579
- lastError = new UpdateError(
1580
- errorMessage,
1581
- code ?? 'DOWNLOAD_FAILED',
1582
- {
1583
- cause: e,
1584
- }
1585
- );
1586
- log(errorMessage);
1587
- if (lastError.code === 'PATCH_FAILED') {
1588
- patchFailed = true;
1589
- }
1590
- if (!isMirrorRetryableCode(lastError.code)) {
1591
- // The bytes arrived but could not be applied (patch/manifest
1592
- // mismatch): every mirror serves the same artifact, so move
1593
- // on to the next strategy instead of re-downloading it.
1594
- exhaustedStrategies.set(type, errorMessage);
1595
- break;
1596
- }
1597
- }
1598
- }
1599
- }
1600
- if (
1601
- succeeded ||
1602
- attempts.every(({ type }) => exhaustedStrategies.has(type))
1603
- ) {
1604
- // Nothing left that a retry could change.
1605
- break;
1606
- }
1607
- }
1608
- if (sharedState.progressHandlers[hash]) {
1609
- sharedState.progressHandlers[hash].remove();
1610
- delete sharedState.progressHandlers[hash];
1611
- }
1612
- delete sharedState.progressCallbacks[hash];
1613
- if (succeeded && errorMessages.length > 0) {
1614
- // An earlier strategy failed and a later one rescued the download
1615
- // (e.g. pdiff copiesCrc mismatch on a rebuilt binary → full). Surface
1616
- // the degradation: it is invisible to the end user but tells the
1617
- // platform that incremental delivery is failing for this binary.
1618
- this.report({
1619
- type: 'downloadFallback',
1620
- // The patch-health signal wins over whatever transport failure
1621
- // happened to come last (diff PATCH_FAILED, then pdiff network
1622
- // error, then full succeeded is still a patch_fail server-side).
1623
- code: patchFailed ? 'PATCH_FAILED' : lastError?.code,
1624
- data: {
1625
- newVersion: hash,
1626
- succeeded,
1627
- },
1628
- message: errorMessages.join(';'),
1629
- });
1630
- }
1631
- if (!succeeded) {
1632
- const message = errorMessages.join(';');
1633
- if (lastError) {
1634
- const err = toUpdateError(lastError, 'DOWNLOAD_FAILED');
1635
- this.emitError(err, 'errorUpdate', {
1636
- message,
1637
- data: { newVersion: hash },
1638
- });
1639
- throw err;
1640
- }
1641
- // No download URL was even attempted (e.g. dev without a full URL):
1642
- // report for diagnostics but there is no error object to surface.
1643
- this.report({
1644
- type: 'errorUpdate',
1645
- data: { newVersion: hash },
1646
- message,
1647
- });
1648
- return;
1649
- } else {
1650
- const duration = Date.now() - patchStartTime;
1651
- const data: Record<string, any> = {
1652
- newVersion: hash,
1653
- diff: succeeded,
1654
- duration,
1655
- };
1656
- if (errorMessages.length > 0) {
1657
- data.error = errorMessages.join(';');
1658
- }
1659
- this.report({
1660
- type: 'downloadSuccess',
1661
- data,
1662
- });
1663
- }
1664
- log(`downloaded ${succeeded} hash:`, hash);
1665
- const hashInfo: Record<string, any> = {
1666
- name,
1667
- description,
1668
- metaInfo,
1669
- };
1670
- if (sharedState.toHash === hash) {
1671
- hashInfo.debugChannel = true;
1672
- }
1673
- // The version is "downloaded" only once its metadata is persisted: a
1674
- // lost hash-info write would leave the next launch with a nameless
1675
- // version and a switchVersion that the native side may refuse.
1676
- try {
1677
- await setLocalHashInfo(hash, hashInfo);
1678
- } catch (e: any) {
1679
- const err = toUpdateError(e, 'FILE_OPERATION_FAILED');
1680
- this.emitError(err, 'errorUpdate', {
1681
- message: err.message,
1682
- data: { newVersion: hash },
1683
- });
1684
- throw err;
1685
- }
1686
- sharedState.downloadedHash = hash;
1687
- return hash;
1688
- };
1689
- downloadAndInstallApk = async (
1690
- url: string,
1691
- onDownloadProgress?: (data: ProgressData) => void
1692
- ) => {
1693
- if (Platform.OS !== 'android') {
1694
- return;
1695
- }
1696
- if (sharedState.apkStatus === 'downloading') {
1697
- return;
1698
- }
1699
- if (sharedState.apkStatus === 'downloaded') {
1700
- const err = new UpdateError(
1701
- this.t('error_apk_pending_install'),
1702
- 'APK_INSTALL_PENDING'
1703
- );
1704
- this.emitError(err, 'errorInstallApk');
1705
- this.throwIfEnabled(err);
1706
- return;
1707
- }
1708
- sharedState.apkStatus = 'downloading';
1709
- this.report({ type: 'downloadingApk' });
1710
- const progressKey = 'downloadingApk';
1711
- if (onDownloadProgress) {
1712
- if (sharedState.progressHandlers[progressKey]) {
1713
- sharedState.progressHandlers[progressKey].remove();
1714
- }
1715
- sharedState.progressHandlers[progressKey] =
1716
- pushyNativeEventEmitter.addListener(
1717
- 'RCTPushyDownloadProgress',
1718
- (event: unknown) => {
1719
- const progressData = event as ProgressData;
1720
- if (progressData.hash === progressKey) {
1721
- onDownloadProgress(progressData);
1722
- }
1723
- }
1724
- );
1725
- }
1726
- try {
1727
- await PushyModule.downloadAndInstallApk({
1728
- url,
1729
- target: 'update.apk',
1730
- hash: progressKey,
1731
- });
1732
- sharedState.apkStatus = 'downloaded';
1733
- } catch (e) {
1734
- sharedState.apkStatus = null;
1735
- // Keep the native error (message/stack) instead of discarding it.
1736
- const err = toUpdateError(e, 'APK_DOWNLOAD_FAILED');
1737
- this.emitError(err, 'errorDownloadAndInstallApk', {
1738
- message: err.message || this.t('error_apk_download_failed'),
1739
- });
1740
- this.throwIfEnabled(err);
1741
- } finally {
1742
- if (sharedState.progressHandlers[progressKey]) {
1743
- sharedState.progressHandlers[progressKey].remove();
1744
- delete sharedState.progressHandlers[progressKey];
1745
- }
1746
- }
1747
- };
1748
- restartApp = async () => {
1749
- try {
1750
- if (!(await this.runBeforeReload({ type: 'restartApp' }))) {
1751
- return;
1752
- }
1753
- } catch (e) {
1754
- const err = toUpdateError(e, 'USER_HOOK_ERROR');
1755
- this.emitError(err, 'errorRestart');
1756
- throw err;
1757
- }
1758
- try {
1759
- return await PushyModule.restartApp();
1760
- } catch (e) {
1761
- const err = toUpdateError(e, 'RESTART_FAILED');
1762
- this.emitError(err, 'errorRestart');
1763
- throw err;
1764
- }
1765
- };
1766
- /**
1767
- * Reset to the bundle packaged in the binary: wipes every downloaded update
1768
- * and the whole update state on the native side, so the app loads the
1769
- * built-in bundle on the next launch (or immediately with
1770
- * `{ restart: true }`). The client uuid is preserved.
1771
- *
1772
- * Returns whether the reset actually happened. Like the other update-flow
1773
- * APIs it never throws by default — failures land in lastError/onError with
1774
- * code RESET_FAILED — but the boolean must not be ignored: a false means the
1775
- * app is still running the hot-updated bundle. Set `throwError` to throw.
1776
- */
1777
- resetToPackagedBundle = async (options?: {
1778
- restart?: boolean;
1779
- }): Promise<boolean> => {
1780
- if (!assertWeb()) {
1781
- // On web PushyModule is a Proxy of noops, so the feature-detect below
1782
- // would report a false success.
1783
- return false;
1784
- }
1785
- if (typeof PushyModule.resetToPackagedBundle !== 'function') {
1786
- // The JS layer can arrive via hot update onto an older binary whose
1787
- // native module predates this method.
1788
- const err = new UpdateError(
1789
- this.t('error_reset_not_supported'),
1790
- 'RESET_FAILED'
1791
- );
1792
- this.emitError(err, 'errorReset');
1793
- this.throwIfEnabled(err);
1794
- return false;
1795
- }
1796
- try {
1797
- await PushyModule.resetToPackagedBundle();
1798
- } catch (e) {
1799
- const err = toUpdateError(e, 'RESET_FAILED');
1800
- this.emitError(err, 'errorReset');
1801
- this.throwIfEnabled(err);
1802
- return false;
1803
- }
1804
- // The downloaded versions are gone; drop JS bookkeeping referring to them
1805
- // so a stale downloadedHash cannot be switched to.
1806
- sharedState.downloadedHash = undefined;
1807
- sharedState.toHash = undefined;
1808
- sharedState.marked = false;
1809
- // Invalidate the private owner too: old promises/timers must not touch
1810
- // a switch that starts after this reset.
1811
- invalidateApplyingUpdate();
1812
- sharedState.apkStatus = null;
1813
- this.report({ type: 'reset' });
1814
- if (options?.restart) {
1815
- try {
1816
- await this.restartApp();
1817
- } catch (e: any) {
1818
- // The reset itself succeeded and the restart failure was already
1819
- // reported through the pipeline; the boolean must still say "state
1820
- // is reset".
1821
- log('restart after reset failed:', e?.message || e);
1822
- }
1823
- }
1824
- return true;
1825
- };
317
+ resetToPackagedBundle: Activation['resetToPackagedBundle'] = (options) =>
318
+ this.activation.resetToPackagedBundle(options);
1826
319
  }
1827
320
 
1828
321
  // for international users