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
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Internal to the RCTPushy pod: what the module's translation units share.
|
|
2
|
+
// Not a public header; it pulls in C++ headers, so it must stay out of the
|
|
3
|
+
// module umbrella.
|
|
4
|
+
//
|
|
5
|
+
// RCTPushy.mm RN exports, constants, host API entry points
|
|
6
|
+
// RCTPushy+Launch.mm launch bundle resolution, paths, binary identity
|
|
7
|
+
// RCTPushyState.mm persisted keys, state lock, State <-> defaults,
|
|
8
|
+
// string/error/JSON helpers, bundle hash
|
|
9
|
+
// RCTPushyInstallRecord.mm version directories, completion record
|
|
10
|
+
// (over cpp/patch_core/install_record.h)
|
|
11
|
+
// RCTPushyInstaller.mm download/unzip/patch pipeline, switchVersion,
|
|
12
|
+
// cleanup (owns the process-wide file queue)
|
|
13
|
+
// RCTPushyOrchestrator.mm the native round
|
|
14
|
+
#pragma once
|
|
15
|
+
|
|
16
|
+
#import "RCTPushy.h"
|
|
17
|
+
#import "RCTPushyCommon.h"
|
|
18
|
+
#import <React/RCTBridgeModule.h>
|
|
19
|
+
#import <React/RCTLog.h>
|
|
20
|
+
|
|
21
|
+
#include <atomic>
|
|
22
|
+
#include <string>
|
|
23
|
+
|
|
24
|
+
#include "../../cpp/patch_core/state_core.h"
|
|
25
|
+
|
|
26
|
+
// RN's log macros pass __FILE__, which would embed this file's absolute build
|
|
27
|
+
// path in the binary; log with the bare file name instead.
|
|
28
|
+
#if RCTLOG_ENABLED
|
|
29
|
+
#undef _RCTLog
|
|
30
|
+
#define _RCTLog(lvl, ...) _RCTLogNativeInternal(lvl, __FILE_NAME__, __LINE__, __VA_ARGS__)
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
typedef NS_ENUM(NSInteger, PushyType) {
|
|
34
|
+
PushyTypeFullDownload = 1,
|
|
35
|
+
PushyTypePatchFromPackage = 2,
|
|
36
|
+
PushyTypePatchFromPpk = 3,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
#pragma mark - RCTPushyState.mm
|
|
40
|
+
|
|
41
|
+
extern PUSHY_HIDDEN NSString *const keyPushyInfo;
|
|
42
|
+
extern PUSHY_HIDDEN NSString *const paramCurrentVersion;
|
|
43
|
+
extern PUSHY_HIDDEN NSString *const keyUuid;
|
|
44
|
+
extern PUSHY_HIDDEN NSString *const keyHashInfo;
|
|
45
|
+
extern PUSHY_HIDDEN NSString *const keyFirstLoadMarked;
|
|
46
|
+
extern PUSHY_HIDDEN NSString *const keyRolledBackMarked;
|
|
47
|
+
extern PUSHY_HIDDEN NSString *const keyNativeCheckCache;
|
|
48
|
+
extern PUSHY_HIDDEN NSString *const ERROR_OPTIONS;
|
|
49
|
+
// Consumed by the first +bundleURL of a process; re-armed by a version switch.
|
|
50
|
+
extern PUSHY_HIDDEN std::atomic<bool> ignoreRollback;
|
|
51
|
+
// Bumped by resetToPackagedBundle only; see RCTPushyState.mm.
|
|
52
|
+
extern PUSHY_HIDDEN std::atomic<uint64_t> pushyResetGeneration;
|
|
53
|
+
|
|
54
|
+
PUSHY_HIDDEN NSString *KeyPackageUpdatedMarked(void);
|
|
55
|
+
PUSHY_HIDDEN NSString *PushyHashInfoKey(NSString *hash);
|
|
56
|
+
// Immutable host-facing snapshot; activated always means NEXT launch.
|
|
57
|
+
PUSHY_HIDDEN NSDictionary *PushyHostResult(NSString *status, NSString *reason,
|
|
58
|
+
NSString *hash = nil, BOOL activated = NO);
|
|
59
|
+
PUSHY_HIDDEN NSTimeInterval PushyMonotonicNow(void);
|
|
60
|
+
PUSHY_HIDDEN NSUserDefaults *PushyDefaults(void);
|
|
61
|
+
PUSHY_HIDDEN void PushyWithStateLock(void (NS_NOESCAPE ^block)(void));
|
|
62
|
+
PUSHY_HIDDEN std::string PushyToStdString(NSString *value);
|
|
63
|
+
PUSHY_HIDDEN NSString *PushyFromStdString(const std::string &value);
|
|
64
|
+
PUSHY_HIDDEN NSString *PushyOptionString(NSDictionary *options, NSString *key);
|
|
65
|
+
PUSHY_HIDDEN BOOL PushyStringIsBlank(NSString *value);
|
|
66
|
+
PUSHY_HIDDEN BOOL PushyIsSafePathComponent(NSString *value);
|
|
67
|
+
PUSHY_HIDDEN NSError *PushyErrorWithCode(const char *code, NSString *message);
|
|
68
|
+
PUSHY_HIDDEN void PushyRejectError(RCTPromiseRejectBlock reject, NSError *error);
|
|
69
|
+
// The parsed JSON object in `json` (NSString or NSData); nil when it does not
|
|
70
|
+
// parse or is not an object. *error carries the parse error, if any.
|
|
71
|
+
PUSHY_HIDDEN NSDictionary *PushyJsonDictionary(id json, NSError **error);
|
|
72
|
+
// `object` serialized as a JSON string; nil when it cannot be.
|
|
73
|
+
PUSHY_HIDDEN NSString *PushyJsonString(id object);
|
|
74
|
+
PUSHY_HIDDEN pushy::state::State PushyStateFromDefaults(NSUserDefaults *defaults);
|
|
75
|
+
PUSHY_HIDDEN void PushyApplyStateToDefaults(NSUserDefaults *defaults,
|
|
76
|
+
const pushy::state::State &state);
|
|
77
|
+
PUSHY_HIDDEN void PushySwitchVersionLocked(NSString *hash);
|
|
78
|
+
PUSHY_HIDDEN NSString *PushyBundleHashSync(BOOL computeIfMissing);
|
|
79
|
+
|
|
80
|
+
#pragma mark - RCTPushyInstallRecord.mm
|
|
81
|
+
|
|
82
|
+
extern PUSHY_HIDDEN NSString *const BUNDLE_FILE_NAME;
|
|
83
|
+
|
|
84
|
+
PUSHY_HIDDEN NSString *PushyVersionDir(NSString *hash);
|
|
85
|
+
PUSHY_HIDDEN NSString *PushyStagingDir(NSString *hash);
|
|
86
|
+
PUSHY_HIDDEN BOOL PushyHasCompletedVersionAtPath(NSString *versionDir, NSString *hash);
|
|
87
|
+
PUSHY_HIDDEN NSString *PushyRecordedBundleSha256(NSString *versionDir);
|
|
88
|
+
PUSHY_HIDDEN NSError *PushyPromoteStagingDir(NSString *hash, NSString *artifactSha256);
|
|
89
|
+
|
|
90
|
+
#pragma mark - RCTPushyInstaller.mm
|
|
91
|
+
|
|
92
|
+
// Protocol key of the artifact URL in download options.
|
|
93
|
+
PUSHY_HIDDEN NSString *PushyOptionUrlKey(void);
|
|
94
|
+
// Process-wide serial queue for every destructive file operation (unzip,
|
|
95
|
+
// patch, promote, cleanup), shared by JS calls and the native round.
|
|
96
|
+
PUSHY_HIDDEN dispatch_queue_t PushyFileQueue(void);
|
|
97
|
+
|
|
98
|
+
// The download → unzip → patch → install pipeline and version activation. No
|
|
99
|
+
// bridge needed: JS calls and the native round share it.
|
|
100
|
+
@interface RCTPushyInstaller : NSObject
|
|
101
|
+
// options: url (PushyOptionUrlKey), hash, originHash (diff only), optional
|
|
102
|
+
// deadlineUptime. progress may be nil. callback runs on the file queue, or
|
|
103
|
+
// synchronously when nothing has to be downloaded (invalid options, version
|
|
104
|
+
// already installed, deadline already passed).
|
|
105
|
+
+ (void)fetch:(PushyType)type
|
|
106
|
+
options:(NSDictionary *)options
|
|
107
|
+
progress:(void (^)(long long received, long long total))progress
|
|
108
|
+
callback:(void (^)(NSError *error))callback;
|
|
109
|
+
+ (BOOL)switchVersion:(NSString *)hash error:(NSError **)error;
|
|
110
|
+
+ (void)clearInvalidFiles;
|
|
111
|
+
@end
|
|
112
|
+
|
|
113
|
+
#pragma mark - RCTPushy+Launch.mm
|
|
114
|
+
|
|
115
|
+
// The version whose bundle this process actually loaded; guarded by the state
|
|
116
|
+
// lock. See RCTPushy+Launch.mm.
|
|
117
|
+
extern PUSHY_HIDDEN NSString *pushyLaunchVersion;
|
|
118
|
+
|
|
119
|
+
@interface RCTPushy (Launch)
|
|
120
|
+
+ (NSURL *)resolveLaunchBundleURL:(NSString **)launchRolledBackVersionOut
|
|
121
|
+
purgedVersion:(NSString **)purgedVersionOut;
|
|
122
|
+
+ (NSString *)downloadDir;
|
|
123
|
+
+ (NSURL *)binaryBundleURL;
|
|
124
|
+
+ (NSString *)packageVersion;
|
|
125
|
+
+ (NSString *)buildTime;
|
|
126
|
+
@end
|
|
127
|
+
|
|
128
|
+
#pragma mark - RCTPushyOrchestrator.mm
|
|
129
|
+
|
|
130
|
+
// Native cold-start update check (NATIVE_CHECKUPDATE_DESIGN §10): runs once
|
|
131
|
+
// per process, a few seconds after launch, entirely independent of the app
|
|
132
|
+
// bundle — this is what lets a bricked hot update be replaced on the next
|
|
133
|
+
// launch. Decisions come from cpp/update_flow_core; this class is IO glue.
|
|
134
|
+
@interface RCTPushyOrchestrator : NSObject
|
|
135
|
+
+ (void)persistConfiguration:(NSString *)config;
|
|
136
|
+
+ (NSDictionary *)prepareBundle;
|
|
137
|
+
+ (NSDictionary *)prepareBundleWithin:(NSTimeInterval)timeout;
|
|
138
|
+
+ (void)scheduleFromColdStart:(NSString *)launchRolledBackVersion;
|
|
139
|
+
#if TARGET_OS_TV && !DEBUG
|
|
140
|
+
+ (BOOL)restorePurgedLaunch:(NSString *)purgedVersion
|
|
141
|
+
rolledBack:(NSString *)launchRolledBackVersion;
|
|
142
|
+
#endif
|
|
143
|
+
+ (void)recordJsRound:(NSString *)config;
|
|
144
|
+
@end
|