1
0

disable zoom, disable ssl checks due to LetsEncrypt changes in Jan 2021

This commit is contained in:
Gottfried Mayer 2020-11-09 16:00:57 +01:00
parent 88f66d681d
commit 7c89015d72
2 changed files with 18 additions and 2 deletions

@ -1,4 +1,5 @@
using Android.App;
using Android.Net.Http;
using Android.OS;
using Android.Webkit;
@ -15,6 +16,8 @@ namespace dashboard
var webView = FindViewById<WebView>(Resource.Id.webView);
webView.Settings.JavaScriptEnabled = true;
webView.Settings.BuiltInZoomControls = false;
webView.Settings.DisplayZoomControls = false;
// Use subclassed WebViewClient to hide default chrome (url bar and stuff)
webView.SetWebViewClient(new HybridWebViewClient());
@ -22,7 +25,21 @@ namespace dashboard
webView.LoadUrl("https://api.mayer.life/dashboard/");
}
private class HybridWebViewClient : WebViewClient { }
private class HybridWebViewClient : WebViewClient
{
public override void OnReceivedSslError(WebView view, SslErrorHandler handler, SslError error)
{
// ignore "untrusted" ssl errors (due to LetsEncrypt changes in January 2021 and compatibility with only Android 7.1+)
if (error.PrimaryError == SslErrorType.Untrusted || error.PrimaryError == SslErrorType.Invalid)
{
handler.Proceed();
}
else
{
handler.Cancel();
}
}
}
}
}

@ -2,7 +2,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.