react-native-update 10.49.0 → 10.51.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/BUNDLEHASH_MIGRATION.md +22 -2
- package/NATIVE_CHECKUPDATE_DESIGN.md +251 -21
- package/NATIVE_CHECK_FOLLOWUPS.md +365 -0
- package/README-CN.md +14 -1
- package/README.md +14 -1
- package/android/jni/Android.mk +5 -1
- package/android/lib/arm64-v8a/librnupdate.so +0 -0
- package/android/lib/armeabi-v7a/librnupdate.so +0 -0
- package/android/lib/x86/librnupdate.so +0 -0
- package/android/lib/x86_64/librnupdate.so +0 -0
- package/android/src/main/java/cn/reactnative/modules/update/BundledResourceCopier.java +42 -9
- package/android/src/main/java/cn/reactnative/modules/update/DownloadTask.java +98 -22
- package/android/src/main/java/cn/reactnative/modules/update/DownloadTaskParams.java +3 -0
- package/android/src/main/java/cn/reactnative/modules/update/NativeCheckOrchestrator.java +455 -0
- package/android/src/main/java/cn/reactnative/modules/update/NativeUpdateFlow.java +23 -0
- package/android/src/main/java/cn/reactnative/modules/update/PatchFailedException.java +16 -0
- package/android/src/main/java/cn/reactnative/modules/update/UpdateContext.java +196 -42
- package/android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java +56 -3
- package/android/src/newarch/cn/reactnative/modules/update/UpdateModule.java +10 -0
- package/android/src/oldarch/cn/reactnative/modules/update/UpdateModule.java +10 -0
- package/cpp/patch_core/digest.cpp +53 -0
- package/cpp/patch_core/digest.h +18 -0
- package/cpp/patch_core/patch_core.cpp +17 -1
- package/cpp/patch_core/patch_core.h +8 -0
- package/cpp/patch_core/tests/patch_core_test.cpp +99 -0
- package/cpp/update_flow_core/flow_json.cpp +522 -0
- package/cpp/update_flow_core/flow_json.h +103 -0
- package/cpp/update_flow_core/tests/flow_vectors.json +1401 -0
- package/cpp/update_flow_core/tests/update_flow_core_test.cpp +317 -0
- package/cpp/update_flow_core/update_flow_core.cpp +301 -0
- package/cpp/update_flow_core/update_flow_core.h +77 -0
- package/cpp/update_flow_core/update_flow_jni.cpp +121 -0
- package/harmony/pushy/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/pushy/src/main/cpp/pushy.cpp +150 -1
- package/harmony/pushy/src/main/ets/DownloadTask.ts +133 -9
- package/harmony/pushy/src/main/ets/DownloadTaskParams.ts +3 -0
- package/harmony/pushy/src/main/ets/MonotonicClock.ts +13 -0
- package/harmony/pushy/src/main/ets/NativeCheckOrchestrator.ts +500 -0
- package/harmony/pushy/src/main/ets/NativePatchCore.ts +16 -0
- package/harmony/pushy/src/main/ets/PathUtils.ts +21 -0
- package/harmony/pushy/src/main/ets/PushyTurboModule.ts +22 -0
- package/harmony/pushy/src/main/ets/UpdateContext.ts +152 -52
- package/harmony/pushy.har +0 -0
- package/ios/RCTPushy/RCTPushy.mm +840 -68
- package/ios/RCTPushy/RCTPushyDownloader.h +1 -0
- package/ios/RCTPushy/RCTPushyDownloader.mm +4 -3
- package/package.json +3 -1
- package/react-native-update.podspec +2 -0
- package/src/NativePushy.ts +14 -0
- package/src/client.ts +439 -122
- package/src/endpoint.ts +105 -80
- package/src/error.ts +4 -0
- package/src/locales/en.ts +4 -0
- package/src/locales/zh.ts +4 -0
- package/src/provider.tsx +74 -9
- package/src/telemetry.ts +8 -0
- package/src/type.ts +31 -0
- package/src/updateFlowCore.ts +320 -0
- package/src/utils.ts +14 -12
- package/src/isInRollout.ts +0 -86
- package/src/resolveCheckResult.ts +0 -30
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
@interface RCTPushyDownloader : NSObject
|
|
4
4
|
|
|
5
5
|
+ (void)download:(NSString *)downloadPath savePath:(NSString *)savePath
|
|
6
|
+
timeoutInterval:(NSTimeInterval)timeoutInterval
|
|
6
7
|
progressHandler:(void (^)(long long, long long))progressHandler
|
|
7
8
|
completionHandler:(void (^)(NSString *path, NSError *error))completionHandler;
|
|
8
9
|
|
|
@@ -17,6 +17,7 @@ static NSString *const RCTPushyDownloaderErrorDomain = @"cn.reactnative.pushy";
|
|
|
17
17
|
@implementation RCTPushyDownloader
|
|
18
18
|
|
|
19
19
|
+ (void)download:(NSString *)downloadPath savePath:(NSString *)savePath
|
|
20
|
+
timeoutInterval:(NSTimeInterval)timeoutInterval
|
|
20
21
|
progressHandler:(void (^)(long long receivedBytes, long long totalBytes))progressHandler
|
|
21
22
|
completionHandler:(void (^)(NSString *path, NSError *error))completionHandler
|
|
22
23
|
{
|
|
@@ -28,10 +29,10 @@ completionHandler:(void (^)(NSString *path, NSError *error))completionHandler
|
|
|
28
29
|
downloader.completionHandler = completionHandler;
|
|
29
30
|
downloader.savePath = savePath;
|
|
30
31
|
|
|
31
|
-
[downloader startDownload:downloadPath];
|
|
32
|
+
[downloader startDownload:downloadPath timeoutInterval:timeoutInterval];
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
- (void)startDownload:(NSString *)path
|
|
35
|
+
- (void)startDownload:(NSString *)path timeoutInterval:(NSTimeInterval)timeoutInterval
|
|
35
36
|
{
|
|
36
37
|
NSURL *url = [NSURL URLWithString:path];
|
|
37
38
|
if (url == nil) {
|
|
@@ -50,7 +51,7 @@ completionHandler:(void (^)(NSString *path, NSError *error))completionHandler
|
|
|
50
51
|
// Android's 10min callTimeout — 300s made a 30MB full package on a slow
|
|
51
52
|
// (<100KB/s) network fail on iOS while succeeding on Android.
|
|
52
53
|
sessionConfig.timeoutIntervalForRequest = 30;
|
|
53
|
-
sessionConfig.timeoutIntervalForResource =
|
|
54
|
+
sessionConfig.timeoutIntervalForResource = MAX(1, timeoutInterval);
|
|
54
55
|
self.session = [NSURLSession sessionWithConfiguration:sessionConfig
|
|
55
56
|
delegate:self
|
|
56
57
|
delegateQueue:nil];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-update",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.51.0",
|
|
4
4
|
"description": "react-native hot update",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
"submodule": "git submodule update --init --recursive",
|
|
15
15
|
"test": "bun test src/__tests__",
|
|
16
16
|
"test:patch-core": "./scripts/test-patch-core.sh",
|
|
17
|
+
"test:flow-core": "./scripts/test-update-flow-core.sh",
|
|
18
|
+
"generate:flow-vectors": "bun scripts/generate-flow-vectors.ts",
|
|
17
19
|
"build:harmony-har": "node scripts/build-harmony-har.js",
|
|
18
20
|
"build:harmony-e2e": "bash Example/e2etest/scripts/build-harmony-e2e.sh",
|
|
19
21
|
"build:so": "bun submodule && bash scripts/build-android-so.sh",
|
|
@@ -110,6 +110,8 @@ Pod::Spec.new do |s|
|
|
|
110
110
|
|
|
111
111
|
s.subspec 'RCTPushy' do |ss|
|
|
112
112
|
ss.source_files = ['ios/RCTPushy/*.{h,m,mm}',
|
|
113
|
+
'cpp/update_flow_core/flow_json.{h,cpp}',
|
|
114
|
+
'cpp/update_flow_core/update_flow_core.{h,cpp}',
|
|
113
115
|
'cpp/patch_core/archive_patch_core.{h,cpp}',
|
|
114
116
|
'cpp/patch_core/digest.{h,cpp}',
|
|
115
117
|
'cpp/patch_core/hbc_transform.{h,cpp}',
|
package/src/NativePushy.ts
CHANGED
|
@@ -16,6 +16,20 @@ export interface Spec extends TurboModule {
|
|
|
16
16
|
setLocalHashInfo(hash: string, info: string): Promise<void>;
|
|
17
17
|
getLocalHashInfo(hash: string): Promise<string>;
|
|
18
18
|
setUuid(uuid: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Persist the config subset the native cold-start update check consumes
|
|
21
|
+
* (appKey, endpoints, afterDownload policy; NATIVE_CHECKUPDATE_DESIGN
|
|
22
|
+
* §10.1). Stored as a raw JSON string, parsed natively on read. JS is the
|
|
23
|
+
* single config source — a native side without persisted config silently
|
|
24
|
+
* skips its check, which doubles as the feature's rollout gate.
|
|
25
|
+
*/
|
|
26
|
+
syncNativeConfig(config: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Raw response cached by the native cold-start check, including the request
|
|
29
|
+
* and config fingerprints that scope reuse (§10.3). Resolves to
|
|
30
|
+
* an empty string when absent; never rejects.
|
|
31
|
+
*/
|
|
32
|
+
getNativeCheckCache(): Promise<string>;
|
|
19
33
|
reloadUpdate(options: { hash: string }): Promise<void>;
|
|
20
34
|
restartApp(): Promise<void>;
|
|
21
35
|
setNeedUpdate(options: { hash: string }): Promise<void>;
|