summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2020-07-25 05:30:30 -0700
committercyberta <cyberta@riseup.net>2020-07-25 05:30:30 -0700
commit81abcb0ea1326464d6b34e18ba27c1ccc4587c45 (patch)
tree49940a4733d9333002211f2748117f4788e602e3 /app
parentbdd909d1faae569f27d61ad510d11fad74a5a27c (diff)
parent61075e5788d83685e70c9cfe993cd14e4531216c (diff)
Merge branch 'geoip_service_no_vpn' into 'master'
only allow geoip service calls if the vpn is not yet running in order to get proper results See merge request leap/bitmask_android!110
Diffstat (limited to 'app')
-rw-r--r--app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java
index 04ffe9e6..4a4e7b22 100644
--- a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java
+++ b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java
@@ -216,7 +216,10 @@ public class ProviderApiManager extends ProviderApiManagerBase {
}
/**
- * Fetches the Geo ip Json, containing a list of gateways sorted by distance from the users current location
+ * Fetches the geo ip Json, containing a list of gateways sorted by distance from the users current location.
+ * Fetching is only allowed if the cache timeout of 1 h was reached, a valid geoip service URL exists and the
+ * vpn is not yet active. The latter condition is needed in order to guarantee that the geoip service sees
+ * the real ip of the client
*
* @param provider
* @return
@@ -225,7 +228,7 @@ public class ProviderApiManager extends ProviderApiManagerBase {
protected Bundle getGeoIPJson(Provider provider) {
Bundle result = new Bundle();
- if (!provider.shouldUpdateGeoIpJson() || provider.getGeoipUrl().isDefault()) {
+ if (!provider.shouldUpdateGeoIpJson() || provider.getGeoipUrl().isDefault() || VpnStatus.isVPNActive()) {
result.putBoolean(BROADCAST_RESULT_KEY, false);
return result;
}