Skip to content

Commit 00758fc

Browse files
committed
added support for mixed content, configurable in Constants.java
1 parent 6294022 commit 00758fc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

app/src/main/java/at/xtools/pwawrapper/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ public Constants(){}
1818
// lower it, if you've got server-side rendering (e.g. to 35),
1919
// bump it up to ~98 if you don't have SSR or a loading screen in your web app
2020
public static int PROGRESS_THRESHOLD = 65;
21+
// turn on/off mixed content (both https+http within one page) for API >= 21
22+
public static boolean ENABLE_MIXED_CONTENT = true;
2123
}

app/src/main/java/at/xtools/pwawrapper/webview/WebViewHelper.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ public void setupWebView() {
9191
webSettings.setAppCacheEnabled(true);
9292
webSettings.setDatabaseEnabled(true);
9393

94+
// enable mixed content mode conditionally
95+
if (Constants.ENABLE_MIXED_CONTENT
96+
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
97+
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
98+
}
99+
94100
// retrieve content from cache primarily if not connected
95101
forceCacheIfOffline();
96102

0 commit comments

Comments
 (0)