react-native-update 10.59.2 → 10.60.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.
- package/README-CN.md +7 -7
- package/README.md +7 -6
- package/android/build.gradle +25 -33
- package/android/jni/Android.mk +16 -24
- package/android/lib/arm64-v8a/librnpushy.so +0 -0
- package/android/lib/armeabi-v7a/librnpushy.so +0 -0
- package/android/lib/x86/librnpushy.so +0 -0
- package/android/lib/x86_64/librnpushy.so +0 -0
- package/android/proguard.pro +9 -7
- package/android/src/main/java/cn/reactnative/modules/update/ApkInstaller.java +2 -7
- package/android/src/main/java/cn/reactnative/modules/update/ArchiveLimits.java +23 -6
- package/android/src/main/java/cn/reactnative/modules/update/BundledResourceCopier.java +50 -51
- package/android/src/main/java/cn/reactnative/modules/update/CleanupKeepNames.java +12 -13
- package/android/src/main/java/cn/reactnative/modules/update/CopyGroupResult.java +3 -0
- package/android/src/main/java/cn/reactnative/modules/update/CrashHold.java +22 -30
- package/android/src/main/java/cn/reactnative/modules/update/DownloadTask.java +181 -332
- package/android/src/main/java/cn/reactnative/modules/update/DownloadTaskParams.java +3 -1
- package/android/src/main/java/cn/reactnative/modules/update/ErrorCodes.java +27 -0
- package/android/src/main/java/cn/reactnative/modules/update/FileOperationException.java +1 -1
- package/android/src/main/java/cn/reactnative/modules/update/FlowBridge.java +32 -8
- package/android/src/main/java/cn/reactnative/modules/update/HttpClients.java +63 -0
- package/android/src/main/java/cn/reactnative/modules/update/HttpUtils.java +0 -11
- package/android/src/main/java/cn/reactnative/modules/update/InstallRecord.java +66 -116
- package/android/src/main/java/cn/reactnative/modules/update/NativeCore.java +9 -1
- package/android/src/main/java/cn/reactnative/modules/update/PatchFailedException.java +1 -1
- package/android/src/main/java/cn/reactnative/modules/update/PushyRuntime.java +32 -60
- package/android/src/main/java/cn/reactnative/modules/update/ReactReloadManager.java +8 -23
- package/android/src/main/java/cn/reactnative/modules/update/SafeZipFile.java +42 -80
- package/android/src/main/java/cn/reactnative/modules/update/StateSerialRunner.java +22 -39
- package/android/src/main/java/cn/reactnative/modules/update/SyncCoordinator.java +176 -299
- package/android/src/main/java/cn/reactnative/modules/update/Threads.java +35 -0
- package/android/src/main/java/cn/reactnative/modules/update/UpdateContext.java +242 -174
- package/android/src/main/java/cn/reactnative/modules/update/UpdateEventEmitter.java +1 -1
- package/android/src/main/java/cn/reactnative/modules/update/UpdateFileUtils.java +75 -17
- package/android/src/main/java/cn/reactnative/modules/update/{UpdateModuleImpl.java → UpdateModule.java} +113 -95
- package/android/src/main/java/cn/reactnative/modules/update/UpdatePackage.java +16 -19
- package/android/src/oldarch/cn/reactnative/modules/update/NativePushySpec.java +69 -0
- package/cpp/android_jni/archive_limits_jni.cpp +83 -0
- package/cpp/android_jni/install_record_jni.cpp +89 -0
- package/cpp/android_jni/jni_log.h +31 -0
- package/cpp/android_jni/jni_natives.h +40 -0
- package/cpp/android_jni/jni_registration.cpp +133 -0
- package/cpp/android_jni/jni_util.h +160 -0
- package/cpp/android_jni/update_core_android.cpp +450 -0
- package/cpp/android_jni/update_flow_jni.cpp +133 -0
- package/{android/jni → cpp/hpatch}/hpatch.c +5 -5
- package/{android/jni → cpp/hpatch}/hpatch.h +4 -1
- package/cpp/patch_core/archive_limits.cpp +194 -0
- package/cpp/patch_core/archive_limits.h +99 -10
- package/cpp/patch_core/archive_patch_core.cpp +96 -12
- package/cpp/patch_core/archive_patch_core.h +49 -0
- package/cpp/patch_core/digest.h +5 -4
- package/cpp/patch_core/error_codes.h +5 -3
- package/cpp/patch_core/install_record.cpp +430 -0
- package/cpp/patch_core/install_record.h +163 -9
- package/cpp/patch_core/patch_core.cpp +62 -16
- package/cpp/patch_core/patch_core.h +27 -7
- package/cpp/patch_core/patch_manifest.cpp +201 -0
- package/cpp/patch_core/patch_manifest.h +74 -0
- package/cpp/patch_core/state_ops.h +3 -3
- package/cpp/update_flow_core/flow_json.cpp +82 -8
- package/cpp/update_flow_core/flow_json.h +21 -0
- package/cpp/update_flow_core/native_config.cpp +456 -0
- package/cpp/update_flow_core/native_config.h +84 -0
- package/cpp/update_flow_core/native_round.cpp +326 -0
- package/cpp/update_flow_core/native_round.h +90 -0
- package/cpp/update_flow_core/update_flow_core.h +2 -2
- package/harmony/hvigor-plugin.ts +11 -19
- package/harmony/pushy/src/main/cpp/CMakeLists.txt +17 -26
- package/harmony/pushy/src/main/cpp/PushyPackage.h +2 -2
- package/harmony/pushy/src/main/cpp/PushyTurboModule.cpp +55 -94
- package/harmony/pushy/src/main/cpp/pushy.cpp +694 -517
- package/harmony/pushy/src/main/ets/ArchiveLimits.ts +48 -72
- package/harmony/pushy/src/main/ets/DownloadTask.ts +164 -404
- package/harmony/pushy/src/main/ets/DownloadTaskParams.ts +1 -3
- package/harmony/pushy/src/main/ets/ErrorCodes.ts +1 -14
- package/harmony/pushy/src/main/ets/EventHub.ts +1 -1
- package/harmony/pushy/src/main/ets/InstallRecord.ts +52 -151
- package/harmony/pushy/src/main/ets/Logger.ts +20 -34
- package/harmony/pushy/src/main/ets/NativePatchCore.ts +116 -42
- package/harmony/pushy/src/main/ets/PushyConfiguration.ts +8 -85
- package/harmony/pushy/src/main/ets/PushyTurboModule.ts +11 -25
- package/harmony/pushy/src/main/ets/SaveFile.ts +99 -18
- package/harmony/pushy/src/main/ets/SyncCoordinator.ts +136 -335
- package/harmony/pushy/src/main/ets/Texts.ts +0 -4
- package/harmony/pushy/src/main/ets/UpdateContext.ts +106 -119
- package/harmony/pushy.har +0 -0
- package/ios/RCTPushy/RCTPushy+Launch.mm +185 -0
- package/ios/RCTPushy/RCTPushy.h +12 -0
- package/ios/RCTPushy/RCTPushy.mm +87 -2634
- package/ios/RCTPushy/RCTPushyCommon.h +34 -0
- package/ios/RCTPushy/RCTPushyConfiguration.h +0 -8
- package/ios/RCTPushy/RCTPushyConfiguration.mm +40 -121
- package/ios/RCTPushy/RCTPushyDownloader.mm +40 -37
- package/ios/RCTPushy/RCTPushyInstallRecord.mm +61 -0
- package/ios/RCTPushy/RCTPushyInstaller.mm +689 -0
- package/ios/RCTPushy/RCTPushyInternal.h +144 -0
- package/ios/RCTPushy/RCTPushyOrchestrator.mm +1001 -0
- package/ios/RCTPushy/RCTPushyState.mm +314 -0
- package/package.json +25 -23
- package/react-native-update.podspec +73 -82
- package/src/client.ts +361 -451
- package/src/context.ts +1 -1
- package/src/core.ts +35 -8
- package/src/endpoint.ts +0 -2
- package/src/error.ts +13 -32
- package/src/i18n.ts +18 -83
- package/src/locales/en.ts +0 -4
- package/src/locales/zh.ts +0 -4
- package/src/provider.tsx +60 -53
- package/src/telemetry.ts +0 -13
- package/src/type.ts +0 -15
- package/src/updateFlowCore.ts +116 -10
- package/src/utils.ts +49 -42
- package/android/src/main/java/cn/reactnative/modules/update/ArchivePatchPlanResult.java +0 -6
- package/android/src/main/java/cn/reactnative/modules/update/PushyConfiguration.java +0 -104
- package/android/src/main/java/cn/reactnative/modules/update/UiThreadRunner.java +0 -37
- package/android/src/newarch/cn/reactnative/modules/update/UpdateModule.java +0 -121
- package/android/src/oldarch/cn/reactnative/modules/update/UpdateModule.java +0 -125
- package/cpp/patch_core/jni_natives.h +0 -27
- package/cpp/patch_core/jni_registration.cpp +0 -103
- package/cpp/patch_core/jni_util.h +0 -60
- package/cpp/patch_core/patch_core_android.cpp +0 -97
- package/cpp/patch_core/update_core_android.cpp +0 -485
- package/cpp/update_flow_core/update_flow_jni.cpp +0 -150
|
@@ -3,82 +3,61 @@
|
|
|
3
3
|
using namespace facebook;
|
|
4
4
|
using namespace rnoh;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
// The JS-visible method table: (name, argument count, SYNC | ASYNC).
|
|
7
|
+
//
|
|
8
|
+
// This table is the only bridge RNOH gives JS into the ArkTS module: a method
|
|
9
|
+
// missing here is `undefined` on the JS side, and the JS feature-detects then
|
|
10
|
+
// treat the whole capability as "old native" and silently skip it — which is
|
|
11
|
+
// how the native cold-start check shipped dark on Harmony. Every spec method
|
|
12
|
+
// (src/NativePushy.ts) MUST be listed.
|
|
13
|
+
//
|
|
14
|
+
// Only the constants and the RN event plumbing are SYNC. Every
|
|
15
|
+
// Promise-returning spec method MUST be ASYNC: a sync registration converts
|
|
16
|
+
// the ArkTS Promise into an empty jsi object and its rejection becomes an
|
|
17
|
+
// unhandled ArkTS rejection, so JS would report e.g. setNeedUpdate as
|
|
18
|
+
// successful while nothing was switched. scripts/check-native-spec-parity.js
|
|
19
|
+
// enforces both rules against this table.
|
|
20
|
+
#define PUSHY_METHODS(X) \
|
|
21
|
+
X(getConstants, 0, SYNC) \
|
|
22
|
+
X(addListener, 1, SYNC) \
|
|
23
|
+
X(removeListeners, 1, SYNC) \
|
|
24
|
+
X(setLocalHashInfo, 2, ASYNC) \
|
|
25
|
+
X(getLocalHashInfo, 1, ASYNC) \
|
|
26
|
+
X(setUuid, 1, ASYNC) \
|
|
27
|
+
X(reloadUpdate, 1, ASYNC) \
|
|
28
|
+
X(restartApp, 0, ASYNC) \
|
|
29
|
+
X(setNeedUpdate, 1, ASYNC) \
|
|
30
|
+
X(markSuccess, 0, ASYNC) \
|
|
31
|
+
X(downloadPatchFromPpk, 1, ASYNC) \
|
|
32
|
+
X(downloadPatchFromPackage, 1, ASYNC) \
|
|
33
|
+
X(downloadFullUpdate, 1, ASYNC) \
|
|
34
|
+
X(downloadAndInstallApk, 1, ASYNC) \
|
|
35
|
+
X(syncNativeConfig, 1, ASYNC) \
|
|
36
|
+
X(getNativeCheckCache, 0, ASYNC) \
|
|
37
|
+
X(markJsCheckCompleted, 1, ASYNC) \
|
|
38
|
+
X(getBundleHash, 0, ASYNC) \
|
|
39
|
+
X(resetToPackagedBundle, 0, ASYNC)
|
|
18
40
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const char *methodName,
|
|
23
|
-
const jsi::Value *args,
|
|
24
|
-
size_t count) {
|
|
25
|
-
return jsi::Value(
|
|
26
|
-
static_cast<ArkTSTurboModule &>(turboModule).callAsync(
|
|
27
|
-
rt, methodName, args, count));
|
|
28
|
-
}
|
|
41
|
+
// ArkTSTurboModule entry point per kind.
|
|
42
|
+
#define PUSHY_INVOKE_SYNC call
|
|
43
|
+
#define PUSHY_INVOKE_ASYNC callAsync
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
static jsi::Value HostFunction_##method_name( \
|
|
32
|
-
jsi::Runtime &rt, \
|
|
33
|
-
react::TurboModule &turboModule, \
|
|
34
|
-
const jsi::Value *args, \
|
|
35
|
-
size_t count) { \
|
|
36
|
-
return CallSync(rt, turboModule, #method_name, args, count); \
|
|
37
|
-
}
|
|
45
|
+
namespace {
|
|
38
46
|
|
|
39
|
-
#define
|
|
40
|
-
|
|
47
|
+
#define PUSHY_HOST_FUNCTION(method_name, arg_count, kind) \
|
|
48
|
+
jsi::Value HostFunction_##method_name( \
|
|
41
49
|
jsi::Runtime &rt, \
|
|
42
50
|
react::TurboModule &turboModule, \
|
|
43
51
|
const jsi::Value *args, \
|
|
44
52
|
size_t count) { \
|
|
45
|
-
return
|
|
53
|
+
return jsi::Value( \
|
|
54
|
+
static_cast<ArkTSTurboModule &>(turboModule) \
|
|
55
|
+
.PUSHY_INVOKE_##kind(rt, #method_name, args, count)); \
|
|
46
56
|
}
|
|
47
57
|
|
|
48
|
-
|
|
49
|
-
// Promise-returning spec method (src/NativePushy.ts) MUST be registered
|
|
50
|
-
// with PUSHY_ASYNC_METHOD: a sync registration converts the ArkTS Promise
|
|
51
|
-
// into an empty jsi object and its rejection becomes an unhandled ArkTS
|
|
52
|
-
// rejection, so JS would report e.g. setNeedUpdate as successful while
|
|
53
|
-
// nothing was switched. scripts/check-native-spec-parity.js enforces this.
|
|
54
|
-
PUSHY_SYNC_METHOD(getConstants)
|
|
55
|
-
PUSHY_SYNC_METHOD(addListener)
|
|
56
|
-
PUSHY_SYNC_METHOD(removeListeners)
|
|
58
|
+
PUSHY_METHODS(PUSHY_HOST_FUNCTION)
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
PUSHY_ASYNC_METHOD(getLocalHashInfo)
|
|
60
|
-
PUSHY_ASYNC_METHOD(setUuid)
|
|
61
|
-
PUSHY_ASYNC_METHOD(setNeedUpdate)
|
|
62
|
-
PUSHY_ASYNC_METHOD(markSuccess)
|
|
63
|
-
PUSHY_ASYNC_METHOD(reloadUpdate)
|
|
64
|
-
PUSHY_ASYNC_METHOD(restartApp)
|
|
65
|
-
PUSHY_ASYNC_METHOD(downloadPatchFromPpk)
|
|
66
|
-
PUSHY_ASYNC_METHOD(downloadPatchFromPackage)
|
|
67
|
-
PUSHY_ASYNC_METHOD(downloadFullUpdate)
|
|
68
|
-
PUSHY_ASYNC_METHOD(downloadAndInstallApk)
|
|
69
|
-
// 10.50+ additions. This table is the only bridge RNOH gives JS into the
|
|
70
|
-
// ArkTS module: a method missing here is `undefined` on the JS side, and the
|
|
71
|
-
// JS feature-detects then treat the whole capability as "old native" and
|
|
72
|
-
// silently skip it — which is how the native cold-start check shipped dark
|
|
73
|
-
// on Harmony. Every new spec method MUST be registered here.
|
|
74
|
-
PUSHY_ASYNC_METHOD(syncNativeConfig)
|
|
75
|
-
PUSHY_ASYNC_METHOD(getNativeCheckCache)
|
|
76
|
-
PUSHY_ASYNC_METHOD(markJsCheckCompleted)
|
|
77
|
-
PUSHY_ASYNC_METHOD(getBundleHash)
|
|
78
|
-
PUSHY_ASYNC_METHOD(resetToPackagedBundle)
|
|
79
|
-
|
|
80
|
-
#undef PUSHY_SYNC_METHOD
|
|
81
|
-
#undef PUSHY_ASYNC_METHOD
|
|
60
|
+
#undef PUSHY_HOST_FUNCTION
|
|
82
61
|
|
|
83
62
|
} // namespace
|
|
84
63
|
|
|
@@ -86,33 +65,15 @@ PushyTurboModule::PushyTurboModule(
|
|
|
86
65
|
const ArkTSTurboModule::Context ctx,
|
|
87
66
|
const std::string name)
|
|
88
67
|
: ArkTSTurboModule(ctx, name) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
68
|
+
#define PUSHY_REGISTER_METHOD(method_name, arg_count, kind) \
|
|
69
|
+
methodMap_[#method_name] = \
|
|
70
|
+
MethodMetadata{arg_count, HostFunction_##method_name};
|
|
71
|
+
|
|
72
|
+
PUSHY_METHODS(PUSHY_REGISTER_METHOD)
|
|
95
73
|
|
|
96
|
-
|
|
97
|
-
registerMethod("setLocalHashInfo", 2, HostFunction_setLocalHashInfo);
|
|
98
|
-
registerMethod("getLocalHashInfo", 1, HostFunction_getLocalHashInfo);
|
|
99
|
-
registerMethod("setUuid", 1, HostFunction_setUuid);
|
|
100
|
-
registerMethod("reloadUpdate", 1, HostFunction_reloadUpdate);
|
|
101
|
-
registerMethod("restartApp", 0, HostFunction_restartApp);
|
|
102
|
-
registerMethod("setNeedUpdate", 1, HostFunction_setNeedUpdate);
|
|
103
|
-
registerMethod("markSuccess", 0, HostFunction_markSuccess);
|
|
104
|
-
registerMethod("downloadPatchFromPpk", 1, HostFunction_downloadPatchFromPpk);
|
|
105
|
-
registerMethod(
|
|
106
|
-
"downloadPatchFromPackage", 1, HostFunction_downloadPatchFromPackage);
|
|
107
|
-
registerMethod("downloadFullUpdate", 1, HostFunction_downloadFullUpdate);
|
|
108
|
-
registerMethod(
|
|
109
|
-
"downloadAndInstallApk", 1, HostFunction_downloadAndInstallApk);
|
|
110
|
-
registerMethod("addListener", 1, HostFunction_addListener);
|
|
111
|
-
registerMethod("removeListeners", 1, HostFunction_removeListeners);
|
|
112
|
-
registerMethod("syncNativeConfig", 1, HostFunction_syncNativeConfig);
|
|
113
|
-
registerMethod("getNativeCheckCache", 0, HostFunction_getNativeCheckCache);
|
|
114
|
-
registerMethod("markJsCheckCompleted", 1, HostFunction_markJsCheckCompleted);
|
|
115
|
-
registerMethod("getBundleHash", 0, HostFunction_getBundleHash);
|
|
116
|
-
registerMethod(
|
|
117
|
-
"resetToPackagedBundle", 0, HostFunction_resetToPackagedBundle);
|
|
74
|
+
#undef PUSHY_REGISTER_METHOD
|
|
118
75
|
}
|
|
76
|
+
|
|
77
|
+
#undef PUSHY_INVOKE_SYNC
|
|
78
|
+
#undef PUSHY_INVOKE_ASYNC
|
|
79
|
+
#undef PUSHY_METHODS
|