made force-https an option in mobile settings. removed plugin from build
This commit is contained in:
@ -2,8 +2,10 @@ package com.cradle.iitc_mobile;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebChromeClient;
|
||||
@ -65,6 +67,20 @@ public class IITC_WebView extends WebView {
|
||||
}
|
||||
//----------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void loadUrl(String url) {
|
||||
if (!url.startsWith("javascript:")) {
|
||||
// force https if enabled in settings
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
if (sharedPref.getBoolean("pref_force_https", true))
|
||||
url = url.replace("http://", "https://");
|
||||
else
|
||||
url = url.replace("https://", "http://");
|
||||
Log.d("iitcm", "loading url: " + url);
|
||||
}
|
||||
super.loadUrl(url);
|
||||
}
|
||||
|
||||
public IITC_WebViewClient getWebViewClient() {
|
||||
return this.webclient;
|
||||
}
|
||||
@ -79,7 +95,7 @@ public class IITC_WebView extends WebView {
|
||||
Log.d("iitcm", "not connected to wifi...load tiles from cache");
|
||||
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
||||
} else {
|
||||
Log.d("iitcm", "connected to wifi...load tiles network");
|
||||
Log.d("iitcm", "connected to wifi...load tiles from network");
|
||||
settings.setCacheMode(WebSettings.LOAD_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user