Skip to content

Commit 0df8261

Browse files
author
sunny.luo
committed
fix android
1 parent 1578130 commit 0df8261

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

android/src/main/java/cn/reactnative/modules/update/UpdateModuleImpl.java

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,25 +101,11 @@ public void onDownloadFailed(Throwable error) {
101101
}
102102
});
103103
}catch (Exception e){
104-
promise.reject("执行报错:"+e.getMessage());
105-
}
106-
}
107-
108-
private void loadBundleLegacy(ReactApplicationContext mContext) {
109-
final Activity currentActivity = mContext.getCurrentActivity();
110-
if (currentActivity == null) {
111-
return;
104+
promise.reject("执行报错:" + e.getMessage());
112105
}
113-
114-
currentActivity.runOnUiThread(new Runnable() {
115-
@Override
116-
public void run() {
117-
currentActivity.recreate();
118-
}
119-
});
120106
}
121107

122-
public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options,Promise promise) {
108+
public static void reloadUpdate(UpdateContext updateContext, ReactApplicationContext mContext, ReadableMap options, Promise promise) {
123109
final String hash = options.getString("hash");
124110

125111
if (hash == null || hash.isEmpty()) {
@@ -156,7 +142,17 @@ public void run() {
156142
} catch (Throwable err) {
157143
promise.reject(err);
158144
Log.e("pushy", "switchVersion failed ", err);
159-
loadBundleLegacy(mContext);
145+
final Activity currentActivity = mContext.getCurrentActivity();
146+
if (currentActivity == null) {
147+
return;
148+
}
149+
150+
currentActivity.runOnUiThread(new Runnable() {
151+
@Override
152+
public void run() {
153+
currentActivity.recreate();
154+
}
155+
});
160156
}
161157
}
162158
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update",
3-
"version": "10.19.5",
3+
"version": "10.19.6",
44
"description": "react-native hot update",
55
"main": "src/index",
66
"scripts": {

0 commit comments

Comments
 (0)