mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-11-22 15:36:10 +08:00
Compare commits
12 Commits
customInst
...
fix-app-js
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3752ad4e5d | ||
|
|
a2f01b6213 | ||
|
|
c2499f799b | ||
|
|
680f77a8d8 | ||
|
|
eaae1286f4 | ||
|
|
20a21ae894 | ||
|
|
5abe7b181b | ||
|
|
e859238d97 | ||
|
|
7796090e72 | ||
|
|
f07be8cf0b | ||
|
|
4a84622c04 | ||
|
|
cf812eacda |
@@ -182,15 +182,15 @@ PODS:
|
||||
- React-cxxreact (= 0.61.4)
|
||||
- React-jsi (= 0.61.4)
|
||||
- React-jsinspector (0.61.4)
|
||||
- react-native-update (5.5.0):
|
||||
- react-native-update (5.5.8):
|
||||
- React
|
||||
- react-native-update/BSDiff (= 5.5.0)
|
||||
- react-native-update/RCTPushy (= 5.5.0)
|
||||
- react-native-update/BSDiff (= 5.5.8)
|
||||
- react-native-update/RCTPushy (= 5.5.8)
|
||||
- SSZipArchive
|
||||
- react-native-update/BSDiff (5.5.0):
|
||||
- react-native-update/BSDiff (5.5.8):
|
||||
- React
|
||||
- SSZipArchive
|
||||
- react-native-update/RCTPushy (5.5.0):
|
||||
- react-native-update/RCTPushy (5.5.8):
|
||||
- React
|
||||
- SSZipArchive
|
||||
- React-RCTActionSheet (0.61.4):
|
||||
@@ -337,7 +337,7 @@ SPEC CHECKSUMS:
|
||||
React-jsi: ca921f4041505f9d5197139b2d09eeb020bb12e8
|
||||
React-jsiexecutor: 8dfb73b987afa9324e4009bdce62a18ce23d983c
|
||||
React-jsinspector: d15478d0a8ada19864aa4d1cc1c697b41b3fa92f
|
||||
react-native-update: 0696134a23c2ad1be899c12b33f9d3521284d458
|
||||
react-native-update: 491cb5902a18f1ebeeb903f1a619df94662fc52a
|
||||
React-RCTActionSheet: 7369b7c85f99b6299491333affd9f01f5a130c22
|
||||
React-RCTAnimation: d07be15b2bd1d06d89417eb0343f98ffd2b099a7
|
||||
React-RCTBlob: 8e0b23d95c9baa98f6b0e127e07666aaafd96c34
|
||||
@@ -353,4 +353,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: 244ba888c650d3945bf72a8d01516fb0f1b3b097
|
||||
|
||||
COCOAPODS: 1.8.4
|
||||
COCOAPODS: 1.9.1
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# react-native-update [](http://badge.fury.io/js/react-native-update)
|
||||
|
||||
本组件是面向 React Native 提供热更新功能的组件,请结合[Update 服务](https://update.reactnative.cn/)使用。
|
||||
本组件是面向 React Native 提供热更新功能的组件,详情请访问我们的官方网站 <https://pushy.reactnative.cn>。
|
||||
|
||||
### 快速开始
|
||||
|
||||
请查看[文档](https://reactnativecn.github.io/react-native-pushy)
|
||||
请查看[文档](https://pushy.reactnative.cn/docs/getting-started)
|
||||
|
||||
### 优势
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class UpdateContext {
|
||||
private File rootDir;
|
||||
private Executor executor;
|
||||
|
||||
public static boolean DEBUG = true;
|
||||
public static boolean DEBUG = false;
|
||||
private static ReactInstanceManager mReactInstanceManager;
|
||||
|
||||
public UpdateContext(Context context) {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
### 最近更新
|
||||
|
||||
## 5.5.8 (2020-04-02)
|
||||
|
||||
1. 提供setCustomInstanceManager方法,方便自己集成RN的用户调用
|
||||
|
||||
## 5.5.6 (2020-02-11)
|
||||
|
||||
1. bundle时清除缓存
|
||||
|
||||
@@ -1 +1 @@
|
||||
["update.reactnative.cn"]
|
||||
["update.react-native.cn", "update.reactnative.cn"]
|
||||
|
||||
@@ -345,10 +345,10 @@ RCT_EXPORT_METHOD(markSuccess)
|
||||
break;
|
||||
case PushyTypePatchFromPpk:
|
||||
{
|
||||
NSString *lastVertionDir = [dir stringByAppendingPathComponent:originHashName];
|
||||
NSString *lastVersionDir = [dir stringByAppendingPathComponent:originHashName];
|
||||
|
||||
NSString *sourceOrigin = lastVertionDir;
|
||||
NSString *bundleOrigin = [lastVertionDir stringByAppendingPathComponent:BUNDLE_FILE_NAME];
|
||||
NSString *sourceOrigin = lastVersionDir;
|
||||
NSString *bundleOrigin = [lastVersionDir stringByAppendingPathComponent:BUNDLE_FILE_NAME];
|
||||
[self patch:hashName fromBundle:bundleOrigin source:sourceOrigin callback:callback];
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -99,16 +99,9 @@ completionHandler:(void (^)(NSError *error))completionHandler
|
||||
|
||||
// merge old files
|
||||
if (deletes!= nil) {
|
||||
NSError *error = nil;
|
||||
NSString *srcDir = [fromDir stringByAppendingPathComponent:@"assets"];
|
||||
NSString *desDir = [toDir stringByAppendingPathComponent:@"assets"];
|
||||
[self _mergeContentsOfPath:srcDir intoPath:desDir deletes:deletes error:&error];
|
||||
if (error) {
|
||||
if (completionHandler) {
|
||||
completionHandler(error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
[self _mergeContentsOfPath:srcDir intoPath:desDir deletes:deletes];
|
||||
}
|
||||
|
||||
// copy files
|
||||
@@ -126,10 +119,11 @@ completionHandler:(void (^)(NSError *error))completionHandler
|
||||
NSError *error = nil;
|
||||
[fm copyItemAtPath:fromPath toPath:toPath error:&error];
|
||||
if (error) {
|
||||
if (completionHandler) {
|
||||
completionHandler(error);
|
||||
}
|
||||
return;
|
||||
NSLog(@"Pushy copy error: %@", error.localizedDescription);
|
||||
// if (completionHandler) {
|
||||
// completionHandler(error);
|
||||
// }
|
||||
// return;
|
||||
}
|
||||
}
|
||||
if (completionHandler) {
|
||||
@@ -150,7 +144,7 @@ completionHandler:(void (^)(NSError *error))completionHandler
|
||||
});
|
||||
}
|
||||
|
||||
- (void)_mergeContentsOfPath:(NSString *)srcDir intoPath:(NSString *)dstDir deletes:(NSDictionary *)deletes error:(NSError**)err
|
||||
- (void)_mergeContentsOfPath:(NSString *)srcDir intoPath:(NSString *)dstDir deletes:(NSDictionary *)deletes
|
||||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSDirectoryEnumerator *srcDirEnum = [fm enumeratorAtPath:srcDir];
|
||||
@@ -159,7 +153,9 @@ completionHandler:(void (^)(NSError *error))completionHandler
|
||||
|
||||
NSString *srcFullPath = [srcDir stringByAppendingPathComponent:subPath];
|
||||
NSString *potentialDstPath = [dstDir stringByAppendingPathComponent:subPath];
|
||||
|
||||
|
||||
NSError *error = nil;
|
||||
|
||||
BOOL inDeletes = NO;
|
||||
if (deletes) {
|
||||
NSString *path = [@"assets" stringByAppendingPathComponent:subPath];
|
||||
@@ -171,18 +167,19 @@ completionHandler:(void (^)(NSError *error))completionHandler
|
||||
BOOL isDirectory = ([fm fileExistsAtPath:srcFullPath isDirectory:&isDirectory] && isDirectory);
|
||||
if (isDirectory) {
|
||||
if (![fm fileExistsAtPath:potentialDstPath isDirectory:nil]) {
|
||||
[fm createDirectoryAtPath:potentialDstPath withIntermediateDirectories:YES attributes:nil error:err];
|
||||
if (err && *err) {
|
||||
return;
|
||||
[fm createDirectoryAtPath:potentialDstPath withIntermediateDirectories:YES attributes:nil error:&error];
|
||||
if (error) {
|
||||
NSLog(@"Pushy merge error: %@", error.localizedDescription);
|
||||
// return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if (![fm fileExistsAtPath:potentialDstPath]) {
|
||||
[fm copyItemAtPath:srcFullPath toPath:potentialDstPath error:err];
|
||||
if (err && *err) {
|
||||
return;
|
||||
[fm copyItemAtPath:srcFullPath toPath:potentialDstPath error:&error];
|
||||
if (error) {
|
||||
NSLog(@"Pushy merge error: %@", error.localizedDescription);
|
||||
// return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
lib/index.js
11
lib/index.js
@@ -1,7 +1,11 @@
|
||||
import getHost, { tryBackupDomains } from './getHost';
|
||||
import { NativeAppEventEmitter, NativeModules } from 'react-native';
|
||||
|
||||
const Pushy = NativeModules.Pushy || {};
|
||||
let Pushy = NativeModules.Pushy;
|
||||
|
||||
if (!Pushy) {
|
||||
throw new Error('react-native-update模块无法加载,请对照安装文档检查配置。');
|
||||
}
|
||||
|
||||
export const downloadRootDir = Pushy.downloadRootDir;
|
||||
export const packageVersion = Pushy.packageVersion;
|
||||
@@ -111,6 +115,11 @@ export function markSuccess() {
|
||||
Pushy.markSuccess();
|
||||
}
|
||||
|
||||
// function report(action) {
|
||||
// // ${project}.${host}/logstores/${logstore}/track?APIVersion=0.6.0&key1=val1
|
||||
// fetch(`${logUrl}&action=${action}`);
|
||||
// }
|
||||
|
||||
NativeAppEventEmitter.addListener('RCTPushyDownloadProgress', params => {});
|
||||
|
||||
NativeAppEventEmitter.addListener('RCTPushyUnzipProgress', params => {});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update",
|
||||
"version": "5.5.7",
|
||||
"version": "5.5.10",
|
||||
"description": "react-native hot update",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
|
||||
s.vendored_libraries = 'RCTPushy/libRCTPushy.a'
|
||||
s.pod_target_xcconfig = { 'USER_HEADER_SEARCH_PATHS' => '"$(SRCROOT)/../node_modules/react-native-update/ios"' }
|
||||
s.resource = 'ios/pushy_build_time.txt'
|
||||
s.script_phase = { :name => 'Generate build time', :script => '"$(SRCROOT)/../node_modules/react-native-update/scripts/generateiOSBuildTime.sh"', :execution_position => :before_compile }
|
||||
s.script_phase = { :name => 'Generate build time', :script => 'set -x;date +%s > ${PODS_ROOT}/../../node_modules/react-native-update/ios/pushy_build_time.txt', :execution_position => :before_compile }
|
||||
|
||||
s.dependency 'React'
|
||||
s.dependency 'SSZipArchive'
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
#!/bin/bash
|
||||
set -x
|
||||
DEST="../../node_modules/react-native-update/ios"
|
||||
date +%s > "$DEST/pushy_build_time.txt"
|
||||
Reference in New Issue
Block a user