mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 21:33:12 +08:00 
			
		
		
		
	-
This commit is contained in:
		
							
								
								
									
										53
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,55 +1,60 @@ | |||||||
| # react-native-update  [](http://badge.fury.io/js/react-native-update) | # react-native-update [](http://badge.fury.io/js/react-native-update) | ||||||
|  |  | ||||||
| 本组件是面向React Native提供热更新功能的组件,建议结合[Update服务](http://update.reactnative.cn/)使用。 | 本组件是面向 React Native 提供热更新功能的组件,建议结合[Update 服务](http://update.reactnative.cn/)使用。 | ||||||
|  |  | ||||||
| ### 最新更新 | ### 最新更新 | ||||||
|  |  | ||||||
| 5.1.0以上的版本增加了如下的优化: | 5.1.5: 解决 Android 热更新后部分图片丢失问题: | ||||||
|  |  | ||||||
| 1. 在项目中图片较多时,Android更新速度大幅提升,达到和iOS基本一致的更新速度。 | 同一个项目中放置了多个完全相同的文件,在 5.1.0 至 5.1.4 之间的版本中,更新后有时会出现其中的部分无法显示。此问题在 5.1.5 版本修复。 | ||||||
| 2. Android的更新移到了单独的线程,避免更新过程对AsyncStorage等原生异步模块的影响。 |  | ||||||
| 3. Android的.so文件长时间没有任何改动,因而加入了预编译好的文件,避免对ndk的依赖。 | 修复此问题涉及原生部分,需要重新打包。 | ||||||
|  |  | ||||||
|  | 5.1.0 以上的版本增加了如下的优化: | ||||||
|  |  | ||||||
|  | 1. 在项目中图片较多时,Android 更新速度大幅提升,达到和 iOS 基本一致的更新速度。 | ||||||
|  | 2. Android 的更新移到了单独的线程,避免更新过程对 AsyncStorage 等原生异步模块的影响。 | ||||||
|  | 3. Android 的.so 文件长时间没有任何改动,因而加入了预编译好的文件,避免对 ndk 的依赖。 | ||||||
|  |  | ||||||
| ### 版本 | ### 版本 | ||||||
|  |  | ||||||
| 因为React Native不同版本代码结构不同,因而请按下面表格对号入座: | 因为 React Native 不同版本代码结构不同,因而请按下面表格对号入座: | ||||||
|  |  | ||||||
| React Native版本  | react-native-update版本 | | React Native 版本 | react-native-update 版本 | | ||||||
| ------------- | ------------- | | ----------------- | ------------------------ | | ||||||
| 0.26及以下     |   1.0.x | | 0.26 及以下       | 1.0.x                    | | ||||||
| 0.27 - 0.28   |   2.x | | 0.27 - 0.28       | 2.x                      | | ||||||
| 0.29 - 0.33   |   3.x | | 0.29 - 0.33       | 3.x                      | | ||||||
| 0.34 - 0.45   |  4.x | | 0.34 - 0.45       | 4.x                      | | ||||||
| 0.46及以上     |  5.x | | 0.46 及以上       | 5.x                      | | ||||||
|  |  | ||||||
|   |  | ||||||
| ### 优势 | ### 优势 | ||||||
|  |  | ||||||
| 1. 命令行工具&网页双端管理,版本发布过程简单便捷,完全可以集成CI。 | 1. 命令行工具&网页双端管理,版本发布过程简单便捷,完全可以集成 CI。 | ||||||
| 2. 基于bsdiff算法创建的**超小更新包**,通常版本迭代后在1-10KB之间,避免数百KB的流量消耗。 | 2. 基于 bsdiff 算法创建的**超小更新包**,通常版本迭代后在 1-10KB 之间,避免数百 KB 的流量消耗。 | ||||||
| 3. 支持崩溃回滚,安全可靠。 | 3. 支持崩溃回滚,安全可靠。 | ||||||
| 4. meta信息及开放API,提供更高扩展性。 | 4. meta 信息及开放 API,提供更高扩展性。 | ||||||
| 5. 跨越多个版本进行更新时,只需要下载**一个更新包**,不需要逐版本依次更新。 | 5. 跨越多个版本进行更新时,只需要下载**一个更新包**,不需要逐版本依次更新。 | ||||||
|  |  | ||||||
| ### 安装与快速入门 | ### 安装与快速入门 | ||||||
|  |  | ||||||
| 请查阅 | 请查阅 | ||||||
|  |  | ||||||
| * [文档-快速入门-准备工作](docs/guide.md)。 | - [文档-快速入门-准备工作](docs/guide.md)。 | ||||||
|  |  | ||||||
| * [文档-快速入门-添加热更新功能](docs/guide2.md)。 | - [文档-快速入门-添加热更新功能](docs/guide2.md)。 | ||||||
|  |  | ||||||
| * [文档-快速入门-发布版本](docs/guide3.md)。 | - [文档-快速入门-发布版本](docs/guide3.md)。 | ||||||
|  |  | ||||||
| * [文档-常见问题与高级指南](docs/faq_advance.md)。 | - [文档-常见问题与高级指南](docs/faq_advance.md)。 | ||||||
|  |  | ||||||
| ### 命令行工具 | ### 命令行工具 | ||||||
|  |  | ||||||
| 请查阅[文档-命令行工具](docs/cli.md)。 | 请查阅[文档-命令行工具](docs/cli.md)。 | ||||||
|  |  | ||||||
| ### API接口 | ### API 接口 | ||||||
|  |  | ||||||
| 请查阅[文档-API接口](docs/api.md)。 | 请查阅[文档-API 接口](docs/api.md)。 | ||||||
|  |  | ||||||
| ### 关于我们 | ### 关于我们 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ import java.io.FileOutputStream; | |||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.io.InputStream; | import java.io.InputStream; | ||||||
| import java.nio.charset.StandardCharsets; | import java.nio.charset.StandardCharsets; | ||||||
|  | import java.util.ArrayList; | ||||||
| import java.util.Iterator; | import java.util.Iterator; | ||||||
| import java.util.zip.ZipEntry; | import java.util.zip.ZipEntry; | ||||||
| import java.util.zip.ZipInputStream; | import java.util.zip.ZipInputStream; | ||||||
| @@ -250,17 +251,19 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, Void, Void> { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void copyFromResource(HashMap<String, File> map) throws IOException { |     private void copyFromResource(HashMap<String, ArrayList<File> > map) throws IOException { | ||||||
|         ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(context.getPackageResourcePath()))); |         ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(context.getPackageResourcePath()))); | ||||||
|         ZipEntry ze; |         ZipEntry ze; | ||||||
|         while ((ze = zis.getNextEntry()) != null) { |         while ((ze = zis.getNextEntry()) != null) { | ||||||
|             String fn = ze.getName(); |             String fn = ze.getName(); | ||||||
|             File target = map.get(fn); |             ArrayList<File> targets = map.get(fn); | ||||||
|             if (target != null) { |             if (targets != null) { | ||||||
|                 if (UpdateContext.DEBUG) { |                 for (File target: targets) { | ||||||
|                     Log.d("RNUpdate", "Copying from resource " + fn + " to " + target); |                     if (UpdateContext.DEBUG) { | ||||||
|  |                         Log.d("RNUpdate", "Copying from resource " + fn + " to " + target); | ||||||
|  |                     } | ||||||
|  |                     unzipToFile(zis, target); | ||||||
|                 } |                 } | ||||||
|                 unzipToFile(zis, target); |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -276,7 +279,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, Void, Void> { | |||||||
|         removeDirectory(param.unzipDirectory); |         removeDirectory(param.unzipDirectory); | ||||||
|         param.unzipDirectory.mkdirs(); |         param.unzipDirectory.mkdirs(); | ||||||
|  |  | ||||||
|         HashMap<String, File> copyList = new HashMap<String, File>(); |         HashMap<String, ArrayList<File>> copyList = new HashMap<String, ArrayList<File>>(); | ||||||
|  |  | ||||||
|         while ((ze = zis.getNextEntry()) != null) |         while ((ze = zis.getNextEntry()) != null) | ||||||
|         { |         { | ||||||
| @@ -296,7 +299,14 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, Void, Void> { | |||||||
|                     if (from.isEmpty()) { |                     if (from.isEmpty()) { | ||||||
|                         from = to; |                         from = to; | ||||||
|                     } |                     } | ||||||
|                     copyList.put(from, new File(param.unzipDirectory, to)); |                     ArrayList<File> target = null; | ||||||
|  |                     if (!copyList.containsKey(from)) { | ||||||
|  |                         target = new ArrayList<File>(); | ||||||
|  |                         copyList.put(from, target); | ||||||
|  |                     } else { | ||||||
|  |                         target = copyList.get((from)); | ||||||
|  |                     } | ||||||
|  |                     target.add(new File(param.unzipDirectory, to)); | ||||||
|                     //copyFromResource(from, new File(param.unzipDirectory, to)); |                     //copyFromResource(from, new File(param.unzipDirectory, to)); | ||||||
|                 } |                 } | ||||||
|                 continue; |                 continue; | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "react-native-update", |   "name": "react-native-update", | ||||||
|   "version": "5.1.4", |   "version": "5.1.5", | ||||||
|   "description": "react-native hot update", |   "description": "react-native hot update", | ||||||
|   "main": "lib/index.js", |   "main": "lib/index.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Yun
					Yun