diff --git a/android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java b/android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java index b4a03c03..57330835 100644 --- a/android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java +++ b/android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java @@ -101,25 +101,11 @@ public void onDownloadFailed(Throwable error) { } }); }catch (Exception e){ - promise.reject("执行报错:"+e.getMessage()); - } - } - - private void loadBundleLegacy(ReactApplicationContext mContext) { - final Activity currentActivity = mContext.getCurrentActivity(); - if (currentActivity == null) { - return; + promise.reject("执行报错:" + e.getMessage()); } - - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - currentActivity.recreate(); - } - }); } - public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options,Promise promise) { + public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options, Promise promise) { final String hash = options.getString("hash"); if (hash == null || hash.isEmpty()) { @@ -156,7 +142,17 @@ public void run() { } catch (Throwable err) { promise.reject(err); Log.e("pushy", "switchVersion failed ", err); - loadBundleLegacy(mContext); + final Activity currentActivity = mContext.getCurrentActivity(); + if (currentActivity == null) { + return; + } + + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + currentActivity.recreate(); + } + }); } } }); diff --git a/package.json b/package.json index f8395a5c..d68e4780 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-update", - "version": "10.19.5", + "version": "10.19.6", "description": "react-native hot update", "main": "src/index", "scripts": {