diff options
author | cyBerta <cyberta@riseup.net> | 2021-07-30 20:38:23 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2021-11-15 16:13:41 +0100 |
commit | d8b11c392a492ef05b1a454c298f5244a694553b (patch) | |
tree | a4115f5949a86cb25642917a205626e9da954677 /app/src/main/java/se/leap/bitmaskclient/eip | |
parent | 84d604de74d46c9d29d8d8ae20467c0320d2ffb3 (diff) |
ask user to change location or disable bridges if manually selected location doesn't support bridges
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/EIP.java | 3 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java | 19 |
2 files changed, 19 insertions, 3 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java index dd9054f1..a7e08bd7 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java @@ -127,7 +127,8 @@ public final class EIP extends JobIntentService implements Observer { ERROR_INVALID_VPN_CERTIFICATE, NO_MORE_GATEWAYS, ERROR_VPN_PREPARE, - ERROR_INVALID_PROFILE + ERROR_INVALID_PROFILE, + TRANSPORT_NOT_SUPPORTED, } /** diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java index 0b2c2030..dbb2a914 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java @@ -96,6 +96,7 @@ public class GatewaysManager { private final LinkedHashMap<String, Gateway> gateways = new LinkedHashMap<>(); private final Type listType = new TypeToken<ArrayList<Gateway>>() {}.getType(); private final ArrayList<Gateway> presortedList = new ArrayList<>(); + private ArrayList<Location> locations = new ArrayList<>(); public GatewaysManager(Context context) { this.context = context; @@ -130,6 +131,10 @@ public class GatewaysManager { } public List<Location> getGatewayLocations() { + if (locations.size() > 0) { + return locations; + } + HashMap<String, Integer> locationNames = new HashMap<>(); ArrayList<Location> locations = new ArrayList<>(); ArrayList<Gateway> gateways = getSortedGateways(); @@ -166,16 +171,26 @@ public class GatewaysManager { } } + this.locations = locations; return locations; } - public Load getLoadForLocation(@Nullable String name) { + @Nullable + public Location getLocation(String name) { List <Location> locations = getGatewayLocations(); for (Location location : locations) { if (location.name.equals(name)) { - return Load.getLoadByValue(location.averageLoad); + return location; } } + return null; + } + + public Load getLoadForLocation(@Nullable String name) { + Location location = getLocation(name); + if (location != null) { + return Load.getLoadByValue(location.averageLoad); + } // location not found return Load.UNKNOWN; |