You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2019/06/12 19:03:30 UTC
[cordova-plugin-inappbrowser] branch master updated: Fix beforeload
for Android <= 7 (#427)
This is an automated email from the ASF dual-hosted git repository.
purplecabbage pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git
The following commit(s) were added to refs/heads/master by this push:
new 94fec84 Fix beforeload for Android <= 7 (#427)
94fec84 is described below
commit 94fec84d5c81e64b89b4c216d02938d58ba61dbc
Author: Ralph Gutkowski <go...@gmail.com>
AuthorDate: Wed Jun 12 21:03:23 2019 +0200
Fix beforeload for Android <= 7 (#427)
* Fix beforeload for Android <= 7
* Change Android version check conditional
---
src/android/InAppBrowser.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java
index 048b02a..0603302 100644
--- a/src/android/InAppBrowser.java
+++ b/src/android/InAppBrowser.java
@@ -148,6 +148,7 @@ public class InAppBrowser extends CordovaPlugin {
private String footerColor = "";
private String beforeload = "";
private String[] allowedSchemes;
+ private InAppBrowserClient currentClient;
/**
* Executes the request and returns PluginResult.
@@ -264,7 +265,12 @@ public class InAppBrowser extends CordovaPlugin {
@SuppressLint("NewApi")
@Override
public void run() {
- ((InAppBrowserClient)inAppWebView.getWebViewClient()).waitForBeforeload = false;
+ if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) {
+ currentClient.waitForBeforeload = false;
+ inAppWebView.setWebViewClient(currentClient);
+ } else {
+ ((InAppBrowserClient)inAppWebView.getWebViewClient()).waitForBeforeload = false;
+ }
inAppWebView.loadUrl(url);
}
});
@@ -964,8 +970,8 @@ public class InAppBrowser extends CordovaPlugin {
}
});
- WebViewClient client = new InAppBrowserClient(thatWebView, edittext, beforeload);
- inAppWebView.setWebViewClient(client);
+ currentClient = new InAppBrowserClient(thatWebView, edittext, beforeload);
+ inAppWebView.setWebViewClient(currentClient);
WebSettings settings = inAppWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
@@ -1200,7 +1206,9 @@ public class InAppBrowser extends CordovaPlugin {
boolean useBeforeload = false;
String errorMessage = null;
- if(beforeload.equals("yes")
+ if (beforeload.equals("yes") && method == null) {
+ useBeforeload = true;
+ }else if(beforeload.equals("yes")
//TODO handle POST requests then this condition can be removed:
&& !method.equals("POST"))
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org