mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
Fixup for CB-2654.
This commit is contained in:
parent
ba31424604
commit
5ff900f7ec
@ -93,9 +93,6 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
* @return A PluginResult object with a status and message.
|
* @return A PluginResult object with a status and message.
|
||||||
*/
|
*/
|
||||||
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
|
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
|
||||||
PluginResult.Status status = PluginResult.Status.OK;
|
|
||||||
String result = "";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (action.equals("open")) {
|
if (action.equals("open")) {
|
||||||
this.callbackContext = callbackContext;
|
this.callbackContext = callbackContext;
|
||||||
@ -109,6 +106,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Log.d(LOG_TAG, "target = " + target);
|
Log.d(LOG_TAG, "target = " + target);
|
||||||
|
|
||||||
url = updateUrl(url);
|
url = updateUrl(url);
|
||||||
|
String result = "";
|
||||||
|
|
||||||
// SELF
|
// SELF
|
||||||
if (SELF.equals(target)) {
|
if (SELF.equals(target)) {
|
||||||
@ -144,17 +142,14 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
Log.d(LOG_TAG, "in blank");
|
Log.d(LOG_TAG, "in blank");
|
||||||
result = this.showWebPage(url, features);
|
result = this.showWebPage(url, features);
|
||||||
}
|
}
|
||||||
PluginResult pluginResult = new PluginResult(status, result);
|
|
||||||
|
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result);
|
||||||
pluginResult.setKeepCallback(true);
|
pluginResult.setKeepCallback(true);
|
||||||
this.callbackContext.sendPluginResult(pluginResult);
|
this.callbackContext.sendPluginResult(pluginResult);
|
||||||
}
|
}
|
||||||
else if (action.equals("close")) {
|
else if (action.equals("close")) {
|
||||||
this.callbackContext = callbackContext;
|
|
||||||
closeDialog();
|
closeDialog();
|
||||||
|
this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
|
||||||
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
|
|
||||||
pluginResult.setKeepCallback(false);
|
|
||||||
this.callbackContext.sendPluginResult(pluginResult);
|
|
||||||
}
|
}
|
||||||
else if (action.equals("injectScriptCode")) {
|
else if (action.equals("injectScriptCode")) {
|
||||||
String jsWrapper = null;
|
String jsWrapper = null;
|
||||||
@ -191,10 +186,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
injectDeferredObject(args.getString(0), jsWrapper);
|
injectDeferredObject(args.getString(0), jsWrapper);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
status = PluginResult.Status.INVALID_ACTION;
|
return false;
|
||||||
PluginResult pluginResult = new PluginResult(status, result);
|
|
||||||
pluginResult.setKeepCallback(true);
|
|
||||||
this.callbackContext.sendPluginResult(pluginResult);
|
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
|
this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
|
||||||
|
Loading…
Reference in New Issue
Block a user