mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-11 09:31:59 +01:00
Pebble: background webview add allowed domains array
This commit is contained in:
parent
c4f36d1202
commit
2a0388f1c6
@ -37,6 +37,10 @@ import static nodomain.freeyourgadget.gadgetbridge.util.WebViewSingleton.latch;
|
|||||||
|
|
||||||
public class GBWebClient extends WebViewClient {
|
public class GBWebClient extends WebViewClient {
|
||||||
|
|
||||||
|
private String[] AllowedDomains = new String[]{
|
||||||
|
"openweathermap.org", //for weather :)
|
||||||
|
"tagesschau.de" //for internal watchapp tests
|
||||||
|
};
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GBWebClient.class);
|
private static final Logger LOG = LoggerFactory.getLogger(GBWebClient.class);
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
@ -60,8 +64,9 @@ public class GBWebClient extends WebViewClient {
|
|||||||
return super.shouldInterceptRequest(view, url);
|
return super.shouldInterceptRequest(view, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private WebResourceResponse mimicReply(Uri requestedUri) {
|
private WebResourceResponse mimicReply(Uri requestedUri) {
|
||||||
if (requestedUri.getHost() != null && (requestedUri.getHost().contains("openweathermap.org") || requestedUri.getHost().contains("tagesschau.de"))) {
|
if (requestedUri.getHost() != null && (org.apache.commons.lang3.StringUtils.indexOfAny(requestedUri.getHost(), AllowedDomains) != -1)) {
|
||||||
if (internetHelperBound) {
|
if (internetHelperBound) {
|
||||||
LOG.debug("WEBVIEW forwarding request to the internet helper");
|
LOG.debug("WEBVIEW forwarding request to the internet helper");
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
Loading…
Reference in New Issue
Block a user