mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 21:33:12 +08:00 
			
		
		
		
	export cInfo
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -43,3 +43,4 @@ npm-debug.log | |||||||
|  |  | ||||||
| Example/**/update.json | Example/**/update.json | ||||||
| yarn-error.log | yarn-error.log | ||||||
|  | Example/testHotUpdate/.pushy | ||||||
|   | |||||||
							
								
								
									
										42
									
								
								lib/index.js
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								lib/index.js
									
									
									
									
									
								
							| @@ -67,6 +67,13 @@ There is available update: | |||||||
| } | } | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | export const cInfo = { | ||||||
|  |   pushy: require('../package.json').version, | ||||||
|  |   rn: RNVersion, | ||||||
|  |   os: Platform.OS + ' ' + Platform.Version, | ||||||
|  |   uuid, | ||||||
|  | }; | ||||||
|  |  | ||||||
| function assertRelease() { | function assertRelease() { | ||||||
|   if (__DEV__) { |   if (__DEV__) { | ||||||
|     throw new Error('react-native-update can only run on RELEASE version.'); |     throw new Error('react-native-update can only run on RELEASE version.'); | ||||||
| @@ -98,12 +105,7 @@ export async function checkUpdate(APPKEY, isRetry) { | |||||||
|         packageVersion, |         packageVersion, | ||||||
|         hash: currentVersion, |         hash: currentVersion, | ||||||
|         buildTime, |         buildTime, | ||||||
|         cInfo: { |         cInfo, | ||||||
|           pushy: require('../package.json').version, |  | ||||||
|           rn: RNVersion, |  | ||||||
|           os: Platform.OS + ' ' + Platform.Version, |  | ||||||
|           uuid, |  | ||||||
|         }, |  | ||||||
|       }), |       }), | ||||||
|     }); |     }); | ||||||
|   } catch (e) { |   } catch (e) { | ||||||
| @@ -147,11 +149,14 @@ export async function downloadUpdate(options, eventListeners) { | |||||||
|   if (eventListeners) { |   if (eventListeners) { | ||||||
|     if (eventListeners.onDownloadProgress) { |     if (eventListeners.onDownloadProgress) { | ||||||
|       const downloadCallback = eventListeners.onDownloadProgress; |       const downloadCallback = eventListeners.onDownloadProgress; | ||||||
|       progressHandler = eventEmitter.addListener('RCTPushyDownloadProgress', (progressData) => { |       progressHandler = eventEmitter.addListener( | ||||||
|         if (progressData.hash === options.hash) { |         'RCTPushyDownloadProgress', | ||||||
|           downloadCallback(progressData); |         (progressData) => { | ||||||
|         } |           if (progressData.hash === options.hash) { | ||||||
|       }); |             downloadCallback(progressData); | ||||||
|  |           } | ||||||
|  |         }, | ||||||
|  |       ); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   if (options.diffUrl) { |   if (options.diffUrl) { | ||||||
| @@ -167,7 +172,7 @@ export async function downloadUpdate(options, eventListeners) { | |||||||
|       updateUrl: options.pdiffUrl, |       updateUrl: options.pdiffUrl, | ||||||
|       hash: options.hash, |       hash: options.hash, | ||||||
|     }); |     }); | ||||||
|   }else if (options.hdiffUrl) { |   } else if (options.hdiffUrl) { | ||||||
|     logger('downloading hdiff'); |     logger('downloading hdiff'); | ||||||
|     await Pushy.downloadHPatchFromPpk({ |     await Pushy.downloadHPatchFromPpk({ | ||||||
|       updateUrl: options.hdiffUrl, |       updateUrl: options.hdiffUrl, | ||||||
| @@ -208,11 +213,14 @@ export async function downloadAndInstallApk({ url, onDownloadProgress }) { | |||||||
|   let hash = Date.now().toString(); |   let hash = Date.now().toString(); | ||||||
|   let progressHandler; |   let progressHandler; | ||||||
|   if (onDownloadProgress) { |   if (onDownloadProgress) { | ||||||
|     progressHandler = eventEmitter.addListener('RCTPushyDownloadProgress', (progressData) => { |     progressHandler = eventEmitter.addListener( | ||||||
|       if (progressData.hash === hash) { |       'RCTPushyDownloadProgress', | ||||||
|         onDownloadProgress(progressData); |       (progressData) => { | ||||||
|       } |         if (progressData.hash === hash) { | ||||||
|     }); |           onDownloadProgress(progressData); | ||||||
|  |         } | ||||||
|  |       }, | ||||||
|  |     ); | ||||||
|   } |   } | ||||||
|   await Pushy.downloadAndInstallApk({ |   await Pushy.downloadAndInstallApk({ | ||||||
|     url, |     url, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm