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

Compare commits

..

16 Commits

Author SHA1 Message Date
sunnylqm
f7309f699f update version to 10.30.0, enhance version and build time tracking in UpdateContext and RCTPushy, and add new entry to .gitignore 2025-08-28 18:45:00 +08:00
sunnylqm
a224113998 bump version to 10.29.9 2025-08-28 14:35:18 +08:00
sunnylqm
f2ede92ea1 add debug resolution for markSuccess method in RCTPushy 2025-08-28 14:33:36 +08:00
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
Sunny Luo
7023ff57ca bump 10.29.4 2025-06-25 15:23:08 +08:00
波仔糕
17e21d79cf fix harmony image assets load fail issue (#505)
* modify harmony download logic to async

* fix harmony image assets load fail issue
2025-06-25 15:22:47 +08:00
Sunny Luo
1cab582bd0 Update package.json 2025-06-17 22:29:46 +08:00
波仔糕
7da5a165fd modify harmony download logic to async (#502) 2025-06-17 22:29:28 +08:00
sunnylqm
d5194a1ad1 bump version to 10.29.2 and add delayed execution for clearing first-time and rollback marks in UpdateModule 2025-06-16 12:00:19 +08:00
19 changed files with 139 additions and 98 deletions

1
.gitignore vendored
View File

@@ -51,3 +51,4 @@ android/bin
Example/testHotUpdate/harmony Example/testHotUpdate/harmony
Example/testHotUpdate/android/app/.cxx Example/testHotUpdate/android/app/.cxx
Example/harmony_use_pushy/libs Example/harmony_use_pushy/libs
.cursor/mcp.json

View File

@@ -4,15 +4,15 @@
"": { "": {
"name": "testHotUpdate", "name": "testHotUpdate",
"dependencies": { "dependencies": {
"form-data": "^4.0.2", "form-data": "^4.0.3",
"patch-package": "^8.0.0", "patch-package": "^8.0.0",
"react": "19.0.0", "react": "19.0.0",
"react-native": "0.79.2", "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-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-svg": "^15.12.0",
"react-native-update": "^10.29.0", "react-native-update": "^10.29.4",
"react-native-vector-icons": "^10.2.0", "react-native-vector-icons": "^10.2.0",
}, },
"devDependencies": { "devDependencies": {
@@ -886,7 +886,7 @@
"for-each": ["for-each@0.3.5", "", { "dependencies": { "is-callable": "^1.2.7" } }, "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg=="], "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=="], "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": ["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-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-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=="], "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 "RCTPushy.h"
#import <React/RCTBundleURLProvider.h> #import <React/RCTBundleURLProvider.h>
#import <ReactAppDependencyProvider/RCTAppDependencyProvider.h>
@implementation AppDelegate @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ {
self.moduleName = @"AwesomeProject"; self.moduleName = @"AwesomeProject";
self.dependencyProvider = [RCTAppDependencyProvider new];
// You can add your custom initial props in the dictionary below. // You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native. // They will be passed down to the ViewController used by React Native.
self.initialProps = @{}; self.initialProps = @{};

View File

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

View File

@@ -14,15 +14,15 @@
"dev:harmony": "react-native bundle-harmony --dev" "dev:harmony": "react-native bundle-harmony --dev"
}, },
"dependencies": { "dependencies": {
"form-data": "^4.0.2", "form-data": "^4.0.3",
"patch-package": "^8.0.0", "patch-package": "^8.0.0",
"react": "19.0.0", "react": "19.0.0",
"react-native": "0.79.2", "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-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-svg": "^15.12.0",
"react-native-update": "^10.29.0", "react-native-update": "^10.29.4",
"react-native-vector-icons": "^10.2.0" "react-native-vector-icons": "^10.2.0"
}, },
"devDependencies": { "devDependencies": {

View File

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

View File

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

View File

@@ -36,10 +36,18 @@ public class UpdateContext {
this.sp = context.getSharedPreferences("update", Context.MODE_PRIVATE); this.sp = context.getSharedPreferences("update", Context.MODE_PRIVATE);
String packageVersion = getPackageVersion(); String packageVersion = getPackageVersion();
if (!packageVersion.equals(this.sp.getString("packageVersion", null))) { String buildTime = getBuildTime();
String storedPackageVersion = this.sp.getString("packageVersion", null);
String storedBuildTime = this.sp.getString("buildTime", null);
boolean packageVersionChanged = !packageVersion.equals(storedPackageVersion);
boolean buildTimeChanged = !buildTime.equals(storedBuildTime);
if (packageVersionChanged || buildTimeChanged) {
SharedPreferences.Editor editor = sp.edit(); SharedPreferences.Editor editor = sp.edit();
editor.clear(); editor.clear();
editor.putString("packageVersion", packageVersion); editor.putString("packageVersion", packageVersion);
editor.putString("buildTime", buildTime);
editor.apply(); editor.apply();
this.cleanUp(); this.cleanUp();

View File

@@ -4,6 +4,8 @@ import static androidx.core.content.FileProvider.getUriForFile;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReactContext;
@@ -17,6 +19,7 @@ import java.util.Map;
public class UpdateModule extends NativePushySpec { public class UpdateModule extends NativePushySpec {
UpdateContext updateContext; UpdateContext updateContext;
public static ReactApplicationContext mContext; public static ReactApplicationContext mContext;
private final Handler handler = new Handler(Looper.getMainLooper());
public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) { public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
super(reactContext); super(reactContext);
this.updateContext = updateContext; this.updateContext = updateContext;
@@ -38,12 +41,22 @@ public class UpdateModule extends NativePushySpec {
boolean isFirstTime = updateContext.isFirstTime(); boolean isFirstTime = updateContext.isFirstTime();
constants.put("isFirstTime", isFirstTime); constants.put("isFirstTime", isFirstTime);
if (isFirstTime) { if (isFirstTime) {
updateContext.clearFirstTime(); handler.postDelayed(new Runnable() {
@Override
public void run() {
updateContext.clearFirstTime();
}
}, 2000);
} }
String rolledBackVersion = updateContext.rolledBackVersion(); String rolledBackVersion = updateContext.rolledBackVersion();
constants.put("rolledBackVersion", rolledBackVersion); constants.put("rolledBackVersion", rolledBackVersion);
if (rolledBackVersion != null) { if (rolledBackVersion != null) {
updateContext.clearRollbackMark(); handler.postDelayed(new Runnable() {
@Override
public void run() {
updateContext.clearRollbackMark();
}
}, 2000);
} }
constants.put("uuid", updateContext.getKv("uuid")); constants.put("uuid", updateContext.getKv("uuid"));
return constants; return constants;

View File

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

Binary file not shown.

View File

@@ -73,7 +73,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPpk(
const jsi::Value* args, const jsi::Value* args,
size_t count) size_t count)
{ {
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt,"downloadPatchFromPpk", args, count)); return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt,"downloadPatchFromPpk", args, count));
} }
static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPackage( static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPackage(
@@ -82,7 +82,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadPatchFromPackage(
const jsi::Value* args, const jsi::Value* args,
size_t count) size_t count)
{ {
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt,"downloadPatchFromPackage", args, count)); return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt,"downloadPatchFromPackage", args, count));
} }
static jsi::Value _hostFunction_PushyTurboModule_downloadFullUpdate( static jsi::Value _hostFunction_PushyTurboModule_downloadFullUpdate(
@@ -91,7 +91,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadFullUpdate(
const jsi::Value* args, const jsi::Value* args,
size_t count) size_t count)
{ {
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt,"downloadFullUpdate", args, count)); return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt,"downloadFullUpdate", args, count));
} }
static jsi::Value _hostFunction_PushyTurboModule_downloadAndInstallApk( static jsi::Value _hostFunction_PushyTurboModule_downloadAndInstallApk(
@@ -100,7 +100,7 @@ static jsi::Value _hostFunction_PushyTurboModule_downloadAndInstallApk(
const jsi::Value* args, const jsi::Value* args,
size_t count) size_t count)
{ {
return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).call(rt,"downloadAndInstallApk", args, count)); return jsi::Value(static_cast<ArkTSTurboModule &> (turboModule).callAsync(rt,"downloadAndInstallApk", args, count));
} }

View File

@@ -12,7 +12,7 @@ export class PushyFileJSBundleProvider extends JSBundleProvider {
this.updateContext = new UpdateContext(context); this.updateContext = new UpdateContext(context);
} }
getURL(): string { getURL(): string {
return this.updateContext.getBundleUrl(); return this.updateContext.getBundleUrl().substring(1);
} }
async getBundle(): Promise<ArrayBuffer> { async getBundle(): Promise<ArrayBuffer> {

2
ios/ImportReact.h Normal file
View File

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

View File

@@ -16,6 +16,7 @@
static NSString *const keyPushyInfo = @"REACTNATIVECN_PUSHY_INFO_KEY"; static NSString *const keyPushyInfo = @"REACTNATIVECN_PUSHY_INFO_KEY";
static NSString *const paramPackageVersion = @"packageVersion"; static NSString *const paramPackageVersion = @"packageVersion";
static NSString *const paramBuildTime = @"buildTime";
static NSString *const paramLastVersion = @"lastVersion"; static NSString *const paramLastVersion = @"lastVersion";
static NSString *const paramCurrentVersion = @"currentVersion"; static NSString *const paramCurrentVersion = @"currentVersion";
static NSString *const paramIsFirstTime = @"isFirstTime"; static NSString *const paramIsFirstTime = @"isFirstTime";
@@ -70,20 +71,28 @@ RCT_EXPORT_MODULE(RCTPushy);
{ {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// Check for version changes first
NSString *curPackageVersion = [RCTPushy packageVersion];
NSString *curBuildTime = [RCTPushy buildTime];
NSString *storedPackageVersion = [defaults stringForKey:paramPackageVersion];
NSString *storedBuildTime = [defaults stringForKey:paramBuildTime];
BOOL packageVersionChanged = ![curPackageVersion isEqualToString:storedPackageVersion];
BOOL buildTimeChanged = ![curBuildTime isEqualToString:storedBuildTime];
if (packageVersionChanged || buildTimeChanged) {
// Clear all update data and store new versions
[defaults setObject:nil forKey:keyPushyInfo];
[defaults setObject:nil forKey:keyHashInfo];
[defaults setObject:@(YES) forKey:KeyPackageUpdatedMarked];
[defaults setObject:curPackageVersion forKey:paramPackageVersion];
[defaults setObject:curBuildTime forKey:paramBuildTime];
// ...need clear files later
}
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo]; NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
if (pushyInfo) { if (pushyInfo) {
NSString *curPackageVersion = [RCTPushy packageVersion];
NSString *packageVersion = [pushyInfo objectForKey:paramPackageVersion];
BOOL needClearPushyInfo = ![curPackageVersion isEqualToString:packageVersion];
if (needClearPushyInfo) {
[defaults setObject:nil forKey:keyPushyInfo];
[defaults setObject:nil forKey:keyHashInfo];
[defaults setObject:@(YES) forKey:KeyPackageUpdatedMarked];
// ...need clear files later
}
else {
NSString *curVersion = pushyInfo[paramCurrentVersion]; NSString *curVersion = pushyInfo[paramCurrentVersion];
BOOL isFirstTime = [pushyInfo[paramIsFirstTime] boolValue]; BOOL isFirstTime = [pushyInfo[paramIsFirstTime] boolValue];
@@ -93,8 +102,7 @@ RCT_EXPORT_MODULE(RCTPushy);
BOOL needRollback = (!ignoreRollback && isFirstTime == NO && isFirstLoadOK == NO) || loadVersion.length<=0; BOOL needRollback = (!ignoreRollback && isFirstTime == NO && isFirstLoadOK == NO) || loadVersion.length<=0;
if (needRollback) { if (needRollback) {
loadVersion = [self rollback]; loadVersion = [self rollback];
} } else if (isFirstTime && !ignoreRollback){
else if (isFirstTime && !ignoreRollback){
// bundleURL may be called many times, ignore rollbacks before process restarted again. // bundleURL may be called many times, ignore rollbacks before process restarted again.
ignoreRollback = true; ignoreRollback = true;
@@ -128,13 +136,11 @@ RCT_EXPORT_MODULE(RCTPushy);
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo]; NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
NSString *lastVersion = pushyInfo[paramLastVersion]; NSString *lastVersion = pushyInfo[paramLastVersion];
NSString *curVersion = pushyInfo[paramCurrentVersion]; NSString *curVersion = pushyInfo[paramCurrentVersion];
NSString *curPackageVersion = [RCTPushy packageVersion];
if (lastVersion.length) { if (lastVersion.length) {
// roll back to last version // roll back to last version
[defaults setObject:@{paramCurrentVersion:lastVersion, [defaults setObject:@{paramCurrentVersion:lastVersion,
paramIsFirstTime:@(NO), paramIsFirstTime:@(NO),
paramIsFirstLoadOk:@(YES), paramIsFirstLoadOk:@(YES)}
paramPackageVersion:curPackageVersion}
forKey:keyPushyInfo]; forKey:keyPushyInfo];
} }
else { else {
@@ -297,39 +303,38 @@ RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options
newInfo[paramLastVersion] = lastVersion; newInfo[paramLastVersion] = lastVersion;
newInfo[paramIsFirstTime] = @(YES); newInfo[paramIsFirstTime] = @(YES);
newInfo[paramIsFirstLoadOk] = @(NO); newInfo[paramIsFirstLoadOk] = @(NO);
newInfo[paramPackageVersion] = [RCTPushy packageVersion];
[defaults setObject:newInfo forKey:keyPushyInfo]; [defaults setObject:newInfo forKey:keyPushyInfo];
resolve(@true); resolve(@true);
}else{ } else {
reject(@"执行报错", nil, nil); reject(@"执行报错", nil, nil);
} }
} }
RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options
resolver:(RCTPromiseResolveBlock)resolve resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) rejecter:(RCTPromiseRejectBlock)reject)
{ {
@try { @try {
NSString *hash = options[@"hash"]; NSString *hash = options[@"hash"];
if (hash.length) { if (hash.length) {
[self setNeedUpdate:options resolver:resolve rejecter:reject]; // 只在 setNeedUpdate 成功后 resolve
[self setNeedUpdate:options resolver:^(id result) {
// reload in earlier version dispatch_async(dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_main_queue(), ^{ #if __has_include("RCTReloadCommand.h")
[self.bridge setValue:[[self class] bundleURL] forKey:@"bundleURL"]; // reload 0.62+
[self.bridge reload]; RCTReloadCommandSetBundleURL([[self class] bundleURL]);
}); RCTTriggerReloadCommandListeners(@"pushy reloadUpdate");
#else
#if __has_include("RCTReloadCommand.h") [self.bridge reload];
// reload 0.62+ #endif
RCTReloadCommandSetBundleURL([[self class] bundleURL]); });
RCTTriggerReloadCommandListeners(@"pushy reload"); resolve(@true);
#endif } rejecter:^(NSString *code, NSString *message, NSError *error) {
reject(code, message, error);
resolve(@true); }];
}else{ } else {
reject(@"执行报错", nil, nil); reject(@"执行报错", nil, nil);
} }
} }
@@ -343,13 +348,14 @@ RCT_EXPORT_METHOD(restartApp:(RCTPromiseResolveBlock)resolve
{ {
@try { @try {
dispatch_async(dispatch_get_main_queue(), ^{ 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); resolve(@true);
} }
@@ -361,6 +367,9 @@ RCT_EXPORT_METHOD(restartApp:(RCTPromiseResolveBlock)resolve
RCT_EXPORT_METHOD(markSuccess:(RCTPromiseResolveBlock)resolve RCT_EXPORT_METHOD(markSuccess:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) rejecter:(RCTPromiseRejectBlock)reject)
{ {
#if DEBUG
resolve(@true);
#else
@try { @try {
// up package info // up package info
@@ -384,6 +393,7 @@ RCT_EXPORT_METHOD(markSuccess:(RCTPromiseResolveBlock)resolve
@catch (NSException *exception) { @catch (NSException *exception) {
reject(@"执行报错", nil, nil); reject(@"执行报错", nil, nil);
} }
#endif
} }
@@ -542,7 +552,15 @@ RCT_EXPORT_METHOD(markSuccess:(RCTPromiseResolveBlock)resolve
callback([self errorWithMessage:ERROR_HDIFFPATCH]); 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 - (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", "name": "react-native-update",
"version": "10.29.1", "version": "10.30.0",
"description": "react-native hot update", "description": "react-native hot update",
"main": "src/index", "main": "src/index",
"scripts": { "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}' } 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.libraries = 'bz2', 'z'
s.vendored_libraries = 'RCTPushy/libRCTPushy.a' s.vendored_libraries = 'RCTPushy/libRCTPushy.a'
s.pod_target_xcconfig = { s.pod_target_xcconfig = {
@@ -112,22 +105,18 @@ Pod::Spec.new do |s|
# Conditionally add Expo dependency # Conditionally add Expo dependency
if valid_expo_project if valid_expo_project
s.public_header_files = ['ios/ImportReact.h']
s.dependency 'ExpoModulesCore' s.dependency 'ExpoModulesCore'
end end
s.subspec 'RCTPushy' do |ss| s.subspec 'RCTPushy' do |ss|
ss.source_files = 'ios/RCTPushy/*.{h,m,mm,swift}' ss.source_files = ['ios/RCTPushy/**/*.{h,m,mm,c}',
ss.public_header_files = ['ios/RCTPushy/*.h']
end
s.subspec 'HDiffPatch' do |ss|
ss.source_files = ['ios/RCTPushy/HDiffPatch/**/*.{h,m,c}',
'android/jni/hpatch.{h,c}', 'android/jni/hpatch.{h,c}',
'android/jni/HDiffPatch/libHDiffPatch/HPatch/*.{h,c}', 'android/jni/HDiffPatch/libHDiffPatch/HPatch/*.{h,c}',
'android/jni/HDiffPatch/file_for_patch.{h,c}', 'android/jni/HDiffPatch/file_for_patch.{h,c}',
'android/jni/lzma/C/LzmaDec.{h,c}', 'android/jni/lzma/C/LzmaDec.{h,c}',
'android/jni/lzma/C/Lzma2Dec.{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 end
# Conditionally add Expo subspec and check ExpoModulesCore version # Conditionally add Expo subspec and check ExpoModulesCore version

View File

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

View File

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