parent
9a15737577
commit
416b05c1e5
@ -437,7 +437,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
if (option.hasMoreElements()) {
|
||||
String key = option.nextToken();
|
||||
String value = option.nextToken();
|
||||
if (!customizableOptions.contains(key)){
|
||||
if (!customizableOptions.contains(key)) {
|
||||
value = value.equals("yes") || value.equals("no") ? value : "yes";
|
||||
}
|
||||
map.put(key, value);
|
||||
@ -616,7 +616,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
return this.showLocationBar;
|
||||
}
|
||||
|
||||
private InAppBrowser getInAppBrowser(){
|
||||
private InAppBrowser getInAppBrowser() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -730,7 +730,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
return value;
|
||||
}
|
||||
|
||||
private View createCloseButton(int id){
|
||||
private View createCloseButton(int id) {
|
||||
View _close;
|
||||
Resources activityRes = cordova.getActivity().getResources();
|
||||
|
||||
@ -906,9 +906,9 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
// Footer
|
||||
RelativeLayout footer = new RelativeLayout(cordova.getActivity());
|
||||
int _footerColor;
|
||||
if(footerColor != ""){
|
||||
if(footerColor != "") {
|
||||
_footerColor = Color.parseColor(footerColor);
|
||||
}else{
|
||||
} else {
|
||||
_footerColor = android.graphics.Color.LTGRAY;
|
||||
}
|
||||
footer.setBackgroundColor(_footerColor);
|
||||
@ -1208,26 +1208,26 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
|
||||
if (beforeload.equals("yes") && method == null) {
|
||||
useBeforeload = true;
|
||||
}else if(beforeload.equals("yes")
|
||||
} else if(beforeload.equals("yes")
|
||||
//TODO handle POST requests then this condition can be removed:
|
||||
&& !method.equals("POST"))
|
||||
{
|
||||
useBeforeload = true;
|
||||
}else if(beforeload.equals("get") && (method == null || method.equals("GET"))){
|
||||
} else if(beforeload.equals("get") && (method == null || method.equals("GET"))) {
|
||||
useBeforeload = true;
|
||||
}else if(beforeload.equals("post") && (method == null || method.equals("POST"))){
|
||||
} else if(beforeload.equals("post") && (method == null || method.equals("POST"))) {
|
||||
//TODO handle POST requests
|
||||
errorMessage = "beforeload doesn't yet support POST requests";
|
||||
}
|
||||
|
||||
// On first URL change, initiate JS callback. Only after the beforeload event, continue.
|
||||
if (useBeforeload && this.waitForBeforeload) {
|
||||
if(sendBeforeLoad(url, method)){
|
||||
if(sendBeforeLoad(url, method)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(errorMessage != null){
|
||||
if(errorMessage != null) {
|
||||
try {
|
||||
LOG.e(LOG_TAG, errorMessage);
|
||||
JSONObject obj = new JSONObject();
|
||||
@ -1236,7 +1236,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
obj.put("code", -1);
|
||||
obj.put("message", errorMessage);
|
||||
sendUpdate(obj, true, PluginResult.Status.ERROR);
|
||||
}catch(Exception e){
|
||||
} catch(Exception e) {
|
||||
LOG.e(LOG_TAG, "Error sending loaderror for " + url + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
@ -1322,12 +1322,12 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
return override;
|
||||
}
|
||||
|
||||
private boolean sendBeforeLoad(String url, String method){
|
||||
private boolean sendBeforeLoad(String url, String method) {
|
||||
try {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("type", "beforeload");
|
||||
obj.put("type", BEFORELOAD);
|
||||
obj.put("url", url);
|
||||
if(method != null){
|
||||
if(method != null) {
|
||||
obj.put("method", method);
|
||||
}
|
||||
sendUpdate(obj, true);
|
||||
@ -1365,7 +1365,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
return shouldInterceptRequest(request.getUrl().toString(), super.shouldInterceptRequest(view, request), request.getMethod());
|
||||
}
|
||||
|
||||
public WebResourceResponse shouldInterceptRequest(String url, WebResourceResponse response, String method){
|
||||
public WebResourceResponse shouldInterceptRequest(String url, WebResourceResponse response, String method) {
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -1406,13 +1406,11 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
super.onPageFinished(view, url);
|
||||
|
||||
// Set the namespace for postMessage()
|
||||
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1){
|
||||
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
injectDeferredObject("window.webkit={messageHandlers:{cordova_iab:cordova_iab}}", null);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user