summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
index 234eb9b0..d1ae7c43 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
@@ -60,6 +60,7 @@ import de.blinkt.openvpn.core.connection.Connection;
import io.swagger.client.model.ModelsBridge;
import io.swagger.client.model.ModelsEIPService;
import io.swagger.client.model.ModelsGateway;
+import io.swagger.client.model.ModelsLocation;
import se.leap.bitmaskclient.base.models.Transport;
import se.leap.bitmaskclient.base.utils.ConfigHelper;
@@ -122,7 +123,7 @@ public class Gateway {
}
- public Gateway(ModelsEIPService eipService, JSONObject secrets, ModelsGateway modelsGateway, int apiVersion) throws ConfigParser.ConfigParseError, JSONException, IOException {
+ public Gateway(ModelsEIPService eipService, JSONObject secrets, ModelsGateway modelsGateway, int apiVersion) throws ConfigParser.ConfigParseError, NumberFormatException, JSONException, IOException {
this.apiVersion = apiVersion;
generalConfiguration = getGeneralConfiguration(eipService);
this.secrets = secrets;
@@ -133,9 +134,13 @@ public class Gateway {
this.remoteIpAddress = modelsGateway.getIpAddr();
this.remoteIpAddressV6 = modelsGateway.getIp6Addr();
this.host = modelsGateway.getHost();
- this.locationName = "UNKNOWN due to bug in menshen";
- // TODO eipService.getLocations().get
- this.timezone = 2; // modelsGateway.getLocation()...
+ ModelsLocation modelsLocation = eipService.getLocations().get(modelsGateway.getLocation());
+ if (modelsLocation != null) {
+ this.locationName = modelsLocation.getDisplayName();
+ this.timezone = Integer.parseInt(modelsLocation.getTimezone());
+ } else {
+ this.locationName = modelsGateway.getLocation();
+ }
this.apiVersion = apiVersion;
VpnConfigGenerator.Configuration configuration = getProfileConfig(createTransportsFrom(modelsGateway));
this.name = configuration.profileName;
@@ -151,10 +156,13 @@ public class Gateway {
this.modelsBridges.add(modelsBridge);
remoteIpAddress = modelsBridge.getIpAddr();
host = modelsBridge.getHost();
- locationName = "UNKNOWN due to bug in menshen";
- // FIXME eipService.getLocations().get
- timezone = 2; // modelsGateway.getLocation()...
- this.apiVersion = apiVersion;
+ ModelsLocation modelsLocation = eipService.getLocations().get(modelsBridge.getLocation());
+ if (modelsLocation != null) {
+ this.locationName = modelsLocation.getDisplayName();
+ this.timezone = Integer.parseInt(modelsLocation.getTimezone());
+ } else {
+ this.locationName = modelsBridge.getLocation();
+ } this.apiVersion = apiVersion;
VpnConfigGenerator.Configuration configuration = getProfileConfig(Transport.createTransportsFrom(modelsBridge));
name = configuration.profileName;
vpnProfiles = createVPNProfiles(configuration);