mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-11-01 05:43:11 +08:00 
			
		
		
		
	support jdk 1.8
This commit is contained in:
		| @@ -120,14 +120,13 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     protected void onProgressUpdate(long[]... values) { |     protected void onProgressUpdate(final long[]... values) { | ||||||
|         super.onProgressUpdate(values); |         super.onProgressUpdate(values); | ||||||
|         WritableMap params = Arguments.createMap(); |         WritableMap params = Arguments.createMap(); | ||||||
|         params.putDouble("received", (values[0][0])); |         params.putDouble("received", (values[0][0])); | ||||||
|         params.putDouble("total", (values[0][1])); |         params.putDouble("total", (values[0][1])); | ||||||
|         params.putString("hash", this.hash); |         params.putString("hash", this.hash); | ||||||
|         sendEvent("RCTPushyDownloadProgress", params); |         sendEvent("RCTPushyDownloadProgress", params); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     byte[] buffer = new byte[1024*4]; |     byte[] buffer = new byte[1024*4]; | ||||||
| @@ -452,7 +451,7 @@ class DownloadTask extends AsyncTask<DownloadTaskParams, long[], Void> { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     protected Void doInBackground(DownloadTaskParams... params) { |     protected Void doInBackground(final DownloadTaskParams... params) { | ||||||
|         int taskType = params[0].type; |         int taskType = params[0].type; | ||||||
|         try { |         try { | ||||||
|             switch (taskType) { |             switch (taskType) { | ||||||
|   | |||||||
| @@ -24,7 +24,7 @@ public class UpdateModuleImpl { | |||||||
|  |  | ||||||
|     public static final String NAME = "Pushy"; |     public static final String NAME = "Pushy"; | ||||||
|  |  | ||||||
|     public static void downloadFullUpdate(UpdateContext updateContext, ReadableMap options, Promise promise) { |     public static void downloadFullUpdate(UpdateContext updateContext, final ReadableMap options, final Promise promise) { | ||||||
|         String url = options.getString("updateUrl"); |         String url = options.getString("updateUrl"); | ||||||
|         String hash = options.getString("hash"); |         String hash = options.getString("hash"); | ||||||
|         updateContext.downloadFullUpdate(url, hash, new UpdateContext.DownloadFileListener() { |         updateContext.downloadFullUpdate(url, hash, new UpdateContext.DownloadFileListener() { | ||||||
| @@ -40,7 +40,7 @@ public class UpdateModuleImpl { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void downloadAndInstallApk(UpdateContext updateContext, ReadableMap options, Promise promise) { |     public static void downloadAndInstallApk(UpdateContext updateContext, final ReadableMap options, final Promise promise) { | ||||||
|         String url = options.getString("url"); |         String url = options.getString("url"); | ||||||
|         String hash = options.getString("hash"); |         String hash = options.getString("hash"); | ||||||
|         String target = options.getString("target"); |         String target = options.getString("target"); | ||||||
| @@ -63,7 +63,7 @@ public class UpdateModuleImpl { | |||||||
|         UpdateModule.installApk(toInstall); |         UpdateModule.installApk(toInstall); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void downloadPatchFromPackage(UpdateContext updateContext, ReadableMap options, Promise promise) { |     public static void downloadPatchFromPackage(UpdateContext updateContext, final ReadableMap options, final Promise promise) { | ||||||
|         String url = options.getString("updateUrl"); |         String url = options.getString("updateUrl"); | ||||||
|         String hash = options.getString("hash"); |         String hash = options.getString("hash"); | ||||||
|         updateContext.downloadPatchFromApk(url, hash, new UpdateContext.DownloadFileListener() { |         updateContext.downloadPatchFromApk(url, hash, new UpdateContext.DownloadFileListener() { | ||||||
| @@ -79,7 +79,7 @@ public class UpdateModuleImpl { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void downloadPatchFromPpk(UpdateContext updateContext, ReadableMap options, Promise promise) { |     public static void downloadPatchFromPpk(UpdateContext updateContext, final ReadableMap options, final Promise promise) { | ||||||
|         try { |         try { | ||||||
|             String url = options.getString("updateUrl"); |             String url = options.getString("updateUrl"); | ||||||
|             String hash = options.getString("hash"); |             String hash = options.getString("hash"); | ||||||
| @@ -102,7 +102,7 @@ public class UpdateModuleImpl { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options, Promise promise) { |     public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, final ReadableMap options, final Promise promise) { | ||||||
|         final String hash = options.getString("hash"); |         final String hash = options.getString("hash"); | ||||||
|         UiThreadUtil.runOnUiThread(new Runnable() { |         UiThreadUtil.runOnUiThread(new Runnable() { | ||||||
|             @Override |             @Override | ||||||
| @@ -176,7 +176,7 @@ public class UpdateModuleImpl { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void restartApp(final ReactApplicationContext mContext, Promise promise) { |     public static void restartApp(final ReactApplicationContext mContext, final Promise promise) { | ||||||
|           UiThreadUtil.runOnUiThread(new Runnable() { |           UiThreadUtil.runOnUiThread(new Runnable() { | ||||||
|               @Override |               @Override | ||||||
|               public void run() { |               public void run() { | ||||||
| @@ -206,7 +206,7 @@ public class UpdateModuleImpl { | |||||||
|           }); |           }); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|     public static void setNeedUpdate(UpdateContext updateContext, ReadableMap options, Promise promise) { |     public static void setNeedUpdate(UpdateContext updateContext, final ReadableMap options, final Promise promise) { | ||||||
|         final String hash = options.getString("hash"); |         final String hash = options.getString("hash"); | ||||||
|         UiThreadUtil.runOnUiThread(new Runnable() { |         UiThreadUtil.runOnUiThread(new Runnable() { | ||||||
|             @Override |             @Override | ||||||
| @@ -222,7 +222,7 @@ public class UpdateModuleImpl { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void markSuccess(UpdateContext updateContext, Promise promise) { |     public static void markSuccess(UpdateContext updateContext, final Promise promise) { | ||||||
|         UiThreadUtil.runOnUiThread(new Runnable() { |         UiThreadUtil.runOnUiThread(new Runnable() { | ||||||
|             @Override |             @Override | ||||||
|             public void run() { |             public void run() { | ||||||
| @@ -232,7 +232,7 @@ public class UpdateModuleImpl { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void setUuid(UpdateContext updateContext, String uuid, Promise promise) { |     public static void setUuid(UpdateContext updateContext, final String uuid, final Promise promise) { | ||||||
|         UiThreadUtil.runOnUiThread(new Runnable() { |         UiThreadUtil.runOnUiThread(new Runnable() { | ||||||
|             @Override |             @Override | ||||||
|             public void run() { |             public void run() { | ||||||
| @@ -253,7 +253,7 @@ public class UpdateModuleImpl { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     public static void setLocalHashInfo(UpdateContext updateContext, final String hash, final String info, Promise promise) { |     public static void setLocalHashInfo(UpdateContext updateContext, final String hash, final String info, final Promise promise) { | ||||||
|         UiThreadUtil.runOnUiThread(new Runnable() { |         UiThreadUtil.runOnUiThread(new Runnable() { | ||||||
|             @Override |             @Override | ||||||
|             public void run() { |             public void run() { | ||||||
| @@ -268,7 +268,7 @@ public class UpdateModuleImpl { | |||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void getLocalHashInfo(UpdateContext updateContext, final String hash, Promise promise) { |     public static void getLocalHashInfo(UpdateContext updateContext, final String hash, final Promise promise) { | ||||||
|         String value = updateContext.getKv("hash_" + hash); |         String value = updateContext.getKv("hash_" + hash); | ||||||
|         if (check(value)) { |         if (check(value)) { | ||||||
|             promise.resolve(value); |             promise.resolve(value); | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "react-native-update", |   "name": "react-native-update", | ||||||
|   "version": "10.28.3", |   "version": "10.28.4", | ||||||
|   "description": "react-native hot update", |   "description": "react-native hot update", | ||||||
|   "main": "src/index", |   "main": "src/index", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm