1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-03 11:33:19 +02:00

Pebble: background webview add allowed domains array

This commit is contained in:
Daniele Gobbetti 2017-10-13 22:16:01 +02:00
parent c4f36d1202
commit 2a0388f1c6

View File

@ -37,6 +37,10 @@ import static nodomain.freeyourgadget.gadgetbridge.util.WebViewSingleton.latch;
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);
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@ -60,8 +64,9 @@ public class GBWebClient extends WebViewClient {
return super.shouldInterceptRequest(view, url);
}
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) {
LOG.debug("WEBVIEW forwarding request to the internet helper");
Bundle bundle = new Bundle();