CB-5021 Expose closeDialog() as a public function and make it safe to call multiple times.
This commit is contained in:
parent
ef5eddac9a
commit
8cd786b603
@ -157,7 +157,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
}
|
}
|
||||||
else if (action.equals("close")) {
|
else if (action.equals("close")) {
|
||||||
closeDialog();
|
closeDialog();
|
||||||
this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
|
this.callbackContext.success();
|
||||||
}
|
}
|
||||||
else if (action.equals("injectScriptCode")) {
|
else if (action.equals("injectScriptCode")) {
|
||||||
String jsWrapper = null;
|
String jsWrapper = null;
|
||||||
@ -311,11 +311,15 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Closes the dialog
|
* Closes the dialog
|
||||||
*/
|
*/
|
||||||
private void closeDialog() {
|
public void closeDialog() {
|
||||||
|
final WebView childView = this.inAppWebView;
|
||||||
|
// The JS protects against multiple calls, so this should happen only when
|
||||||
|
// closeDialog() is called by other native code.
|
||||||
|
if (childView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
final WebView childView = this.inAppWebView;
|
|
||||||
Runnable runnable = new Runnable() {
|
Runnable runnable = new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
childView.loadUrl("about:blank");
|
childView.loadUrl("about:blank");
|
||||||
|
Loading…
Reference in New Issue
Block a user