Skip to content

Commit

Permalink
fix android
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny.luo committed Dec 26, 2024
1 parent 1578130 commit 0df8261
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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();
}
});
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 0df8261

Please sign in to comment.