Browse Source

Added network security config to allow cleartext in webview

main
M66B 6 years ago
parent
commit
85bdf38fe7
3 changed files with 11 additions and 1 deletions
  1. +1
    -0
      app/src/main/AndroidManifest.xml
  2. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentWebView.java
  3. +9
    -0
      app/src/main/res/xml/network_security_config.xml

+ 1
- 0
app/src/main/AndroidManifest.xml View File

@ -15,6 +15,7 @@
android:appCategory="productivity" android:appCategory="productivity"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppThemeLight"> android:theme="@style/AppThemeLight">


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentWebView.java View File

@ -52,7 +52,7 @@ public class FragmentWebView extends FragmentEx {
settings.setJavaScriptEnabled(true); settings.setJavaScriptEnabled(true);
settings.setLoadWithOverviewMode(true); settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true); settings.setUseWideViewPort(true);
//settings.setBuiltInZoomControls(true);
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
webview.setWebViewClient(new WebViewClient() { webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {


+ 9
- 0
app/src/main/res/xml/network_security_config.xml View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- https://developer.android.com/training/articles/security-config -->
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>

Loading…
Cancel
Save