mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 13:23:12 +08:00 
			
		
		
		
	improve errorUpdate message
This commit is contained in:
		| @@ -12,7 +12,7 @@ | ||||
|         "react-native-paper": "^5.13.1", | ||||
|         "react-native-safe-area-context": "^5.2.0", | ||||
|         "react-native-svg": "^15.11.1", | ||||
|         "react-native-update": "^10.25.0", | ||||
|         "react-native-update": "^10.25.2", | ||||
|         "react-native-vector-icons": "^10.2.0", | ||||
|       }, | ||||
|       "devDependencies": { | ||||
| @@ -1434,7 +1434,7 @@ | ||||
|  | ||||
|     "react-native-svg": ["react-native-svg@15.11.1", "", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-Qmwx/yJKt+AHUr4zjxx/Q69qwKtRfr1+uIfFMQoq3WFRhqU76aL9db1DyvPiY632DAsVGba1pHf92OZPkpjrdQ=="], | ||||
|  | ||||
|     "react-native-update": ["react-native-update@10.25.0", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-4EYcYZFMhd/VMk9EwND4N2NOBZJYTksvbLdGTgqwYA1NT4IUmBgTFGeeng8GzazOqh4yP0tlW98zpW+67DEZsg=="], | ||||
|     "react-native-update": ["react-native-update@10.25.2", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-HI44TvCdkwXDbIzMKIcz4BK1my+dQYZz3GbiJJiv5/9Sqfl/uiLSr/Z9xUjX4O7G28N206KItORj7YK6yt/66w=="], | ||||
|  | ||||
|     "react-native-url-polyfill": ["react-native-url-polyfill@2.0.0", "", { "dependencies": { "whatwg-url-without-unicode": "8.0.0-3" }, "peerDependencies": { "react-native": "*" } }, "sha512-My330Do7/DvKnEvwQc0WdcBnFPploYKp9CYlefDXzIdEaA+PAhDYllkvGeEroEzvc4Kzzj2O4yVdz8v6fjRvhA=="], | ||||
|  | ||||
|   | ||||
| @@ -23,7 +23,7 @@ | ||||
|     "react-native-paper": "^5.13.1", | ||||
|     "react-native-safe-area-context": "^5.2.0", | ||||
|     "react-native-svg": "^15.11.1", | ||||
|     "react-native-update": "^10.25.0", | ||||
|     "react-native-update": "^10.25.2", | ||||
|     "react-native-vector-icons": "^10.2.0" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|   | ||||
| @@ -49,7 +49,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | ||||
|  | ||||
|     private void removeDirectory(File file) throws IOException { | ||||
|         if (UpdateContext.DEBUG) { | ||||
|             Log.d("RNUpdate", "Removing " + file); | ||||
|             Log.d("react-native-update", "Removing " + file); | ||||
|         } | ||||
|         if (file.isDirectory()) { | ||||
|             File[] files = file.listFiles(); | ||||
| @@ -88,7 +88,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | ||||
|         BufferedSink sink = Okio.buffer(Okio.sink(writePath)); | ||||
|  | ||||
|         if (UpdateContext.DEBUG) { | ||||
|             Log.d("RNUpdate", "Downloading " + url); | ||||
|             Log.d("react-native-update", "Downloading " + url); | ||||
|         } | ||||
|  | ||||
|         long bytesRead = 0; | ||||
| @@ -98,7 +98,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | ||||
|             received += bytesRead; | ||||
|             sink.emit(); | ||||
|             if (UpdateContext.DEBUG) { | ||||
|                 Log.d("RNUpdate", "Progress " + received + "/" + contentLength); | ||||
|                 Log.d("react-native-update", "Progress " + received + "/" + contentLength); | ||||
|             } | ||||
|              | ||||
|             int percentage = (int)(received * 100.0 / contentLength + 0.5); | ||||
| @@ -115,7 +115,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | ||||
|         sink.close(); | ||||
|  | ||||
|         if (UpdateContext.DEBUG) { | ||||
|             Log.d("RNUpdate", "Download finished"); | ||||
|             Log.d("react-native-update", "Download finished"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -244,7 +244,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | ||||
|  | ||||
|  | ||||
|         if (UpdateContext.DEBUG) { | ||||
|             Log.d("RNUpdate", "Unzip finished"); | ||||
|             Log.d("react-native-update", "Unzip finished"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -260,7 +260,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | ||||
|                 File lastTarget = null; | ||||
|                 for (File target: targets) { | ||||
|                     if (UpdateContext.DEBUG) { | ||||
|                         Log.d("RNUpdate", "Copying from resource " + fn + " to " + target); | ||||
|                         Log.d("react-native-update", "Copying from resource " + fn + " to " + target); | ||||
|                     } | ||||
|                     if (lastTarget != null) { | ||||
|                         copyFile(lastTarget, target); | ||||
| @@ -352,7 +352,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | ||||
|         copyFromResource(copyList); | ||||
|  | ||||
|         if (UpdateContext.DEBUG) { | ||||
|             Log.d("RNUpdate", "Unzip finished"); | ||||
|             Log.d("react-native-update", "Unzip finished"); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| @@ -418,12 +418,12 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | ||||
|             throw new Error("bundle patch not found"); | ||||
|         } | ||||
|         if (UpdateContext.DEBUG) { | ||||
|             Log.d("RNUpdate", "Unzip finished"); | ||||
|             Log.d("react-native-update", "Unzip finished"); | ||||
|         } | ||||
|     } | ||||
|     private void doCleanUp(DownloadTaskParams param) throws IOException { | ||||
|         if (UpdateContext.DEBUG) { | ||||
|             Log.d("RNUpdate", "Start cleaning up"); | ||||
|             Log.d("react-native-update", "Start cleaning up"); | ||||
|         } | ||||
|         File root = param.unzipDirectory; | ||||
|         for (File sub : root.listFiles()) { | ||||
| @@ -499,7 +499,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | ||||
|                 default: | ||||
|                     break; | ||||
|             } | ||||
|             Log.e("pushy", "download task failed", e); | ||||
|             Log.e("react-native-update", "download task failed", e); | ||||
|  | ||||
|             if (params[0].listener != null) { | ||||
|                 params[0].listener.onDownloadFailed(e); | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "react-native-update", | ||||
|   "version": "10.25.2", | ||||
|   "version": "10.25.3", | ||||
|   "description": "react-native hot update", | ||||
|   "main": "src/index", | ||||
|   "scripts": { | ||||
|   | ||||
| @@ -361,6 +361,7 @@ export class Pushy { | ||||
|     let succeeded = ''; | ||||
|     this.report({ type: 'downloading' }); | ||||
|     let lastError: any; | ||||
|     let errorMessages: string[] = []; | ||||
|     const diffUrl = await testUrls(joinUrls(paths, diff)); | ||||
|     if (diffUrl) { | ||||
|       log('downloading diff'); | ||||
| @@ -372,11 +373,13 @@ export class Pushy { | ||||
|         }); | ||||
|         succeeded = 'diff'; | ||||
|       } catch (e: any) { | ||||
|         lastError = e; | ||||
|         const errorMessage = `diff error: ${e.message}`; | ||||
|         errorMessages.push(errorMessage); | ||||
|         lastError = new Error(errorMessage); | ||||
|         if (__DEV__) { | ||||
|           succeeded = 'diff'; | ||||
|         } else { | ||||
|           log(`diff error: ${e.message}, try pdiff`); | ||||
|           log(errorMessage); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| @@ -390,11 +393,13 @@ export class Pushy { | ||||
|         }); | ||||
|         succeeded = 'pdiff'; | ||||
|       } catch (e: any) { | ||||
|         lastError = e; | ||||
|         const errorMessage = `pdiff error: ${e.message}`; | ||||
|         errorMessages.push(errorMessage); | ||||
|         lastError = new Error(errorMessage); | ||||
|         if (__DEV__) { | ||||
|           succeeded = 'pdiff'; | ||||
|         } else { | ||||
|           log(`pdiff error: ${e.message}, try full patch`); | ||||
|           log(errorMessage); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| @@ -408,11 +413,13 @@ export class Pushy { | ||||
|         }); | ||||
|         succeeded = 'full'; | ||||
|       } catch (e: any) { | ||||
|         lastError = e; | ||||
|         const errorMessage = `full patch error: ${e.message}`; | ||||
|         errorMessages.push(errorMessage); | ||||
|         lastError = new Error(errorMessage); | ||||
|         if (__DEV__) { | ||||
|           succeeded = 'full'; | ||||
|         } else { | ||||
|           log(`full patch error: ${e.message}`); | ||||
|           log(errorMessage); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| @@ -427,6 +434,7 @@ export class Pushy { | ||||
|       this.report({ | ||||
|         type: 'errorUpdate', | ||||
|         data: { newVersion: hash }, | ||||
|         message: errorMessages.join(';'), | ||||
|       }); | ||||
|       if (lastError) { | ||||
|         throw lastError; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm