mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-17 20:06:10 +08:00
Compare commits
26 Commits
v5.8.1
...
v5.11.0-be
Author | SHA1 | Date | |
---|---|---|---|
![]() |
49e585a561 | ||
![]() |
0e89b270cc | ||
![]() |
7c8e75587b | ||
![]() |
84fee71df6 | ||
![]() |
db548d03dd | ||
![]() |
fc82addd75 | ||
![]() |
90e7c00cf6 | ||
![]() |
eea7ff26f2 | ||
![]() |
684dc8267d | ||
![]() |
5786bf8132 | ||
![]() |
1bd5fbbc94 | ||
![]() |
cd2eb9417a | ||
![]() |
7d8730f590 | ||
![]() |
e3081a02db | ||
![]() |
ec8c475c54 | ||
![]() |
ac18785e50 | ||
![]() |
e80317415c | ||
![]() |
f5c307deca | ||
![]() |
b4feae292d | ||
![]() |
a1c2679427 | ||
![]() |
17ff366f51 | ||
![]() |
3c5792423e | ||
![]() |
d071fbfc2b | ||
![]() |
17dffa1eb5 | ||
![]() |
bcd61315e9 | ||
![]() |
f626cc1933 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -42,3 +42,4 @@ node_modules/
|
||||
npm-debug.log
|
||||
|
||||
Example/**/update.json
|
||||
yarn-error.log
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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",
|
||||
|
@@ -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
22
Example/testHotUpdate/src/www/echarts.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
39
Example/testHotUpdate/src/www/index.html
Normal file
39
Example/testHotUpdate/src/www/index.html
Normal 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>
|
@@ -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"
|
||||
|
@@ -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>
|
||||
|
@@ -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)
|
||||
@@ -97,6 +97,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
|
||||
|
||||
long bytesRead = 0;
|
||||
long received = 0;
|
||||
int currentPercentage = 0;
|
||||
while ((bytesRead = source.read(sink.buffer(), DOWNLOAD_CHUNK_SIZE)) != -1) {
|
||||
received += bytesRead;
|
||||
sink.emit();
|
||||
@@ -104,11 +105,16 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
|
||||
Log.d("RNUpdate", "Progress " + received + "/" + contentLength);
|
||||
}
|
||||
|
||||
publishProgress(new long[]{received, contentLength});
|
||||
int percentage = (int)(received * 100.0 / contentLength + 0.5);
|
||||
if (percentage > currentPercentage) {
|
||||
currentPercentage = percentage;
|
||||
publishProgress(new long[]{received, contentLength});
|
||||
}
|
||||
}
|
||||
if (received != contentLength) {
|
||||
throw new Error("Unexpected eof while reading ppk");
|
||||
throw new Error("Unexpected eof while reading downloaded update");
|
||||
}
|
||||
publishProgress(new long[]{received, contentLength});
|
||||
sink.writeAll(source);
|
||||
sink.close();
|
||||
|
||||
@@ -123,7 +129,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> {
|
||||
WritableMap params = Arguments.createMap();
|
||||
params.putDouble("received", (values[0][0]));
|
||||
params.putDouble("total", (values[0][1]));
|
||||
params.putString("hashname", this.hash);
|
||||
params.putString("hash", this.hash);
|
||||
sendEvent("RCTPushyDownloadProgress", params);
|
||||
|
||||
}
|
||||
@@ -237,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;
|
||||
|
||||
@@ -271,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) {
|
||||
@@ -297,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();
|
||||
@@ -312,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");
|
||||
@@ -338,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));
|
||||
|
||||
@@ -361,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);
|
||||
|
||||
@@ -373,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();
|
||||
@@ -386,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");
|
||||
@@ -406,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));
|
||||
|
||||
@@ -430,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");
|
||||
}
|
||||
@@ -456,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]);
|
||||
@@ -467,16 +494,45 @@ 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();
|
||||
}
|
||||
params[0].listener.onDownloadFailed(e);
|
||||
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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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.
|
||||
|
||||
}
|
@@ -46,7 +46,7 @@ public class UpdateContext {
|
||||
editor.putString("packageVersion", packageVersion);
|
||||
editor.apply();
|
||||
|
||||
this.clearUp();
|
||||
this.cleanUp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,54 +86,65 @@ public class UpdateContext {
|
||||
}
|
||||
|
||||
public interface DownloadFileListener {
|
||||
void onDownloadCompleted();
|
||||
void onDownloadCompleted(DownloadTaskParams params);
|
||||
void onDownloadFailed(Throwable error);
|
||||
}
|
||||
|
||||
public void downloadFile(String url, String hashName, 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 = hashName;
|
||||
params.hash = hash;
|
||||
params.listener = listener;
|
||||
params.zipFilePath = new File(rootDir, hashName + ".ppk");
|
||||
params.unzipDirectory = new File(rootDir, hashName);
|
||||
params.targetFile = new File(rootDir, hash + ".ppk");
|
||||
params.unzipDirectory = new File(rootDir, hash);
|
||||
new DownloadTask(context).executeOnExecutor(this.executor, params);
|
||||
}
|
||||
|
||||
public void downloadPatchFromApk(String url, String hashName, DownloadFileListener listener) {
|
||||
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 = hashName;
|
||||
params.hash = hash;
|
||||
params.listener = listener;
|
||||
params.zipFilePath = new File(rootDir, hashName + ".apk.patch");
|
||||
params.unzipDirectory = new File(rootDir, hashName);
|
||||
params.targetFile = new File(rootDir, hash + ".apk.patch");
|
||||
params.unzipDirectory = new File(rootDir, hash);
|
||||
new DownloadTask(context).executeOnExecutor(this.executor, params);
|
||||
}
|
||||
|
||||
public void downloadPatchFromPpk(String url, String hashName, String originHashName, DownloadFileListener listener) {
|
||||
public void downloadPatchFromPpk(String url, String hash, String originHash, DownloadFileListener listener) {
|
||||
DownloadTaskParams params = new DownloadTaskParams();
|
||||
params.type = DownloadTaskParams.TASK_TYPE_PATCH_FROM_PPK;
|
||||
params.url = url;
|
||||
params.hash = hashName;
|
||||
params.originHash = originHashName;
|
||||
params.hash = hash;
|
||||
params.originHash = originHash;
|
||||
params.listener = listener;
|
||||
params.zipFilePath = new File(rootDir, originHashName + "-" + hashName + ".ppk.patch");
|
||||
params.unzipDirectory = new File(rootDir, hashName);
|
||||
params.originDirectory = new File(rootDir, originHashName);
|
||||
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);
|
||||
}
|
||||
|
||||
private SharedPreferences sp;
|
||||
|
||||
public void switchVersion(String hashName) {
|
||||
if (!new File(rootDir, hashName+"/index.bundlejs").exists()) {
|
||||
throw new Error("Bundle version " + hashName + " not found.");
|
||||
public void switchVersion(String hash) {
|
||||
if (!new File(rootDir, hash+"/index.bundlejs").exists()) {
|
||||
throw new Error("Bundle version " + hash + " not found.");
|
||||
}
|
||||
String lastVersion = getCurrentVersion();
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putString("currentVersion", hashName);
|
||||
editor.putString("currentVersion", hash);
|
||||
if (lastVersion != null) {
|
||||
editor.putString("lastVersion", lastVersion);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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,21 +20,25 @@ 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{
|
||||
public class UpdateModule extends ReactContextBaseJavaModule {
|
||||
UpdateContext updateContext;
|
||||
public static ReactApplicationContext mContext;
|
||||
|
||||
public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
|
||||
super(reactContext);
|
||||
this.updateContext = updateContext;
|
||||
mContext=reactContext;
|
||||
mContext = reactContext;
|
||||
}
|
||||
|
||||
public UpdateModule(ReactApplicationContext reactContext) {
|
||||
@@ -68,12 +74,12 @@ public class UpdateModule extends ReactContextBaseJavaModule{
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void downloadUpdate(ReadableMap options, final Promise promise){
|
||||
public void downloadUpdate(ReadableMap options, final Promise promise) {
|
||||
String url = options.getString("updateUrl");
|
||||
String hash = options.getString("hashName");
|
||||
updateContext.downloadFile(url, hash, new UpdateContext.DownloadFileListener() {
|
||||
String hash = options.getString("hash");
|
||||
updateContext.downloadFullUpdate(url, hash, new UpdateContext.DownloadFileListener() {
|
||||
@Override
|
||||
public void onDownloadCompleted() {
|
||||
public void onDownloadCompleted(DownloadTaskParams params) {
|
||||
promise.resolve(null);
|
||||
}
|
||||
|
||||
@@ -85,12 +91,61 @@ public class UpdateModule extends ReactContextBaseJavaModule{
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void downloadPatchFromPackage(ReadableMap options, final Promise promise){
|
||||
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("hashName");
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -102,13 +157,19 @@ public class UpdateModule extends ReactContextBaseJavaModule{
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void downloadPatchFromPpk(ReadableMap options, final Promise promise){
|
||||
public void downloadPatchFromPpk(ReadableMap options, final Promise promise) {
|
||||
String url = options.getString("updateUrl");
|
||||
String hash = options.getString("hashName");
|
||||
String originHash = options.getString("originHashName");
|
||||
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("hashName");
|
||||
final String hash = options.getString("hash") == null ?
|
||||
options.getString("hashName") : options.getString("hash");
|
||||
|
||||
UiThreadUtil.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@@ -149,7 +211,7 @@ public class UpdateModule extends ReactContextBaseJavaModule{
|
||||
|
||||
try {
|
||||
instanceManager.recreateReactContextInBackground();
|
||||
} catch(Throwable err) {
|
||||
} catch (Throwable err) {
|
||||
activity.recreate();
|
||||
}
|
||||
|
||||
@@ -162,7 +224,8 @@ public class UpdateModule extends ReactContextBaseJavaModule{
|
||||
|
||||
@ReactMethod
|
||||
public void setNeedUpdate(ReadableMap options) {
|
||||
final String hash = options.getString("hashName");
|
||||
final String hash = options.getString("hash") == null ?
|
||||
options.getString("hashName") : options.getString("hash");
|
||||
|
||||
UiThreadUtil.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@@ -209,7 +272,7 @@ public class UpdateModule extends ReactContextBaseJavaModule{
|
||||
}
|
||||
|
||||
/* 发送事件*/
|
||||
public static void sendEvent(String eventName, WritableMap params) {
|
||||
public static void sendEvent(String eventName, WritableMap params) {
|
||||
((ReactContext) mContext).getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(eventName,
|
||||
params);
|
||||
}
|
||||
|
5
android/src/main/res/xml/pushy_file_paths.xml
Normal file
5
android/src/main/res/xml/pushy_file_paths.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<files-path
|
||||
name="pushy"
|
||||
path="." />
|
||||
</paths>
|
@@ -43,8 +43,8 @@ static NSString * const ERROR_FILE_OPERATION = @"file operation error";
|
||||
|
||||
// event def
|
||||
static NSString * const EVENT_PROGRESS_DOWNLOAD = @"RCTPushyDownloadProgress";
|
||||
static NSString * const EVENT_PROGRESS_UNZIP = @"RCTPushyUnzipProgress";
|
||||
static NSString * const PARAM_PROGRESS_HASHNAME = @"hashname";
|
||||
// static NSString * const EVENT_PROGRESS_UNZIP = @"RCTPushyUnzipProgress";
|
||||
static NSString * const PARAM_PROGRESS_HASH = @"hash";
|
||||
static NSString * const PARAM_PROGRESS_RECEIVED = @"received";
|
||||
static NSString * const PARAM_PROGRESS_TOTAL = @"total";
|
||||
|
||||
@@ -62,7 +62,6 @@ static BOOL ignoreRollback = false;
|
||||
bool hasListeners;
|
||||
}
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
@synthesize methodQueue = _methodQueue;
|
||||
|
||||
RCT_EXPORT_MODULE(RCTPushy);
|
||||
@@ -85,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];
|
||||
@@ -93,23 +91,7 @@ RCT_EXPORT_MODULE(RCTPushy);
|
||||
NSString *loadVersion = curVersion;
|
||||
BOOL needRollback = (!ignoreRollback && isFirstTime == NO && isFirstLoadOK == NO) || loadVersion.length<=0;
|
||||
if (needRollback) {
|
||||
loadVersion = lastVersion;
|
||||
|
||||
if (lastVersion.length) {
|
||||
// roll back to last version
|
||||
[defaults setObject:@{paramCurrentVersion:lastVersion,
|
||||
paramIsFirstTime:@(NO),
|
||||
paramIsFirstLoadOk:@(YES),
|
||||
paramPackageVersion:curPackageVersion}
|
||||
forKey:keyPushyInfo];
|
||||
}
|
||||
else {
|
||||
// roll back to bundle
|
||||
[defaults setObject:nil forKey:keyPushyInfo];
|
||||
}
|
||||
[defaults setObject:@(YES) forKey:keyRolledBackMarked];
|
||||
[defaults synchronize];
|
||||
// ...need clear files later
|
||||
loadVersion = [self rollback];
|
||||
}
|
||||
else if (isFirstTime && !ignoreRollback){
|
||||
// bundleURL may be called many times, ignore rollbacks before process restarted again.
|
||||
@@ -122,13 +104,15 @@ RCT_EXPORT_MODULE(RCTPushy);
|
||||
[defaults synchronize];
|
||||
}
|
||||
|
||||
if (loadVersion.length) {
|
||||
NSString *downloadDir = [RCTPushy downloadDir];
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,6 +121,29 @@ RCT_EXPORT_MODULE(RCTPushy);
|
||||
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,
|
||||
paramIsFirstTime:@(NO),
|
||||
paramIsFirstLoadOk:@(YES),
|
||||
paramPackageVersion:curPackageVersion}
|
||||
forKey:keyPushyInfo];
|
||||
}
|
||||
else {
|
||||
// roll back to bundle
|
||||
[defaults setObject:nil forKey:keyPushyInfo];
|
||||
}
|
||||
[defaults setObject:@(YES) forKey:keyRolledBackMarked];
|
||||
[defaults synchronize];
|
||||
return lastVersion;
|
||||
}
|
||||
|
||||
+ (BOOL)requiresMainQueueSetup {
|
||||
// only set to YES if your module initialization relies on calling UIKit!
|
||||
return NO;
|
||||
@@ -248,8 +255,11 @@ RCT_EXPORT_METHOD(downloadPatchFromPpk:(NSDictionary *)options
|
||||
|
||||
RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options)
|
||||
{
|
||||
NSString *hashName = options[@"hashName"];
|
||||
if (hashName.length) {
|
||||
NSString *hash = options[@"hash"];
|
||||
if (hash.length <= 0) {
|
||||
hash = options[@"hashName"];
|
||||
}
|
||||
if (hash.length) {
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString *lastVersion = nil;
|
||||
if ([defaults objectForKey:keyPushyInfo]) {
|
||||
@@ -258,7 +268,7 @@ RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options)
|
||||
}
|
||||
|
||||
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] init];
|
||||
newInfo[paramCurrentVersion] = hashName;
|
||||
newInfo[paramCurrentVersion] = hash;
|
||||
newInfo[paramLastVersion] = lastVersion;
|
||||
newInfo[paramIsFirstTime] = @(YES);
|
||||
newInfo[paramIsFirstLoadOk] = @(NO);
|
||||
@@ -271,8 +281,11 @@ RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options)
|
||||
|
||||
RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options)
|
||||
{
|
||||
NSString *hashName = options[@"hashName"];
|
||||
if (hashName.length) {
|
||||
NSString *hash = options[@"hash"];
|
||||
if (hash.length <= 0) {
|
||||
hash = options[@"hashName"];
|
||||
}
|
||||
if (hash.length) {
|
||||
[self setNeedUpdate:options];
|
||||
|
||||
// reload 0.62+
|
||||
@@ -305,7 +318,10 @@ RCT_EXPORT_METHOD(markSuccess)
|
||||
#pragma mark - private
|
||||
- (NSArray<NSString *> *)supportedEvents
|
||||
{
|
||||
return @[EVENT_PROGRESS_DOWNLOAD, EVENT_PROGRESS_UNZIP];
|
||||
return @[
|
||||
EVENT_PROGRESS_DOWNLOAD,
|
||||
// EVENT_PROGRESS_UNZIP
|
||||
];
|
||||
}
|
||||
|
||||
// Will be called when this module's first listener is added.
|
||||
@@ -324,13 +340,16 @@ RCT_EXPORT_METHOD(markSuccess)
|
||||
- (void)doPushy:(PushyType)type options:(NSDictionary *)options callback:(void (^)(NSError *error))callback
|
||||
{
|
||||
NSString *updateUrl = [RCTConvert NSString:options[@"updateUrl"]];
|
||||
NSString *hashName = [RCTConvert NSString:options[@"hashName"]];
|
||||
if (updateUrl.length<=0 || hashName.length<=0) {
|
||||
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;
|
||||
}
|
||||
NSString *originHashName = [RCTConvert NSString:options[@"originHashName"]];
|
||||
if (type == PushyTypePatchFromPpk && originHashName<=0) {
|
||||
NSString *originHash = [RCTConvert NSString:options[@"originHash"]];
|
||||
if (type == PushyTypePatchFromPpk && originHash <= 0) {
|
||||
callback([self errorWithMessage:ERROR_OPTIONS]);
|
||||
return;
|
||||
}
|
||||
@@ -342,14 +361,14 @@ RCT_EXPORT_METHOD(markSuccess)
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *zipFilePath = [dir stringByAppendingPathComponent:[NSString stringWithFormat:@"%@%@",hashName, [self zipExtension:type]]];
|
||||
// NSString *unzipDir = [dir stringByAppendingPathComponent:hashName];
|
||||
NSString *zipFilePath = [dir stringByAppendingPathComponent:[NSString stringWithFormat:@"%@%@",hash, [self zipExtension:type]]];
|
||||
// NSString *unzipDir = [dir stringByAppendingPathComponent:hash];
|
||||
|
||||
RCTLogInfo(@"RCTPushy -- download file %@", updateUrl);
|
||||
[RCTPushyDownloader download:updateUrl savePath:zipFilePath progressHandler:^(long long receivedBytes, long long totalBytes) {
|
||||
if (self->hasListeners) {
|
||||
[self sendEventWithName:EVENT_PROGRESS_DOWNLOAD body:@{
|
||||
PARAM_PROGRESS_HASHNAME:hashName,
|
||||
PARAM_PROGRESS_HASH:hash,
|
||||
PARAM_PROGRESS_RECEIVED:[NSNumber numberWithLongLong:receivedBytes],
|
||||
PARAM_PROGRESS_TOTAL:[NSNumber numberWithLongLong:totalBytes]
|
||||
}];
|
||||
@@ -360,16 +379,16 @@ RCT_EXPORT_METHOD(markSuccess)
|
||||
}
|
||||
else {
|
||||
RCTLogInfo(@"RCTPushy -- unzip file %@", zipFilePath);
|
||||
NSString *unzipFilePath = [dir stringByAppendingPathComponent:hashName];
|
||||
NSString *unzipFilePath = [dir stringByAppendingPathComponent:hash];
|
||||
[self->_fileManager unzipFileAtPath:zipFilePath toDestination:unzipFilePath progressHandler:^(NSString *entry,long entryNumber, long total) {
|
||||
if (self->hasListeners) {
|
||||
[self sendEventWithName:EVENT_PROGRESS_UNZIP
|
||||
body:@{
|
||||
PARAM_PROGRESS_HASHNAME:hashName,
|
||||
PARAM_PROGRESS_RECEIVED:[NSNumber numberWithLong:entryNumber],
|
||||
PARAM_PROGRESS_TOTAL:[NSNumber numberWithLong:total]
|
||||
}];
|
||||
}
|
||||
// if (self->hasListeners) {
|
||||
// [self sendEventWithName:EVENT_PROGRESS_UNZIP
|
||||
// body:@{
|
||||
// PARAM_PROGRESS_HASH:hash,
|
||||
// PARAM_PROGRESS_RECEIVED:[NSNumber numberWithLong:entryNumber],
|
||||
// PARAM_PROGRESS_TOTAL:[NSNumber numberWithLong:total]
|
||||
// }];
|
||||
// }
|
||||
|
||||
} completionHandler:^(NSString *path, BOOL succeeded, NSError *error) {
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
@@ -382,16 +401,16 @@ RCT_EXPORT_METHOD(markSuccess)
|
||||
{
|
||||
NSString *sourceOrigin = [[NSBundle mainBundle] resourcePath];
|
||||
NSString *bundleOrigin = [[RCTPushy binaryBundleURL] path];
|
||||
[self patch:hashName fromBundle:bundleOrigin source:sourceOrigin callback:callback];
|
||||
[self patch:hash fromBundle:bundleOrigin source:sourceOrigin callback:callback];
|
||||
}
|
||||
break;
|
||||
case PushyTypePatchFromPpk:
|
||||
{
|
||||
NSString *lastVersionDir = [dir stringByAppendingPathComponent:originHashName];
|
||||
NSString *lastVersionDir = [dir stringByAppendingPathComponent:originHash];
|
||||
|
||||
NSString *sourceOrigin = lastVersionDir;
|
||||
NSString *bundleOrigin = [lastVersionDir stringByAppendingPathComponent:BUNDLE_FILE_NAME];
|
||||
[self patch:hashName fromBundle:bundleOrigin source:sourceOrigin callback:callback];
|
||||
[self patch:hash fromBundle:bundleOrigin source:sourceOrigin callback:callback];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -405,9 +424,9 @@ RCT_EXPORT_METHOD(markSuccess)
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)patch:(NSString *)hashName 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
|
||||
{
|
||||
NSString *unzipDir = [[RCTPushy downloadDir] stringByAppendingPathComponent:hashName];
|
||||
NSString *unzipDir = [[RCTPushy downloadDir] stringByAppendingPathComponent:hash];
|
||||
NSString *sourcePatch = [unzipDir stringByAppendingPathComponent:SOURCE_PATCH_NAME];
|
||||
NSString *bundlePatch = [unzipDir stringByAppendingPathComponent:BUNDLE_PATCH_NAME];
|
||||
|
||||
|
17
lib/index.d.ts
vendored
17
lib/index.d.ts
vendored
@@ -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;
|
||||
@@ -34,7 +38,6 @@ export function downloadUpdate(
|
||||
info: UpdateAvailableResult,
|
||||
eventListeners?: {
|
||||
onDownloadProgress?: (data: ProgressData) => void;
|
||||
onUnzipProgress?: (data: ProgressData) => void;
|
||||
},
|
||||
): Promise<undefined | string>;
|
||||
|
||||
@@ -44,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.
|
||||
@@ -56,12 +67,12 @@ export function setCustomEndpoints({
|
||||
backupQueryUrl,
|
||||
}: {
|
||||
main: string;
|
||||
backUps?: string[];
|
||||
backups?: string[];
|
||||
backupQueryUrl?: string;
|
||||
}): void;
|
||||
|
||||
interface ProgressData {
|
||||
hashname: string;
|
||||
hash: string;
|
||||
received: number;
|
||||
total: number;
|
||||
}
|
||||
|
46
lib/index.js
46
lib/index.js
@@ -9,7 +9,6 @@ const {
|
||||
version: v,
|
||||
} = require('react-native/Libraries/Core/ReactNativeVersion');
|
||||
const RNVersion = `${v.major}.${v.minor}.${v.patch}`;
|
||||
const uuidv4 = require('uuid/v4');
|
||||
|
||||
let Pushy = NativeModules.Pushy;
|
||||
|
||||
@@ -35,7 +34,7 @@ if (Platform.OS === 'android' && !Pushy.isUsingBundleUrl) {
|
||||
const eventEmitter = new NativeEventEmitter(Pushy);
|
||||
|
||||
if (!uuid) {
|
||||
uuid = uuidv4();
|
||||
uuid = require('uuid/v4')();
|
||||
Pushy.setUuid(uuid);
|
||||
}
|
||||
|
||||
@@ -144,53 +143,45 @@ 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (eventListeners.onUnzipProgress) {
|
||||
const unzipCallback = eventListeners.onUnzipProgress;
|
||||
eventEmitter.addListener('RCTPushyUnzipProgress', (progressData) => {
|
||||
if (progressData.hash === options.hash) {
|
||||
unzipCallback(progressData);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (options.diffUrl) {
|
||||
logger('downloading diff');
|
||||
await Pushy.downloadPatchFromPpk({
|
||||
updateUrl: options.diffUrl,
|
||||
hashName: options.hash,
|
||||
originHashName: currentVersion,
|
||||
hash: options.hash,
|
||||
originHash: currentVersion,
|
||||
});
|
||||
} else if (options.pdiffUrl) {
|
||||
logger('downloading pdiff');
|
||||
await Pushy.downloadPatchFromPackage({
|
||||
updateUrl: options.pdiffUrl,
|
||||
hashName: options.hash,
|
||||
hash: options.hash,
|
||||
});
|
||||
}
|
||||
eventEmitter.removeAllListeners('RCTPushyDownloadProgress');
|
||||
eventEmitter.removeAllListeners('RCTPushyUnzipProgress');
|
||||
progressHandler && progressHandler.remove();
|
||||
return options.hash;
|
||||
}
|
||||
|
||||
export function switchVersion(hash) {
|
||||
assertRelease();
|
||||
logger('switchVersion');
|
||||
Pushy.reloadUpdate({ hashName: hash });
|
||||
Pushy.reloadUpdate({ hash });
|
||||
}
|
||||
|
||||
export function switchVersionLater(hash) {
|
||||
assertRelease();
|
||||
logger('switchVersionLater');
|
||||
Pushy.setNeedUpdate({ hashName: hash });
|
||||
Pushy.setNeedUpdate({ hash });
|
||||
}
|
||||
|
||||
export function markSuccess() {
|
||||
@@ -198,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();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update",
|
||||
"version": "5.8.1",
|
||||
"version": "5.11.0-beta2",
|
||||
"description": "react-native hot update",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
|
Reference in New Issue
Block a user