Skip to content

Commit

Permalink
fix: thread issue close event
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Oct 5, 2023
1 parent 127b801 commit a32c538
Showing 1 changed file with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public void pageLoadError() {
}
}
);
getActivity()
this.getActivity()
.runOnUiThread(
new Runnable() {
@Override
Expand All @@ -222,20 +222,36 @@ public void run() {
@PluginMethod
public void reload(PluginCall call) {
if (webViewDialog != null) {
webViewDialog.reload();
this.getActivity()
.runOnUiThread(
new Runnable() {
@Override
public void run() {
webViewDialog.reload();
}
}
);
}
call.resolve();
}

@PluginMethod
public void close(PluginCall call) {
if (webViewDialog != null) {
webViewDialog.dismiss();
notifyListeners(
"closeEvent",
new JSObject().put("url", webViewDialog.getUrl())
);
webViewDialog = null;
this.getActivity()
.runOnUiThread(
new Runnable() {
@Override
public void run() {
notifyListeners(
"closeEvent",
new JSObject().put("url", webViewDialog.getUrl())
);
webViewDialog.dismiss();
webViewDialog = null;
}
}
);
} else {
Intent intent = new Intent(
getContext(),
Expand Down

0 comments on commit a32c538

Please sign in to comment.