1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 12:11:39 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Compare commits

...

8 Commits

Author SHA1 Message Date
sunnylqm
a913e8c10e bump version to 10.29.8 and include new version data in downloading report 2025-08-25 17:18:59 +08:00
sunnylqm
c5f458291a update welcome message in App component and add overridePackageVersion option to ClientOptions 2025-08-22 16:39:33 +08:00
sunnylqm
9699632a43 remove deprecated endpoint from endpoints.json 2025-07-27 10:32:24 +08:00
sunnylqm
80e42f5dba bump version to 10.29.7 and add error handling for hdiffFileAtPath in RCTPushy 2025-07-21 20:57:16 +08:00
sunnylqm
9b718b8f75 support expo 53 2025-06-29 11:52:05 +08:00
sunnylqm
99e3431844 simplify subspec 2025-06-29 00:20:22 +08:00
sunnylqm
d7b5562ab7 improve iOS reload handling 2025-06-28 21:40:06 +08:00
sunnylqm
6a0a5b2d49 fix ios reload 2025-06-27 23:23:59 +08:00
13 changed files with 83 additions and 74 deletions

View File

@@ -4,15 +4,15 @@
"": {
"name": "testHotUpdate",
"dependencies": {
"form-data": "^4.0.2",
"form-data": "^4.0.3",
"patch-package": "^8.0.0",
"react": "19.0.0",
"react-native": "0.79.2",
"react-native-camera-kit": "^15.0.1",
"react-native-camera-kit": "^15.1.0",
"react-native-paper": "^5.14.5",
"react-native-safe-area-context": "^5.4.1",
"react-native-safe-area-context": "^5.5.0",
"react-native-svg": "^15.12.0",
"react-native-update": "^10.29.0",
"react-native-update": "^10.29.4",
"react-native-vector-icons": "^10.2.0",
},
"devDependencies": {
@@ -886,7 +886,7 @@
"for-each": ["for-each@0.3.5", "", { "dependencies": { "is-callable": "^1.2.7" } }, "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg=="],
"form-data": ["form-data@4.0.2", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "mime-types": "^2.1.12" } }, "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w=="],
"form-data": ["form-data@4.0.3", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.2", "mime-types": "^2.1.12" } }, "sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA=="],
"fresh": ["fresh@0.5.2", "", {}, "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="],
@@ -1412,15 +1412,15 @@
"react-native": ["react-native@0.79.2", "", { "dependencies": { "@jest/create-cache-key-function": "^29.7.0", "@react-native/assets-registry": "0.79.2", "@react-native/codegen": "0.79.2", "@react-native/community-cli-plugin": "0.79.2", "@react-native/gradle-plugin": "0.79.2", "@react-native/js-polyfills": "0.79.2", "@react-native/normalize-colors": "0.79.2", "@react-native/virtualized-lists": "0.79.2", "abort-controller": "^3.0.0", "anser": "^1.4.9", "ansi-regex": "^5.0.0", "babel-jest": "^29.7.0", "babel-plugin-syntax-hermes-parser": "0.25.1", "base64-js": "^1.5.1", "chalk": "^4.0.0", "commander": "^12.0.0", "event-target-shim": "^5.0.1", "flow-enums-runtime": "^0.0.6", "glob": "^7.1.1", "invariant": "^2.2.4", "jest-environment-node": "^29.7.0", "memoize-one": "^5.0.0", "metro-runtime": "^0.82.0", "metro-source-map": "^0.82.0", "nullthrows": "^1.1.1", "pretty-format": "^29.7.0", "promise": "^8.3.0", "react-devtools-core": "^6.1.1", "react-refresh": "^0.14.0", "regenerator-runtime": "^0.13.2", "scheduler": "0.25.0", "semver": "^7.1.3", "stacktrace-parser": "^0.1.10", "whatwg-fetch": "^3.0.0", "ws": "^6.2.3", "yargs": "^17.6.2" }, "peerDependencies": { "@types/react": "^19.0.0", "react": "^19.0.0" }, "optionalPeers": ["@types/react"], "bin": { "react-native": "cli.js" } }, "sha512-AnGzb56JvU5YCL7cAwg10+ewDquzvmgrMddiBM0GAWLwQM/6DJfGd2ZKrMuKKehHerpDDZgG+EY64gk3x3dEkw=="],
"react-native-camera-kit": ["react-native-camera-kit@15.0.1", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-JAa/2m73vKRp9oJ6ynYDr2KIIbglUbXYmDmsUrxLdk820eMGfxlb2HukqmVrkwt9KgX5vlBWoDHys3dhmrqa/w=="],
"react-native-camera-kit": ["react-native-camera-kit@15.1.0", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-4gPOJAoWAj9WaiNxPgKFYa/+M79O/Ggvc271SGgH5TmetmtinctJFm2zxeg+bAxVS9TDIYcF3ojRD98n88+VEw=="],
"react-native-paper": ["react-native-paper@5.14.5", "", { "dependencies": { "@callstack/react-theme-provider": "^3.0.9", "color": "^3.1.2", "use-latest-callback": "^0.2.3" }, "peerDependencies": { "react": "*", "react-native": "*", "react-native-safe-area-context": "*" } }, "sha512-eaIH5bUQjJ/mYm4AkI6caaiyc7BcHDwX6CqNDi6RIxfxfWxROsHpll1oBuwn/cFvknvA8uEAkqLk/vzVihI3AQ=="],
"react-native-safe-area-context": ["react-native-safe-area-context@5.4.1", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-x+g3NblZ9jof8y+XkVvaGlpMrSlixhrJJ33BRzhTAKUKctQVecO1heSXmzxc5UdjvGYBKS6kPZVUw2b8NxHcPg=="],
"react-native-safe-area-context": ["react-native-safe-area-context@5.5.0", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-BQcSvVEJj3T4zBQH9YrnlfcLGHiVOsmeiE10PSBsmI/xyzULSZdJISFOH0HLcLU7/nePC+HsaaVzIsEa1CVBYw=="],
"react-native-svg": ["react-native-svg@15.12.0", "", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-iE25PxIJ6V0C6krReLquVw6R0QTsRTmEQc4K2Co3P6zsimU/jltcDBKYDy1h/5j9S/fqmMeXnpM+9LEWKJKI6A=="],
"react-native-update": ["react-native-update@10.29.0", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-TFGwJxI62OHPJimxMnI8PDvUBhZio1alsgIvXHYh1oYAZYYejkUvwl+Ojdbm58IKoZzxAaT7RvD1qGdvlg/oKg=="],
"react-native-update": ["react-native-update@10.29.4", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-leQX3dq4yBi/oFn0l06nXd7OOFnZnlcMIrAXH7vgTRsqXCdYLoSsZXXkcSYxncn8tBqzh02w4880mlqouve6Sg=="],
"react-native-url-polyfill": ["react-native-url-polyfill@2.0.0", "", { "dependencies": { "whatwg-url-without-unicode": "8.0.0-3" }, "peerDependencies": { "react-native": "*" } }, "sha512-My330Do7/DvKnEvwQc0WdcBnFPploYKp9CYlefDXzIdEaA+PAhDYllkvGeEroEzvc4Kzzj2O4yVdz8v6fjRvhA=="],

View File

@@ -2,12 +2,14 @@
#import "RCTPushy.h"
#import <React/RCTBundleURLProvider.h>
#import <ReactAppDependencyProvider/RCTAppDependencyProvider.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.moduleName = @"AwesomeProject";
self.dependencyProvider = [RCTAppDependencyProvider new];
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};

View File

@@ -1332,7 +1332,7 @@ PODS:
- React-jsiexecutor
- React-RCTFBReactNativeSpec
- ReactCommon/turbomodule/core
- react-native-safe-area-context (5.4.1):
- react-native-safe-area-context (5.5.0):
- DoubleConversion
- glog
- hermes-engine
@@ -1347,8 +1347,8 @@ PODS:
- React-hermes
- React-ImageManager
- React-jsi
- react-native-safe-area-context/common (= 5.4.1)
- react-native-safe-area-context/fabric (= 5.4.1)
- react-native-safe-area-context/common (= 5.5.0)
- react-native-safe-area-context/fabric (= 5.5.0)
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
@@ -1358,7 +1358,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-safe-area-context/common (5.4.1):
- react-native-safe-area-context/common (5.5.0):
- DoubleConversion
- glog
- hermes-engine
@@ -1382,7 +1382,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-safe-area-context/fabric (5.4.1):
- react-native-safe-area-context/fabric (5.5.0):
- DoubleConversion
- glog
- hermes-engine
@@ -1407,7 +1407,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-update (10.28.11):
- react-native-update (10.29.4):
- DoubleConversion
- glog
- hermes-engine
@@ -1423,8 +1423,8 @@ PODS:
- React-hermes
- React-ImageManager
- React-jsi
- react-native-update/HDiffPatch (= 10.28.11)
- react-native-update/RCTPushy (= 10.28.11)
- react-native-update/HDiffPatch (= 10.29.4)
- react-native-update/RCTPushy (= 10.29.4)
- React-NativeModulesApple
- React-RCTFabric
- React-renderercss
@@ -1435,7 +1435,7 @@ PODS:
- ReactCommon/turbomodule/core
- SSZipArchive
- Yoga
- react-native-update/HDiffPatch (10.28.11):
- react-native-update/HDiffPatch (10.29.4):
- DoubleConversion
- glog
- hermes-engine
@@ -1461,7 +1461,7 @@ PODS:
- ReactCommon/turbomodule/core
- SSZipArchive
- Yoga
- react-native-update/RCTPushy (10.28.11):
- react-native-update/RCTPushy (10.29.4):
- DoubleConversion
- glog
- hermes-engine
@@ -1809,7 +1809,7 @@ PODS:
- React-logger (= 0.79.2)
- React-perflogger (= 0.79.2)
- React-utils (= 0.79.2)
- ReactNativeCameraKit (15.0.1):
- ReactNativeCameraKit (15.1.0):
- DoubleConversion
- glog
- hermes-engine
@@ -2186,8 +2186,8 @@ SPEC CHECKSUMS:
React-logger: 8edfcedc100544791cd82692ca5a574240a16219
React-Mapbuffer: c3f4b608e4a59dd2f6a416ef4d47a14400194468
React-microtasksnativemodule: 054f34e9b82f02bd40f09cebd4083828b5b2beb6
react-native-safe-area-context: 5594ec631ede9c311c5c0efa244228eff845ce88
react-native-update: b4a6653129ac98d9cf5295d40b43ffb927114237
react-native-safe-area-context: 11d29ae675265669f498d7d9de2341087e8fe162
react-native-update: 6d3a3eb322cbc382ad78853cb52e44e8c93e8072
React-NativeModulesApple: 2c4377e139522c3d73f5df582e4f051a838ff25e
React-oscompat: ef5df1c734f19b8003e149317d041b8ce1f7d29c
React-perflogger: 9a151e0b4c933c9205fd648c246506a83f31395d
@@ -2219,7 +2219,7 @@ SPEC CHECKSUMS:
ReactAppDependencyProvider: 04d5eb15eb46be6720e17a4a7fa92940a776e584
ReactCodegen: c63eda03ba1d94353fb97b031fc84f75a0d125ba
ReactCommon: 76d2dc87136d0a667678668b86f0fca0c16fdeb0
ReactNativeCameraKit: caf4175d93930ac5267fb98c462f5f1b8d543830
ReactNativeCameraKit: e542035174335357fd7d747089f0e09a4ed27365
RNSVG: 8a1054afe490b5d63b9792d7ae3c1fde8c05cdd0
RNVectorIcons: 941a39b5d3b9d8cf8ac2e2fc09b07bfafbcf9796
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748

View File

@@ -14,15 +14,15 @@
"dev:harmony": "react-native bundle-harmony --dev"
},
"dependencies": {
"form-data": "^4.0.2",
"form-data": "^4.0.3",
"patch-package": "^8.0.0",
"react": "19.0.0",
"react-native": "0.79.2",
"react-native-camera-kit": "^15.0.1",
"react-native-camera-kit": "^15.1.0",
"react-native-paper": "^5.14.5",
"react-native-safe-area-context": "^5.4.1",
"react-native-safe-area-context": "^5.5.0",
"react-native-svg": "^15.12.0",
"react-native-update": "^10.29.0",
"react-native-update": "^10.29.4",
"react-native-vector-icons": "^10.2.0"
},
"devDependencies": {

View File

@@ -52,7 +52,7 @@ function App() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>使Pushy热更新服务</Text>
<Text style={styles.welcome}>xxx使用Pushy热更新服务</Text>
<View style={{flexDirection: 'row'}}>
<Text>
{useDefaultAlert ? '当前使用' : '当前不使用'}alert更新提示

View File

@@ -1,7 +1,7 @@
{
"ios": {
"appId": 24794,
"appKey": "SqShg4Klnj2hG6LAFMW2PdcgSSuniz0T"
"appId": 28943,
"appKey": "d-OmPxIBivPrDfKhLHjxN-HS"
},
"android": {
"appId": 27509,

View File

@@ -1 +1 @@
["https://pushy-koa-qgbgqmcpis.cn-beijing.fcapp.run", "https://p.reactnative.cn/api"]
["https://p.reactnative.cn/api"]

2
ios/ImportReact.h Normal file
View File

@@ -0,0 +1,2 @@
@import React;

View File

@@ -93,8 +93,7 @@ RCT_EXPORT_MODULE(RCTPushy);
BOOL needRollback = (!ignoreRollback && isFirstTime == NO && isFirstLoadOK == NO) || loadVersion.length<=0;
if (needRollback) {
loadVersion = [self rollback];
}
else if (isFirstTime && !ignoreRollback){
} else if (isFirstTime && !ignoreRollback){
// bundleURL may be called many times, ignore rollbacks before process restarted again.
ignoreRollback = true;
@@ -302,34 +301,34 @@ RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options
resolve(@true);
}else{
} else {
reject(@"执行报错", nil, nil);
}
}
RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
rejecter:(RCTPromiseRejectBlock)reject)
{
@try {
NSString *hash = options[@"hash"];
if (hash.length) {
[self setNeedUpdate:options resolver:resolve rejecter:reject];
// reload in earlier version
dispatch_async(dispatch_get_main_queue(), ^{
[self.bridge setValue:[[self class] bundleURL] forKey:@"bundleURL"];
[self.bridge reload];
});
#if __has_include("RCTReloadCommand.h")
// reload 0.62+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
RCTTriggerReloadCommandListeners(@"pushy reload");
#endif
resolve(@true);
}else{
// 只在 setNeedUpdate 成功后 resolve
[self setNeedUpdate:options resolver:^(id result) {
dispatch_async(dispatch_get_main_queue(), ^{
#if __has_include("RCTReloadCommand.h")
// reload 0.62+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
RCTTriggerReloadCommandListeners(@"pushy reloadUpdate");
#else
[self.bridge reload];
#endif
});
resolve(@true);
} rejecter:^(NSString *code, NSString *message, NSError *error) {
reject(code, message, error);
}];
} else {
reject(@"执行报错", nil, nil);
}
}
@@ -343,13 +342,14 @@ RCT_EXPORT_METHOD(restartApp:(RCTPromiseResolveBlock)resolve
{
@try {
dispatch_async(dispatch_get_main_queue(), ^{
[self.bridge reload];
#if __has_include("RCTReloadCommand.h")
// reload 0.62+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
RCTTriggerReloadCommandListeners(@"pushy restartApp");
#else
[self.bridge reload];
#endif
});
#if __has_include("RCTReloadCommand.h")
// reload 0.62+
RCTReloadCommandSetBundleURL([[self class] bundleURL]);
RCTTriggerReloadCommandListeners(@"pushy restartApp");
#endif
resolve(@true);
}
@@ -542,7 +542,15 @@ RCT_EXPORT_METHOD(markSuccess:(RCTPromiseResolveBlock)resolve
callback([self errorWithMessage:ERROR_HDIFFPATCH]);
}
};
[_fileManager hdiffFileAtPath:bundlePatch fromOrigin:bundleOrigin toDestination:destination completionHandler:completionHandler];
@try {
[_fileManager hdiffFileAtPath:bundlePatch fromOrigin:bundleOrigin toDestination:destination completionHandler:completionHandler];
}
@catch (NSException *exception) {
NSLog(@"Pushy _dopatch error: exception occurred during hdiffFileAtPath: %@, reason: %@",
exception.name, exception.reason);
callback([self errorWithMessage:ERROR_HDIFFPATCH]);
}
}
- (void)patch:(NSString *)hash fromBundle:(NSString *)bundleOrigin source:(NSString *)sourceOrigin callback:(void (^)(NSError *error))callback

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "10.29.4",
"version": "10.29.8",
"description": "react-native hot update",
"main": "src/index",
"scripts": {

View File

@@ -90,13 +90,6 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/reactnativecn/react-native-update.git', :tag => '#{s.version}' }
# Conditionally set source files
if valid_expo_project
s.source_files = Dir.glob("ios/**/*.{h,m,mm,swift}") # Include Expo files
else
s.source_files = Dir.glob("ios/**/*.{h,m,mm,swift}").reject { |f| f.start_with?("ios/Expo/") } # Exclude Expo files
end
s.libraries = 'bz2', 'z'
s.vendored_libraries = 'RCTPushy/libRCTPushy.a'
s.pod_target_xcconfig = {
@@ -112,22 +105,18 @@ Pod::Spec.new do |s|
# Conditionally add Expo dependency
if valid_expo_project
s.public_header_files = ['ios/ImportReact.h']
s.dependency 'ExpoModulesCore'
end
s.subspec 'RCTPushy' do |ss|
ss.source_files = 'ios/RCTPushy/*.{h,m,mm,swift}'
ss.public_header_files = ['ios/RCTPushy/*.h']
end
s.subspec 'HDiffPatch' do |ss|
ss.source_files = ['ios/RCTPushy/HDiffPatch/**/*.{h,m,c}',
ss.source_files = ['ios/RCTPushy/**/*.{h,m,mm,c}',
'android/jni/hpatch.{h,c}',
'android/jni/HDiffPatch/libHDiffPatch/HPatch/*.{h,c}',
'android/jni/HDiffPatch/file_for_patch.{h,c}',
'android/jni/lzma/C/LzmaDec.{h,c}',
'android/jni/lzma/C/Lzma2Dec.{h,c}']
ss.public_header_files = 'ios/RCTPushy/HDiffPatch/**/*.h'
ss.public_header_files = ['ios/RCTPushy/**/*.h']
end
# Conditionally add Expo subspec and check ExpoModulesCore version

View File

@@ -148,6 +148,7 @@ export class Pushy {
await this.loggerPromise.promise;
const { logger = noop, appKey } = this.options;
const info = await getCurrentVersionInfo();
const overridePackageVersion = this.options.overridePackageVersion;
logger({
type,
data: {
@@ -155,6 +156,7 @@ export class Pushy {
currentVersion,
cInfo,
packageVersion,
overridePackageVersion,
buildTime,
message,
...info,
@@ -233,7 +235,7 @@ export class Pushy {
}
this.lastChecking = now;
const fetchBody = {
packageVersion,
packageVersion: this.options.overridePackageVersion || packageVersion,
hash: currentVersion,
buildTime,
cInfo,
@@ -391,7 +393,12 @@ export class Pushy {
}
}
let succeeded = '';
this.report({ type: 'downloading' });
this.report({
type: 'downloading',
data: {
newVersion: hash,
},
});
let lastError: any;
let errorMessages: string[] = [];
const diffUrl = await testUrls(joinUrls(paths, diff));

View File

@@ -93,6 +93,7 @@ export interface ClientOptions {
beforeDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
afterDownloadUpdate?: (info: CheckResult) => Promise<boolean>;
onPackageExpired?: (info: CheckResult) => Promise<boolean>;
overridePackageVersion?: string;
}
export interface UpdateTestPayload {