quick workaround for force-desktop-mode-bug...will have a look for a
better solution soon
This commit is contained in:
parent
ba336ea125
commit
9663df105f
@ -131,17 +131,16 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
}
|
}
|
||||||
// add all plugins to the script...inject plugins + main script simultaneously
|
// add all plugins to the script...inject plugins + main script simultaneously
|
||||||
js += parsePlugins();
|
js += parsePlugins();
|
||||||
this.js = js;
|
|
||||||
|
|
||||||
// need to wrap the mobile iitc.js version in a document ready. IITC
|
// need to wrap the mobile iitc.js version in a document ready. IITC
|
||||||
// expects to be injected after the DOM has been loaded completely.
|
// expects to be injected after the DOM has been loaded completely.
|
||||||
// Since the mobile client injects IITC by replacing the gen_dashboard
|
// Since the mobile client injects IITC by replacing the gen_dashboard
|
||||||
// file, IITC runs to early. The document.ready delays IITC long enough
|
// file, IITC runs to early. The document.ready delays IITC long enough
|
||||||
// so it boots correctly.
|
// so it boots correctly.
|
||||||
js = "$(document).ready(function(){" + js + "});";
|
this.js = "$(document).ready(function(){" + js + "});";
|
||||||
|
|
||||||
iitcjs = new WebResourceResponse("text/javascript", "UTF-8",
|
iitcjs = new WebResourceResponse("text/javascript", "UTF-8",
|
||||||
new ByteArrayInputStream(js.getBytes()));
|
new ByteArrayInputStream(this.js.getBytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable https
|
// enable https
|
||||||
@ -151,6 +150,16 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
handler.proceed();
|
handler.proceed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
if(sharedPrefs.getBoolean("pref_force_desktop", false)) {
|
||||||
|
Log.d("iitcm", "injecting desktop iitc");
|
||||||
|
view.loadUrl("javascript: " + this.js);
|
||||||
|
}
|
||||||
|
super.onPageFinished(view, url);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method is called automatically when the Google login form is opened.
|
* this method is called automatically when the Google login form is opened.
|
||||||
*/
|
*/
|
||||||
@ -292,6 +301,8 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
@Override
|
@Override
|
||||||
public WebResourceResponse shouldInterceptRequest(final WebView view,
|
public WebResourceResponse shouldInterceptRequest(final WebView view,
|
||||||
String url) {
|
String url) {
|
||||||
|
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
if(!sharedPrefs.getBoolean("pref_force_desktop", false)) {
|
||||||
if (url.contains("/css/common.css")) {
|
if (url.contains("/css/common.css")) {
|
||||||
return new WebResourceResponse("text/css", "UTF-8", style);
|
return new WebResourceResponse("text/css", "UTF-8", style);
|
||||||
} else if (url.contains("gen_dashboard.js")) {
|
} else if (url.contains("gen_dashboard.js")) {
|
||||||
@ -310,6 +321,9 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
} else {
|
} else {
|
||||||
return super.shouldInterceptRequest(view, url);
|
return super.shouldInterceptRequest(view, url);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return super.shouldInterceptRequest(view, url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// start non-ingress-intel-urls in another app...
|
// start non-ingress-intel-urls in another app...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user