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

Compare commits

..

21 Commits

Author SHA1 Message Date
sunnylqm
49e585a561 v5.11.0-beta2 2021-03-26 18:12:52 +08:00
sunnylqm
0e89b270cc Check download listener 2021-03-26 18:12:25 +08:00
sunnylqm
7c8e75587b v5.11.0-beta1 2021-01-20 23:38:42 +08:00
sunnylqm
84fee71df6 Fix cleanup target dir 2021-01-20 23:38:21 +08:00
sunnylqm
db548d03dd v5.11.0-beta0 2021-01-20 23:15:05 +08:00
sunnylqm
fc82addd75 Check diff and patch existence 2021-01-20 23:05:35 +08:00
sunnylqm
90e7c00cf6 Clean up files if task failed 2021-01-20 18:34:58 +08:00
sunnylqm
eea7ff26f2 v5.10.0 2020-12-18 11:17:07 +08:00
sunnylqm
684dc8267d Back compatibility 2020-12-18 11:16:49 +08:00
sunnylqm
5786bf8132 v5.10.0-beta0 2020-12-17 00:15:48 +08:00
sunnylqm
1bd5fbbc94 Refactor ios rollback 2020-12-17 00:12:30 +08:00
sunnylqm
cd2eb9417a Update gitignore 2020-11-03 16:17:24 +08:00
sunnylqm
7d8730f590 v5.9.3 2020-11-03 16:17:03 +08:00
sunnylqm
e3081a02db Rename file_paths.xml to avoid overwrite 2020-11-03 15:52:59 +08:00
sunnylqm
ec8c475c54 Add webview test 2020-10-21 15:51:51 +08:00
sunnylqm
ac18785e50 Add webview 2020-10-21 08:26:55 +08:00
sunnylqm
e80317415c Upgrade 0.63.3 2020-10-21 08:12:52 +08:00
sunnylqm
f5c307deca v5.9.1 2020-10-06 23:41:08 +08:00
sunnylqm
b4feae292d Fix index.d.ts 2020-10-06 23:40:51 +08:00
sunnylqm
a1c2679427 v5.9.0 2020-09-27 22:32:30 +08:00
sunnylqm
17ff366f51 Implement download and install apk 2020-09-27 22:16:27 +08:00
19 changed files with 620 additions and 299 deletions

1
.gitignore vendored
View File

@@ -42,3 +42,4 @@ node_modules/
npm-debug.log
Example/**/update.json
yarn-error.log

View File

@@ -156,6 +156,7 @@ android {
signingConfig signingConfigs.debug
}
release {
crunchPngs false
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug

View File

@@ -3,14 +3,14 @@ PODS:
- CocoaAsyncSocket (7.6.4)
- CocoaLibEvent (1.0.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.63.2)
- FBReactNativeSpec (0.63.2):
- FBLazyVector (0.63.3)
- FBReactNativeSpec (0.63.3):
- Folly (= 2020.01.13.00)
- RCTRequired (= 0.63.2)
- RCTTypeSafety (= 0.63.2)
- React-Core (= 0.63.2)
- React-jsi (= 0.63.2)
- ReactCommon/turbomodule/core (= 0.63.2)
- RCTRequired (= 0.63.3)
- RCTTypeSafety (= 0.63.3)
- React-Core (= 0.63.3)
- React-jsi (= 0.63.3)
- ReactCommon/turbomodule/core (= 0.63.3)
- Flipper (0.54.0):
- Flipper-Folly (~> 2.2)
- Flipper-RSocket (~> 1.1)
@@ -70,243 +70,245 @@ PODS:
- OpenSSL-Universal (1.0.2.19):
- OpenSSL-Universal/Static (= 1.0.2.19)
- OpenSSL-Universal/Static (1.0.2.19)
- RCTRequired (0.63.2)
- RCTTypeSafety (0.63.2):
- FBLazyVector (= 0.63.2)
- RCTRequired (0.63.3)
- RCTTypeSafety (0.63.3):
- FBLazyVector (= 0.63.3)
- Folly (= 2020.01.13.00)
- RCTRequired (= 0.63.2)
- React-Core (= 0.63.2)
- React (0.63.2):
- React-Core (= 0.63.2)
- React-Core/DevSupport (= 0.63.2)
- React-Core/RCTWebSocket (= 0.63.2)
- React-RCTActionSheet (= 0.63.2)
- React-RCTAnimation (= 0.63.2)
- React-RCTBlob (= 0.63.2)
- React-RCTImage (= 0.63.2)
- React-RCTLinking (= 0.63.2)
- React-RCTNetwork (= 0.63.2)
- React-RCTSettings (= 0.63.2)
- React-RCTText (= 0.63.2)
- React-RCTVibration (= 0.63.2)
- React-callinvoker (0.63.2)
- React-Core (0.63.2):
- RCTRequired (= 0.63.3)
- React-Core (= 0.63.3)
- React (0.63.3):
- React-Core (= 0.63.3)
- React-Core/DevSupport (= 0.63.3)
- React-Core/RCTWebSocket (= 0.63.3)
- React-RCTActionSheet (= 0.63.3)
- React-RCTAnimation (= 0.63.3)
- React-RCTBlob (= 0.63.3)
- React-RCTImage (= 0.63.3)
- React-RCTLinking (= 0.63.3)
- React-RCTNetwork (= 0.63.3)
- React-RCTSettings (= 0.63.3)
- React-RCTText (= 0.63.3)
- React-RCTVibration (= 0.63.3)
- React-callinvoker (0.63.3)
- React-Core (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default (= 0.63.2)
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-Core/Default (= 0.63.3)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/CoreModulesHeaders (0.63.2):
- React-Core/CoreModulesHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/Default (0.63.2):
- React-Core/Default (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/DevSupport (0.63.2):
- React-Core/DevSupport (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default (= 0.63.2)
- React-Core/RCTWebSocket (= 0.63.2)
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-jsinspector (= 0.63.2)
- React-Core/Default (= 0.63.3)
- React-Core/RCTWebSocket (= 0.63.3)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- React-jsinspector (= 0.63.3)
- Yoga
- React-Core/RCTActionSheetHeaders (0.63.2):
- React-Core/RCTActionSheetHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/RCTAnimationHeaders (0.63.2):
- React-Core/RCTAnimationHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/RCTBlobHeaders (0.63.2):
- React-Core/RCTBlobHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/RCTImageHeaders (0.63.2):
- React-Core/RCTImageHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/RCTLinkingHeaders (0.63.2):
- React-Core/RCTLinkingHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/RCTNetworkHeaders (0.63.2):
- React-Core/RCTNetworkHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/RCTSettingsHeaders (0.63.2):
- React-Core/RCTSettingsHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/RCTTextHeaders (0.63.2):
- React-Core/RCTTextHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/RCTVibrationHeaders (0.63.2):
- React-Core/RCTVibrationHeaders (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-Core/RCTWebSocket (0.63.2):
- React-Core/RCTWebSocket (0.63.3):
- Folly (= 2020.01.13.00)
- glog
- React-Core/Default (= 0.63.2)
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsiexecutor (= 0.63.2)
- React-Core/Default (= 0.63.3)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsiexecutor (= 0.63.3)
- Yoga
- React-CoreModules (0.63.2):
- FBReactNativeSpec (= 0.63.2)
- React-CoreModules (0.63.3):
- FBReactNativeSpec (= 0.63.3)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.2)
- React-Core/CoreModulesHeaders (= 0.63.2)
- React-jsi (= 0.63.2)
- React-RCTImage (= 0.63.2)
- ReactCommon/turbomodule/core (= 0.63.2)
- React-cxxreact (0.63.2):
- RCTTypeSafety (= 0.63.3)
- React-Core/CoreModulesHeaders (= 0.63.3)
- React-jsi (= 0.63.3)
- React-RCTImage (= 0.63.3)
- ReactCommon/turbomodule/core (= 0.63.3)
- React-cxxreact (0.63.3):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-callinvoker (= 0.63.2)
- React-jsinspector (= 0.63.2)
- React-jsi (0.63.2):
- React-callinvoker (= 0.63.3)
- React-jsinspector (= 0.63.3)
- React-jsi (0.63.3):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-jsi/Default (= 0.63.2)
- React-jsi/Default (0.63.2):
- React-jsi/Default (= 0.63.3)
- React-jsi/Default (0.63.3):
- boost-for-react-native (= 1.63.0)
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-jsiexecutor (0.63.2):
- React-jsiexecutor (0.63.3):
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-jsinspector (0.63.2)
- react-native-update (5.7.2):
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- React-jsinspector (0.63.3)
- react-native-update (5.9.1):
- React
- react-native-update/BSDiff (= 5.7.2)
- react-native-update/RCTPushy (= 5.7.2)
- react-native-update/BSDiff (= 5.9.1)
- react-native-update/RCTPushy (= 5.9.1)
- SSZipArchive
- react-native-update/BSDiff (5.7.2):
- react-native-update/BSDiff (5.9.1):
- React
- SSZipArchive
- react-native-update/RCTPushy (5.7.2):
- react-native-update/RCTPushy (5.9.1):
- React
- SSZipArchive
- React-RCTActionSheet (0.63.2):
- React-Core/RCTActionSheetHeaders (= 0.63.2)
- React-RCTAnimation (0.63.2):
- FBReactNativeSpec (= 0.63.2)
- react-native-webview (10.9.2):
- React-Core
- React-RCTActionSheet (0.63.3):
- React-Core/RCTActionSheetHeaders (= 0.63.3)
- React-RCTAnimation (0.63.3):
- FBReactNativeSpec (= 0.63.3)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.2)
- React-Core/RCTAnimationHeaders (= 0.63.2)
- React-jsi (= 0.63.2)
- ReactCommon/turbomodule/core (= 0.63.2)
- React-RCTBlob (0.63.2):
- FBReactNativeSpec (= 0.63.2)
- RCTTypeSafety (= 0.63.3)
- React-Core/RCTAnimationHeaders (= 0.63.3)
- React-jsi (= 0.63.3)
- ReactCommon/turbomodule/core (= 0.63.3)
- React-RCTBlob (0.63.3):
- FBReactNativeSpec (= 0.63.3)
- Folly (= 2020.01.13.00)
- React-Core/RCTBlobHeaders (= 0.63.2)
- React-Core/RCTWebSocket (= 0.63.2)
- React-jsi (= 0.63.2)
- React-RCTNetwork (= 0.63.2)
- ReactCommon/turbomodule/core (= 0.63.2)
- React-RCTImage (0.63.2):
- FBReactNativeSpec (= 0.63.2)
- React-Core/RCTBlobHeaders (= 0.63.3)
- React-Core/RCTWebSocket (= 0.63.3)
- React-jsi (= 0.63.3)
- React-RCTNetwork (= 0.63.3)
- ReactCommon/turbomodule/core (= 0.63.3)
- React-RCTImage (0.63.3):
- FBReactNativeSpec (= 0.63.3)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.2)
- React-Core/RCTImageHeaders (= 0.63.2)
- React-jsi (= 0.63.2)
- React-RCTNetwork (= 0.63.2)
- ReactCommon/turbomodule/core (= 0.63.2)
- React-RCTLinking (0.63.2):
- FBReactNativeSpec (= 0.63.2)
- React-Core/RCTLinkingHeaders (= 0.63.2)
- React-jsi (= 0.63.2)
- ReactCommon/turbomodule/core (= 0.63.2)
- React-RCTNetwork (0.63.2):
- FBReactNativeSpec (= 0.63.2)
- RCTTypeSafety (= 0.63.3)
- React-Core/RCTImageHeaders (= 0.63.3)
- React-jsi (= 0.63.3)
- React-RCTNetwork (= 0.63.3)
- ReactCommon/turbomodule/core (= 0.63.3)
- React-RCTLinking (0.63.3):
- FBReactNativeSpec (= 0.63.3)
- React-Core/RCTLinkingHeaders (= 0.63.3)
- React-jsi (= 0.63.3)
- ReactCommon/turbomodule/core (= 0.63.3)
- React-RCTNetwork (0.63.3):
- FBReactNativeSpec (= 0.63.3)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.2)
- React-Core/RCTNetworkHeaders (= 0.63.2)
- React-jsi (= 0.63.2)
- ReactCommon/turbomodule/core (= 0.63.2)
- React-RCTSettings (0.63.2):
- FBReactNativeSpec (= 0.63.2)
- RCTTypeSafety (= 0.63.3)
- React-Core/RCTNetworkHeaders (= 0.63.3)
- React-jsi (= 0.63.3)
- ReactCommon/turbomodule/core (= 0.63.3)
- React-RCTSettings (0.63.3):
- FBReactNativeSpec (= 0.63.3)
- Folly (= 2020.01.13.00)
- RCTTypeSafety (= 0.63.2)
- React-Core/RCTSettingsHeaders (= 0.63.2)
- React-jsi (= 0.63.2)
- ReactCommon/turbomodule/core (= 0.63.2)
- React-RCTText (0.63.2):
- React-Core/RCTTextHeaders (= 0.63.2)
- React-RCTVibration (0.63.2):
- FBReactNativeSpec (= 0.63.2)
- RCTTypeSafety (= 0.63.3)
- React-Core/RCTSettingsHeaders (= 0.63.3)
- React-jsi (= 0.63.3)
- ReactCommon/turbomodule/core (= 0.63.3)
- React-RCTText (0.63.3):
- React-Core/RCTTextHeaders (= 0.63.3)
- React-RCTVibration (0.63.3):
- FBReactNativeSpec (= 0.63.3)
- Folly (= 2020.01.13.00)
- React-Core/RCTVibrationHeaders (= 0.63.2)
- React-jsi (= 0.63.2)
- ReactCommon/turbomodule/core (= 0.63.2)
- ReactCommon/turbomodule/core (0.63.2):
- React-Core/RCTVibrationHeaders (= 0.63.3)
- React-jsi (= 0.63.3)
- ReactCommon/turbomodule/core (= 0.63.3)
- ReactCommon/turbomodule/core (0.63.3):
- DoubleConversion
- Folly (= 2020.01.13.00)
- glog
- React-callinvoker (= 0.63.2)
- React-Core (= 0.63.2)
- React-cxxreact (= 0.63.2)
- React-jsi (= 0.63.2)
- React-callinvoker (= 0.63.3)
- React-Core (= 0.63.3)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- SSZipArchive (2.2.3)
- Yoga (1.14.0)
- YogaKit (1.18.1):
@@ -350,6 +352,7 @@ DEPENDENCIES:
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- react-native-update (from `../../..`)
- react-native-webview (from `../node_modules/react-native-webview`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
@@ -411,6 +414,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-update:
:path: "../../.."
react-native-webview:
:path: "../node_modules/react-native-webview"
React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation:
@@ -439,8 +444,8 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845
CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f
DoubleConversion: cde416483dac037923206447da6e1454df403714
FBLazyVector: 3ef4a7f62e7db01092f9d517d2ebc0d0677c4a37
FBReactNativeSpec: dc7fa9088f0f2a998503a352b0554d69a4391c5a
FBLazyVector: 878b59e31113e289e275165efbe4b54fa614d43d
FBReactNativeSpec: 7da9338acfb98d4ef9e5536805a0704572d33c2f
Flipper: be611d4b742d8c87fbae2ca5f44603a02539e365
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
Flipper-Folly: c12092ea368353b58e992843a990a3225d4533c3
@@ -451,29 +456,30 @@ SPEC CHECKSUMS:
Folly: b73c3869541e86821df3c387eb0af5f65addfab4
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355
RCTRequired: f13f25e7b12f925f1f6a6a8c69d929a03c0129fe
RCTTypeSafety: 44982c5c8e43ff4141eb519a8ddc88059acd1f3a
React: e1c65dd41cb9db13b99f24608e47dd595f28ca9a
React-callinvoker: 552a6a6bc8b3bb794cf108ad59e5a9e2e3b4fc98
React-Core: 9d341e725dc9cd2f49e4c49ad1fc4e8776aa2639
React-CoreModules: 5335e168165da7f7083ce7147768d36d3e292318
React-cxxreact: d3261ec5f7d11743fbf21e263a34ea51d1f13ebc
React-jsi: 54245e1d5f4b690dec614a73a3795964eeef13a8
React-jsiexecutor: 8ca588cc921e70590820ce72b8789b02c67cce38
React-jsinspector: b14e62ebe7a66e9231e9581279909f2fc3db6606
react-native-update: 7602220eccf4ccac05bc90035a541300f2c0189a
React-RCTActionSheet: 910163b6b09685a35c4ebbc52b66d1bfbbe39fc5
React-RCTAnimation: 9a883bbe1e9d2e158d4fb53765ed64c8dc2200c6
React-RCTBlob: 39cf0ece1927996c4466510e25d2105f67010e13
React-RCTImage: de355d738727b09ad3692f2a979affbd54b5f378
React-RCTLinking: 8122f221d395a63364b2c0078ce284214bd04575
React-RCTNetwork: 8f96c7b49ea6a0f28f98258f347b6ad218bc0830
React-RCTSettings: 8a49622aff9c1925f5455fa340b6fe4853d64ab6
React-RCTText: 1b6773e776e4b33f90468c20fe3b16ca3e224bb8
React-RCTVibration: 4d2e726957f4087449739b595f107c0d4b6c2d2d
ReactCommon: a0a1edbebcac5e91338371b72ffc66aa822792ce
RCTRequired: 48884c74035a0b5b76dbb7a998bd93bcfc5f2047
RCTTypeSafety: edf4b618033c2f1c5b7bc3d90d8e085ed95ba2ab
React: f36e90f3ceb976546e97df3403e37d226f79d0e3
React-callinvoker: 18874f621eb96625df7a24a7dc8d6e07391affcd
React-Core: ac3d816b8e3493970153f4aaf0cff18af0bb95e6
React-CoreModules: 4016d3a4e518bcfc4f5a51252b5a05692ca6f0e1
React-cxxreact: ffc9129013b87cb36cf3f30a86695a3c397b0f99
React-jsi: df07aa95b39c5be3e41199921509bfa929ed2b9d
React-jsiexecutor: b56c03e61c0dd5f5801255f2160a815f4a53d451
React-jsinspector: 8e68ffbfe23880d3ee9bafa8be2777f60b25cbe2
react-native-update: 74ae0ad726a7cd5194b377361b7a3e921a65201c
react-native-webview: 4e96d493f9f90ba4f03b28933f30b2964df07e39
React-RCTActionSheet: 53ea72699698b0b47a6421cb1c8b4ab215a774aa
React-RCTAnimation: 1befece0b5183c22ae01b966f5583f42e69a83c2
React-RCTBlob: 0b284339cbe4b15705a05e2313a51c6d8b51fa40
React-RCTImage: d1756599ebd4dc2cb19d1682fe67c6b976658387
React-RCTLinking: 9af0a51c6d6a4dd1674daadafffc6d03033a6d18
React-RCTNetwork: 332c83929cc5eae0b3bbca4add1d668e1fc18bda
React-RCTSettings: d6953772cfd55f2c68ad72b7ef29efc7ec49f773
React-RCTText: 65a6de06a7389098ce24340d1d3556015c38f746
React-RCTVibration: 8e9fb25724a0805107fc1acc9075e26f814df454
ReactCommon: 4167844018c9ed375cc01a843e9ee564399e53c3
SSZipArchive: 62d4947b08730e4cda640473b0066d209ff033c9
Yoga: 7740b94929bbacbddda59bf115b5317e9a161598
Yoga: 7d13633d129fd179e01b8953d38d47be90db185a
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
PODFILE CHECKSUM: 449e295f5242b426c8459fd24a8812cc985916d0

View File

@@ -7,12 +7,14 @@
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
"lint": "eslint .",
"apk": "(cd android && ./gradlew aR)"
},
"dependencies": {
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-update": "link:../.."
"react-native": "0.63.3",
"react-native-update": "link:../..",
"react-native-webview": "^10.9.2"
},
"devDependencies": {
"@babel/core": "^7.8.4",

View File

@@ -8,7 +8,6 @@ import {
TouchableOpacity,
Linking,
Image,
NativeModules,
} from 'react-native';
import {
@@ -21,6 +20,7 @@ import {
switchVersion,
switchVersionLater,
markSuccess,
downloadAndInstallApk,
} from 'react-native-update';
import _updateConfig from '../update.json';
@@ -94,11 +94,29 @@ export default class App extends Component {
return;
}
if (info.expired) {
Alert.alert('提示', '您的应用版本已更新,请前往应用商店下载新的版本', [
Alert.alert('提示', '您的应用版本已更新,点击确定下载安装新版本', [
{
text: '确定',
onPress: () => {
info.downloadUrl && Linking.openURL(info.downloadUrl);
if (info.downloadUrl) {
// apk可直接下载安装
if (
Platform.OS === 'android' &&
info.downloadUrl.endsWith('.apk')
) {
downloadAndInstallApk({
url: info.downloadUrl,
onDownloadProgress: ({received, total}) => {
this.setState({
received,
total,
});
},
});
} else {
Linking.openURL(info.downloadUrl);
}
}
},
},
]);
@@ -144,6 +162,7 @@ export default class App extends Component {
<TouchableOpacity onPress={this.checkUpdate}>
<Text style={styles.instructions}>点击这里检查更新</Text>
</TouchableOpacity>
{/* <WebView style={{flex:1}} source={{uri: require('../www/index.html')}}/> */}
</View>
);
}

22
Example/testHotUpdate/src/www/echarts.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- 引入 ECharts 文件 -->
<script src="echarts.min.js"></script>
</head>
<body>
<!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
</body>
</html>

View File

@@ -1242,12 +1242,23 @@
dependencies:
serve-static "^1.13.1"
"@react-native-community/cli-platform-android@^4.7.0":
version "4.11.0"
resolved "https://registry.npm.taobao.org/@react-native-community/cli-platform-android/download/@react-native-community/cli-platform-android-4.11.0.tgz#0ce9b88ed8b6b0ef962af49d980eb53433c17a84"
integrity sha1-DOm4jti2sO+WKvSdmA61NDPBeoQ=
"@react-native-community/cli-hermes@^4.13.0":
version "4.13.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-hermes/-/cli-hermes-4.13.0.tgz#6243ed9c709dad5e523f1ccd7d21066b32f2899d"
integrity sha512-oG+w0Uby6rSGsUkJGLvMQctZ5eVRLLfhf84lLyz942OEDxFRa9U19YJxOe9FmgCKtotbYiM3P/XhK+SVCuerPQ==
dependencies:
"@react-native-community/cli-tools" "^4.11.0"
"@react-native-community/cli-platform-android" "^4.13.0"
"@react-native-community/cli-tools" "^4.13.0"
chalk "^3.0.0"
hermes-profile-transformer "^0.0.6"
ip "^1.1.5"
"@react-native-community/cli-platform-android@^4.10.0", "@react-native-community/cli-platform-android@^4.13.0":
version "4.13.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-android/-/cli-platform-android-4.13.0.tgz#922681ec82ee1aadd993598b814df1152118be02"
integrity sha512-3i8sX8GklEytUZwPnojuoFbCjIRzMugCdzDIdZ9UNmi/OhD4/8mLGO0dgXfT4sMWjZwu3qjy45sFfk2zOAgHbA==
dependencies:
"@react-native-community/cli-tools" "^4.13.0"
chalk "^3.0.0"
execa "^1.0.0"
fs-extra "^8.1.0"
@@ -1258,12 +1269,12 @@
slash "^3.0.0"
xmldoc "^1.1.2"
"@react-native-community/cli-platform-ios@^4.7.0":
version "4.11.0"
resolved "https://registry.npm.taobao.org/@react-native-community/cli-platform-ios/download/@react-native-community/cli-platform-ios-4.11.0.tgz#5870bf5f2b3c01a0aa672a7c1f7f0fe13337c6b5"
integrity sha1-WHC/Xys8AaCqZyp8H38P4TM3xrU=
"@react-native-community/cli-platform-ios@^4.10.0":
version "4.13.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-platform-ios/-/cli-platform-ios-4.13.0.tgz#a738915c68cac86df54e578b59a1311ea62b1aef"
integrity sha512-6THlTu8zp62efkzimfGr3VIuQJ2514o+vScZERJCV1xgEi8XtV7mb/ZKt9o6Y9WGxKKkc0E0b/aVAtgy+L27CA==
dependencies:
"@react-native-community/cli-tools" "^4.11.0"
"@react-native-community/cli-tools" "^4.13.0"
chalk "^3.0.0"
glob "^7.1.3"
js-yaml "^3.13.1"
@@ -1271,13 +1282,13 @@
plist "^3.0.1"
xcode "^2.0.0"
"@react-native-community/cli-server-api@^4.11.0":
version "4.11.0"
resolved "https://registry.npm.taobao.org/@react-native-community/cli-server-api/download/@react-native-community/cli-server-api-4.11.0.tgz#93887ab8496c9d89b53817297974670184be1191"
integrity sha1-k4h6uElsnYm1OBcpeXRnAYS+EZE=
"@react-native-community/cli-server-api@^4.13.0":
version "4.13.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-server-api/-/cli-server-api-4.13.0.tgz#ef0e53fe0edc7356d62bca725ca47cb368f748a5"
integrity sha512-ER138ChLc1YYX7j9yE6fDm4DdNdsHThr+pla/B6iZoKje1r7TwymDdKaUvOsYalG7sWG9glW3bofcCq+Yh0Dvw==
dependencies:
"@react-native-community/cli-debugger-ui" "^4.9.0"
"@react-native-community/cli-tools" "^4.11.0"
"@react-native-community/cli-tools" "^4.13.0"
compression "^1.7.1"
connect "^3.6.5"
errorhandler "^1.5.0"
@@ -1285,10 +1296,10 @@
serve-static "^1.13.1"
ws "^1.1.0"
"@react-native-community/cli-tools@^4.11.0":
version "4.11.0"
resolved "https://registry.npm.taobao.org/@react-native-community/cli-tools/download/@react-native-community/cli-tools-4.11.0.tgz#a53a51da76468a37f89ef7db808acc1d3c5f9cea"
integrity sha1-pTpR2nZGijf4nvfbgIrMHTxfnOo=
"@react-native-community/cli-tools@^4.13.0":
version "4.13.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-4.13.0.tgz#b406463d33af16cedc4305a9a9257ed32845cf1b"
integrity sha512-s4f489h5+EJksn4CfheLgv5PGOM0CDmK1UEBLw2t/ncWs3cW2VI7vXzndcd/WJHTv3GntJhXDcJMuL+Z2IAOgg==
dependencies:
chalk "^3.0.0"
lodash "^4.17.15"
@@ -1302,15 +1313,16 @@
resolved "https://registry.npm.taobao.org/@react-native-community/cli-types/download/@react-native-community/cli-types-4.10.1.tgz#d68a2dcd1649d3b3774823c64e5e9ce55bfbe1c9"
integrity sha1-1ootzRZJ07N3SCPGTl6c5Vv74ck=
"@react-native-community/cli@^4.7.0":
version "4.12.0"
resolved "https://registry.npm.taobao.org/@react-native-community/cli/download/@react-native-community/cli-4.12.0.tgz#42ca3eacd4b4ba2bd5126aba6a032952e66835b5"
integrity sha1-Qso+rNS0uivVEmq6agMpUuZoNbU=
"@react-native-community/cli@^4.10.0":
version "4.13.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-4.13.0.tgz#04d5032f9b2b423c61ceef6be83b1bcc8a37db75"
integrity sha512-R+1VehIQ6VTLf+e7YOwzJk0F9tstfeSC4xy7oT6GSgB3FnXbTJGHFUp4siyO68Ae/gzGqt8SiUO145teWkP+ZA==
dependencies:
"@hapi/joi" "^15.0.3"
"@react-native-community/cli-debugger-ui" "^4.9.0"
"@react-native-community/cli-server-api" "^4.11.0"
"@react-native-community/cli-tools" "^4.11.0"
"@react-native-community/cli-hermes" "^4.13.0"
"@react-native-community/cli-server-api" "^4.13.0"
"@react-native-community/cli-tools" "^4.13.0"
"@react-native-community/cli-types" "^4.10.1"
chalk "^3.0.0"
command-exists "^1.2.8"
@@ -2746,6 +2758,11 @@ escape-html@~1.0.3:
resolved "https://registry.npm.taobao.org/escape-html/download/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
escape-string-regexp@2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-2.0.0.tgz?cache=0&sync_timestamp=1587627212242&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescape-string-regexp%2Fdownload%2Fescape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344"
integrity sha1-owME6Z2qMuI7L9IPUbq9B8/8o0Q=
escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@@ -3518,6 +3535,13 @@ hermes-engine@~0.5.0:
resolved "https://registry.npm.taobao.org/hermes-engine/download/hermes-engine-0.5.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhermes-engine%2Fdownload%2Fhermes-engine-0.5.1.tgz#601115e4b1e0a17d9aa91243b96277de4e926e09"
integrity sha1-YBEV5LHgoX2aqRJDuWJ33k6Sbgk=
hermes-profile-transformer@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/hermes-profile-transformer/-/hermes-profile-transformer-0.0.6.tgz#bd0f5ecceda80dd0ddaae443469ab26fb38fc27b"
integrity sha512-cnN7bQUm65UWOy6cbGcCcZ3rpwW8Q/j4OP5aWRhEry4Z2t2aR1cjrbp0BS+KiBN0smvP1caBgAuxutvyvJILzQ==
dependencies:
source-map "^0.7.3"
hosted-git-info@^2.1.4:
version "2.8.5"
resolved "https://registry.npm.taobao.org/hosted-git-info/download/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c"
@@ -3684,7 +3708,7 @@ internal-slot@^1.0.2:
has "^1.0.3"
side-channel "^1.0.2"
invariant@^2.2.4:
invariant@2.2.4, invariant@^2.2.4:
version "2.2.4"
resolved "https://registry.npm.taobao.org/invariant/download/invariant-2.2.4.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Finvariant%2Fdownload%2Finvariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
integrity sha1-YQ88ksk1nOHbYW5TgAjSP/NRWOY=
@@ -3696,6 +3720,11 @@ ip-regex@^2.1.0:
resolved "https://registry.npm.taobao.org/ip-regex/download/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9"
integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=
ip@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=
is-accessor-descriptor@^0.1.6:
version "0.1.6"
resolved "https://registry.npm.taobao.org/is-accessor-descriptor/download/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6"
@@ -5936,15 +5965,23 @@ react-is@^16.8.1, react-is@^16.8.4:
version "0.0.0"
uid ""
react-native@0.63.2:
version "0.63.2"
resolved "https://registry.npm.taobao.org/react-native/download/react-native-0.63.2.tgz#eaebf3430577b37fbd66ef228a86b3408259ef8e"
integrity sha1-6uvzQwV3s3+9Zu8iioazQIJZ744=
react-native-webview@^10.9.2:
version "10.9.2"
resolved "https://registry.npm.taobao.org/react-native-webview/download/react-native-webview-10.9.2.tgz#6dbfcfefb0684a6665e346c0eca8040cbdb5fb75"
integrity sha1-bb/P77BoSmZl40bA7KgEDL21+3U=
dependencies:
escape-string-regexp "2.0.0"
invariant "2.2.4"
react-native@0.63.3:
version "0.63.3"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.63.3.tgz#4a7f6540e049ff41810887bbd1125abc4672f3bf"
integrity sha512-71wq13uNo5W8QVQnFlnzZ3AD+XgUBYGhpsxysQFW/hJ8GAt/J5o+Bvhy81FXichp6IBDJDh/JgfHH2gNji8dFA==
dependencies:
"@babel/runtime" "^7.0.0"
"@react-native-community/cli" "^4.7.0"
"@react-native-community/cli-platform-android" "^4.7.0"
"@react-native-community/cli-platform-ios" "^4.7.0"
"@react-native-community/cli" "^4.10.0"
"@react-native-community/cli-platform-android" "^4.10.0"
"@react-native-community/cli-platform-ios" "^4.10.0"
abort-controller "^3.0.0"
anser "^1.4.9"
base64-js "^1.1.2"

View File

@@ -1,7 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.reactnative.modules.update">
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application>
<meta-data android:name="pushy_build_time" android:value="@string/pushy_build_time" />
<provider
android:name=".PushyFileProvider"
android:authorities="${applicationId}.pushy.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/pushy_file_paths" />
</provider>
</application>
</manifest>

View File

@@ -72,7 +72,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
private void downloadFile(DownloadTaskParams param) throws IOException {
String url = param.url;
File writePath = param.zipFilePath;
File writePath = param.targetFile;
this.hash = param.hash;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(url)
@@ -243,10 +243,10 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
copyFilesWithBlacklist("", from, to, blackList);
}
private void doDownload(DownloadTaskParams param) throws IOException {
private void doFullPatch(DownloadTaskParams param) throws IOException {
downloadFile(param);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(param.zipFilePath)));
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(param.targetFile)));
ZipEntry ze;
String filename;
@@ -277,12 +277,12 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
}
}
private void copyFromResource(HashMap<String, ArrayList<File> > map) throws IOException {
private void copyFromResource(HashMap<String, ArrayList<File> > resToCopy) throws IOException {
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(context.getPackageResourcePath())));
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
String fn = ze.getName();
ArrayList<File> targets = map.get(fn);
ArrayList<File> targets = resToCopy.get(fn);
if (targets != null) {
File lastTarget = null;
for (File target: targets) {
@@ -303,10 +303,12 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
private void doPatchFromApk(DownloadTaskParams param) throws IOException, JSONException {
downloadFile(param);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(param.zipFilePath)));
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(param.targetFile)));
ZipEntry ze;
int count;
String filename;
boolean foundDiff = false;
boolean foundBundlePatch = false;
removeDirectory(param.unzipDirectory);
param.unzipDirectory.mkdirs();
@@ -318,6 +320,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
String fn = ze.getName();
if (fn.equals("__diff.json")) {
foundDiff = true;
// copy files from assets
byte[] bytes = readBytes(zis);
String json = new String(bytes, "UTF-8");
@@ -344,6 +347,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
continue;
}
if (fn.equals("index.bundlejs.patch")) {
foundBundlePatch = true;
// do bsdiff patch
byte[] patched = bsdiffPatch(readOriginBundle(), readBytes(zis));
@@ -367,6 +371,12 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
}
zis.close();
if (!foundDiff) {
throw new Error("diff.json not found");
}
if (!foundBundlePatch) {
throw new Error("bundle patch not found");
}
copyFromResource(copyList);
@@ -379,10 +389,12 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
private void doPatchFromPpk(DownloadTaskParams param) throws IOException, JSONException {
downloadFile(param);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(param.zipFilePath)));
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(param.targetFile)));
ZipEntry ze;
int count;
String filename;
boolean foundDiff = false;
boolean foundBundlePatch = false;
removeDirectory(param.unzipDirectory);
param.unzipDirectory.mkdirs();
@@ -392,6 +404,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
String fn = ze.getName();
if (fn.equals("__diff.json")) {
foundDiff = true;
// copy files from assets
byte[] bytes = readBytes(zis);
String json = new String(bytes, "UTF-8");
@@ -412,6 +425,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
continue;
}
if (fn.equals("index.bundlejs.patch")) {
foundBundlePatch = true;
// do bsdiff patch
byte[] patched = bsdiffPatch(readFile(new File(param.originDirectory, "index.bundlejs")), readBytes(zis));
@@ -436,6 +450,12 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
zis.close();
if (!foundDiff) {
throw new Error("diff.json not found");
}
if (!foundBundlePatch) {
throw new Error("bundle patch not found");
}
if (UpdateContext.DEBUG) {
Log.d("RNUpdate", "Unzip finished");
}
@@ -462,10 +482,11 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
@Override
protected Void doInBackground(DownloadTaskParams... params) {
int taskType = params[0].type;
try {
switch (params[0].type) {
case DownloadTaskParams.TASK_TYPE_FULL_DOWNLOAD:
doDownload(params[0]);
switch (taskType) {
case DownloadTaskParams.TASK_TYPE_PATCH_FULL:
doFullPatch(params[0]);
break;
case DownloadTaskParams.TASK_TYPE_PATCH_FROM_APK:
doPatchFromApk(params[0]);
@@ -473,17 +494,46 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
case DownloadTaskParams.TASK_TYPE_PATCH_FROM_PPK:
doPatchFromPpk(params[0]);
break;
case DownloadTaskParams.TASK_TYPE_CLEARUP:
case DownloadTaskParams.TASK_TYPE_CLEANUP:
doCleanUp(params[0]);
break;
case DownloadTaskParams.TASK_TYPE_PLAIN_DOWNLOAD:
downloadFile(params[0]);
break;
default:
break;
}
if (params[0].listener != null) {
params[0].listener.onDownloadCompleted(params[0]);
}
params[0].listener.onDownloadCompleted();
} catch (Throwable e) {
if (UpdateContext.DEBUG) {
e.printStackTrace();
}
switch (taskType) {
case DownloadTaskParams.TASK_TYPE_PATCH_FULL:
case DownloadTaskParams.TASK_TYPE_PATCH_FROM_APK:
case DownloadTaskParams.TASK_TYPE_PATCH_FROM_PPK:
try {
removeDirectory(params[0].unzipDirectory);
} catch (IOException ioException) {
ioException.printStackTrace();
}
break;
case DownloadTaskParams.TASK_TYPE_PLAIN_DOWNLOAD:
// if (targetToClean.exists()) {
params[0].targetFile.delete();
// }
break;
default:
break;
}
Log.e("pushy", "download task failed", e);
if (params[0].listener != null) {
params[0].listener.onDownloadFailed(e);
}
}
return null;
}

View File

@@ -8,17 +8,18 @@ import java.io.File;
* Created by tdzl2003 on 3/31/16.
*/
class DownloadTaskParams {
static final int TASK_TYPE_FULL_DOWNLOAD = 1;
static final int TASK_TYPE_PATCH_FULL = 1;
static final int TASK_TYPE_PATCH_FROM_APK = 2;
static final int TASK_TYPE_PATCH_FROM_PPK = 3;
static final int TASK_TYPE_PLAIN_DOWNLOAD = 4;
static final int TASK_TYPE_CLEARUP = 0; //Keep hash & originHash
static final int TASK_TYPE_CLEANUP = 0; //Keep hash & originHash
int type;
String url;
String hash;
String originHash;
File zipFilePath;
File targetFile;
File unzipDirectory;
File originDirectory;
UpdateContext.DownloadFileListener listener;

View File

@@ -0,0 +1,14 @@
package cn.reactnative.modules.update;
import android.support.v4.content.FileProvider;
/**
* Providing a custom {@code FileProvider} prevents manifest {@code <provider>} name collisions.
*
* See https://developer.android.com/guide/topics/manifest/provider-element.html for details.
*/
public class PushyFileProvider extends FileProvider {
// This class intentionally left blank.
}

View File

@@ -46,7 +46,7 @@ public class UpdateContext {
editor.putString("packageVersion", packageVersion);
editor.apply();
this.clearUp();
this.cleanUp();
}
}
@@ -86,28 +86,39 @@ public class UpdateContext {
}
public interface DownloadFileListener {
void onDownloadCompleted();
void onDownloadCompleted(DownloadTaskParams params);
void onDownloadFailed(Throwable error);
}
public void downloadFile(String url, String hash, DownloadFileListener listener) {
public void downloadFullUpdate(String url, String hash, DownloadFileListener listener) {
DownloadTaskParams params = new DownloadTaskParams();
params.type = DownloadTaskParams.TASK_TYPE_FULL_DOWNLOAD;
params.type = DownloadTaskParams.TASK_TYPE_PATCH_FULL;
params.url = url;
params.hash = hash;
params.listener = listener;
params.zipFilePath = new File(rootDir, hash + ".ppk");
params.targetFile = new File(rootDir, hash + ".ppk");
params.unzipDirectory = new File(rootDir, hash);
new DownloadTask(context).executeOnExecutor(this.executor, params);
}
public void downloadFile(String url, String hash, String fileName, DownloadFileListener listener) {
DownloadTaskParams params = new DownloadTaskParams();
params.type = DownloadTaskParams.TASK_TYPE_PLAIN_DOWNLOAD;
params.url = url;
params.hash = hash;
params.listener = listener;
params.targetFile = new File(rootDir, fileName);
// params.unzipDirectory = new File(rootDir, hash);
new DownloadTask(context).executeOnExecutor(this.executor, params);
}
public void downloadPatchFromApk(String url, String hash, DownloadFileListener listener) {
DownloadTaskParams params = new DownloadTaskParams();
params.type = DownloadTaskParams.TASK_TYPE_PATCH_FROM_APK;
params.url = url;
params.hash = hash;
params.listener = listener;
params.zipFilePath = new File(rootDir, hash + ".apk.patch");
params.targetFile = new File(rootDir, hash + ".apk.patch");
params.unzipDirectory = new File(rootDir, hash);
new DownloadTask(context).executeOnExecutor(this.executor, params);
}
@@ -119,7 +130,7 @@ public class UpdateContext {
params.hash = hash;
params.originHash = originHash;
params.listener = listener;
params.zipFilePath = new File(rootDir, originHash + "-" + hash + ".ppk.patch");
params.targetFile = new File(rootDir, originHash + "-" + hash + ".ppk.patch");
params.unzipDirectory = new File(rootDir, hash);
params.originDirectory = new File(rootDir, originHash);
new DownloadTask(context).executeOnExecutor(this.executor, params);
@@ -174,7 +185,7 @@ public class UpdateContext {
editor.remove("lastVersion");
editor.apply();
this.clearUp();
this.cleanUp();
}
public void clearFirstTime() {
@@ -182,7 +193,7 @@ public class UpdateContext {
editor.putBoolean("firstTime", false);
editor.apply();
this.clearUp();
this.cleanUp();
}
public void clearRollbackMark() {
@@ -190,7 +201,7 @@ public class UpdateContext {
editor.putBoolean("rolledBack", false);
editor.apply();
this.clearUp();
this.cleanUp();
}
@@ -256,21 +267,12 @@ public class UpdateContext {
return lastVersion;
}
private void clearUp() {
private void cleanUp() {
DownloadTaskParams params = new DownloadTaskParams();
params.type = DownloadTaskParams.TASK_TYPE_CLEARUP;
params.type = DownloadTaskParams.TASK_TYPE_CLEANUP;
params.hash = sp.getString("currentVersion", null);
params.originHash = sp.getString("lastVersion", null);
params.unzipDirectory = rootDir;
params.listener = new DownloadFileListener() {
@Override
public void onDownloadCompleted() {
}
@Override
public void onDownloadFailed(Throwable error) {
}
};
new DownloadTask(context).executeOnExecutor(this.executor, params);
}
}

View File

@@ -3,6 +3,8 @@ package cn.reactnative.modules.update;
import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import com.facebook.react.ReactApplication;
@@ -18,17 +20,21 @@ import com.facebook.react.bridge.JSBundleLoader;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import static android.support.v4.content.FileProvider.getUriForFile;
/**
* Created by tdzl2003 on 3/31/16.
*/
public class UpdateModule extends ReactContextBaseJavaModule {
UpdateContext updateContext;
public static ReactApplicationContext mContext;
public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
super(reactContext);
this.updateContext = updateContext;
@@ -71,9 +77,9 @@ public class UpdateModule extends ReactContextBaseJavaModule{
public void downloadUpdate(ReadableMap options, final Promise promise) {
String url = options.getString("updateUrl");
String hash = options.getString("hash");
updateContext.downloadFile(url, hash, new UpdateContext.DownloadFileListener() {
updateContext.downloadFullUpdate(url, hash, new UpdateContext.DownloadFileListener() {
@Override
public void onDownloadCompleted() {
public void onDownloadCompleted(DownloadTaskParams params) {
promise.resolve(null);
}
@@ -84,13 +90,62 @@ public class UpdateModule extends ReactContextBaseJavaModule{
});
}
@ReactMethod
public void downloadAndInstallApk(ReadableMap options, final Promise promise) {
String url = options.getString("url");
String hash = options.getString("hash");
String target = options.getString("target");
updateContext.downloadFile(url, hash, target, new UpdateContext.DownloadFileListener() {
@Override
public void onDownloadCompleted(DownloadTaskParams params) {
installApk(params.targetFile);
promise.resolve(null);
}
@Override
public void onDownloadFailed(Throwable error) {
promise.reject(error);
}
});
}
// install downloaded apk
@ReactMethod
public static void installApk(String url) {
File toInstall = new File(url);
installApk(toInstall);
}
public static void installApk(File toInstall) {
Uri apkUri;
Intent intent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
apkUri = getUriForFile(mContext, mContext.getPackageName() + ".pushy.fileprovider", toInstall);
intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setData(apkUri);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
} else {
apkUri = Uri.fromFile(toInstall);
intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
}
}
@ReactMethod
public void downloadPatchFromPackage(ReadableMap options, final Promise promise) {
String url = options.getString("updateUrl");
String hash = options.getString("hash");
if (hash == null) {
hash = options.getString("hashName");
}
updateContext.downloadPatchFromApk(url, hash, new UpdateContext.DownloadFileListener() {
@Override
public void onDownloadCompleted() {
public void onDownloadCompleted(DownloadTaskParams params) {
promise.resolve(null);
}
@@ -105,10 +160,16 @@ public class UpdateModule extends ReactContextBaseJavaModule{
public void downloadPatchFromPpk(ReadableMap options, final Promise promise) {
String url = options.getString("updateUrl");
String hash = options.getString("hash");
if (hash == null) {
hash = options.getString("hashName");
}
String originHash = options.getString("originHash");
if (originHash == null) {
originHash = options.getString(("originHashName"));
}
updateContext.downloadPatchFromPpk(url, hash, originHash, new UpdateContext.DownloadFileListener() {
@Override
public void onDownloadCompleted() {
public void onDownloadCompleted(DownloadTaskParams params) {
promise.resolve(null);
}
@@ -121,7 +182,8 @@ public class UpdateModule extends ReactContextBaseJavaModule{
@ReactMethod
public void reloadUpdate(ReadableMap options) {
final String hash = options.getString("hash");
final String hash = options.getString("hash") == null ?
options.getString("hashName") : options.getString("hash");
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
@@ -162,7 +224,8 @@ public class UpdateModule extends ReactContextBaseJavaModule{
@ReactMethod
public void setNeedUpdate(ReadableMap options) {
final String hash = options.getString("hash");
final String hash = options.getString("hash") == null ?
options.getString("hashName") : options.getString("hash");
UiThreadUtil.runOnUiThread(new Runnable() {
@Override

View File

@@ -0,0 +1,5 @@
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path
name="pushy"
path="." />
</paths>

View File

@@ -84,7 +84,6 @@ RCT_EXPORT_MODULE(RCTPushy);
}
else {
NSString *curVersion = pushyInfo[paramCurrentVersion];
NSString *lastVersion = pushyInfo[paramLastVersion];
BOOL isFirstTime = [pushyInfo[paramIsFirstTime] boolValue];
BOOL isFirstLoadOK = [pushyInfo[paramIsFirstLoadOk] boolValue];
@@ -92,8 +91,42 @@ RCT_EXPORT_MODULE(RCTPushy);
NSString *loadVersion = curVersion;
BOOL needRollback = (!ignoreRollback && isFirstTime == NO && isFirstLoadOK == NO) || loadVersion.length<=0;
if (needRollback) {
loadVersion = lastVersion;
loadVersion = [self rollback];
}
else if (isFirstTime && !ignoreRollback){
// bundleURL may be called many times, ignore rollbacks before process restarted again.
ignoreRollback = true;
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] initWithDictionary:pushyInfo];
newInfo[paramIsFirstTime] = @(NO);
[defaults setObject:newInfo forKey:keyPushyInfo];
[defaults setObject:@(YES) forKey:keyFirstLoadMarked];
[defaults synchronize];
}
NSString *downloadDir = [RCTPushy downloadDir];
while (loadVersion.length) {
NSString *bundlePath = [[downloadDir stringByAppendingPathComponent:loadVersion] stringByAppendingPathComponent:BUNDLE_FILE_NAME];
if ([[NSFileManager defaultManager] fileExistsAtPath:bundlePath isDirectory:NULL]) {
NSURL *bundleURL = [NSURL fileURLWithPath:bundlePath];
return bundleURL;
} else {
RCTLogError(@"RCTPushy -- bundle version %@ not found", loadVersion);
loadVersion = [self rollback];
}
}
}
}
return [RCTPushy binaryBundleURL];
}
+ (NSString *) rollback {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
NSString *lastVersion = pushyInfo[paramLastVersion];
NSString *curPackageVersion = [RCTPushy packageVersion];
if (lastVersion.length) {
// roll back to last version
[defaults setObject:@{paramCurrentVersion:lastVersion,
@@ -108,32 +141,7 @@ RCT_EXPORT_MODULE(RCTPushy);
}
[defaults setObject:@(YES) forKey:keyRolledBackMarked];
[defaults synchronize];
// ...need clear files later
}
else if (isFirstTime && !ignoreRollback){
// bundleURL may be called many times, ignore rollbacks before process restarted again.
ignoreRollback = true;
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] initWithDictionary:pushyInfo];
newInfo[paramIsFirstTime] = @(NO);
[defaults setObject:newInfo forKey:keyPushyInfo];
[defaults setObject:@(YES) forKey:keyFirstLoadMarked];
[defaults synchronize];
}
if (loadVersion.length) {
NSString *downloadDir = [RCTPushy downloadDir];
NSString *bundlePath = [[downloadDir stringByAppendingPathComponent:loadVersion] stringByAppendingPathComponent:BUNDLE_FILE_NAME];
if ([[NSFileManager defaultManager] fileExistsAtPath:bundlePath isDirectory:NULL]) {
NSURL *bundleURL = [NSURL fileURLWithPath:bundlePath];
return bundleURL;
}
}
}
}
return [RCTPushy binaryBundleURL];
return lastVersion;
}
+ (BOOL)requiresMainQueueSetup {
@@ -248,6 +256,9 @@ RCT_EXPORT_METHOD(downloadPatchFromPpk:(NSDictionary *)options
RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options)
{
NSString *hash = options[@"hash"];
if (hash.length <= 0) {
hash = options[@"hashName"];
}
if (hash.length) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *lastVersion = nil;
@@ -271,6 +282,9 @@ RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options)
RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options)
{
NSString *hash = options[@"hash"];
if (hash.length <= 0) {
hash = options[@"hashName"];
}
if (hash.length) {
[self setNeedUpdate:options];
@@ -327,6 +341,9 @@ RCT_EXPORT_METHOD(markSuccess)
{
NSString *updateUrl = [RCTConvert NSString:options[@"updateUrl"]];
NSString *hash = [RCTConvert NSString:options[@"hash"]];
if (hash.length <= 0) {
hash = [RCTConvert NSString:options[@"hashName"]];;
}
if (updateUrl.length <= 0 || hash.length <= 0) {
callback([self errorWithMessage:ERROR_OPTIONS]);
return;

14
lib/index.d.ts vendored
View File

@@ -5,15 +5,19 @@ export const isFirstTime: boolean;
export const isRolledBack: boolean;
export interface ExpiredResult {
upToDate?: false;
expired: true;
downloadUrl: string;
}
export interface UpTodateResult {
expired?: false;
upToDate: true;
}
export interface UpdateAvailableResult {
expired?: false;
upToDate?: false;
update: true;
name: string; // version name
hash: string;
@@ -43,6 +47,14 @@ export function switchVersionLater(hash: string): void;
export function markSuccess(): void;
export function downloadAndInstallApk({
url,
onDownloadProgress,
}: {
url: string;
onDownloadProgress?: (data: ProgressData) => void;
}): Promise<void>;
/**
* @param {string} main - The main api endpoint
* @param {string[]} [backups] - The back up endpoints.
@@ -55,7 +67,7 @@ export function setCustomEndpoints({
backupQueryUrl,
}: {
main: string;
backUps?: string[];
backups?: string[];
backupQueryUrl?: string;
}): void;

View File

@@ -143,10 +143,11 @@ export async function downloadUpdate(options, eventListeners) {
if (!options.update) {
return;
}
let progressHandler;
if (eventListeners) {
if (eventListeners.onDownloadProgress) {
const downloadCallback = eventListeners.onDownloadProgress;
eventEmitter.addListener('RCTPushyDownloadProgress', (progressData) => {
progressHandler = eventEmitter.addListener('RCTPushyDownloadProgress', (progressData) => {
if (progressData.hash === options.hash) {
downloadCallback(progressData);
}
@@ -167,7 +168,7 @@ export async function downloadUpdate(options, eventListeners) {
hash: options.hash,
});
}
eventEmitter.removeAllListeners('RCTPushyDownloadProgress');
progressHandler && progressHandler.remove();
return options.hash;
}
@@ -188,3 +189,22 @@ export function markSuccess() {
logger('markSuccess');
Pushy.markSuccess();
}
export async function downloadAndInstallApk({ url, onDownloadProgress }) {
logger('downloadAndInstallApk');
let hash = Date.now().toString();
let progressHandler;
if (onDownloadProgress) {
progressHandler = eventEmitter.addListener('RCTPushyDownloadProgress', (progressData) => {
if (progressData.hash === hash) {
onDownloadProgress(progressData);
}
});
}
await Pushy.downloadAndInstallApk({
url,
target: 'update.apk',
hash,
});
progressHandler && progressHandler.remove();
}

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "5.8.3",
"version": "5.11.0-beta2",
"description": "react-native hot update",
"main": "lib/index.js",
"scripts": {