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/ProviderListBaseActivity.java5
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java24
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java6
3 files changed, 19 insertions, 16 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java
index 1fb54884..41d2d849 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java
@@ -233,7 +233,8 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity
showDownloadFailedDialog();
}
- void handleCorrectlyDownloadedCertificate() {
+ void handleCorrectlyDownloadedCertificate(Provider handledProvider) {
+ this.provider = handledProvider;
showProviderDetails();
}
@@ -419,7 +420,7 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity
handleProviderSetupFailed(resultData);
break;
case CORRECTLY_DOWNLOADED_CERTIFICATE:
- handleCorrectlyDownloadedCertificate();
+ handleCorrectlyDownloadedCertificate(handledProvider);
break;
case INCORRECTLY_DOWNLOADED_CERTIFICATE:
handleIncorrectlyDownloadedCertificate();
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 ff7d011e..6cccdcd2 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
@@ -16,14 +16,16 @@
*/
package se.leap.bitmaskclient.eip;
-import com.google.gson.*;
+import com.google.gson.Gson;
-import org.json.*;
+import org.json.JSONException;
+import org.json.JSONObject;
-import java.io.*;
+import java.io.IOException;
+import java.io.StringReader;
-import de.blinkt.openvpn.*;
-import de.blinkt.openvpn.core.*;
+import de.blinkt.openvpn.VpnProfile;
+import de.blinkt.openvpn.core.ConfigParser;
/**
* Gateway provides objects defining gateways and their metadata.
@@ -37,7 +39,7 @@ public class Gateway {
public final static String TAG = Gateway.class.getSimpleName();
- private JSONObject general_configuration;
+ private JSONObject generalConfiguration;
private JSONObject secrets;
private JSONObject gateway;
@@ -54,7 +56,7 @@ public class Gateway {
this.gateway = gateway;
this.secrets = secrets;
- general_configuration = getGeneralConfiguration(eip_definition);
+ generalConfiguration = getGeneralConfiguration(eip_definition);
timezone = getTimezone(eip_definition);
mName = locationAsName(eip_definition);
@@ -80,9 +82,9 @@ public class Gateway {
return location.optString("name");
}
- private JSONObject getLocationInfo(JSONObject eip_definition) {
+ private JSONObject getLocationInfo(JSONObject eipDefinition) {
try {
- JSONObject locations = eip_definition.getJSONObject("locations");
+ JSONObject locations = eipDefinition.getJSONObject("locations");
return locations.getJSONObject(gateway.getString("location"));
} catch (JSONException e) {
@@ -97,8 +99,8 @@ public class Gateway {
try {
ConfigParser cp = new ConfigParser();
- VpnConfigGenerator vpn_configuration_generator = new VpnConfigGenerator(general_configuration, secrets, gateway);
- String configuration = vpn_configuration_generator.generate();
+ VpnConfigGenerator vpnConfigurationGenerator = new VpnConfigGenerator(generalConfiguration, secrets, gateway);
+ String configuration = vpnConfigurationGenerator.generate();
cp.parseConfig(new StringReader(configuration));
return cp.convertProfile();
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 0b330ed9..1bdb53ab 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -94,14 +94,14 @@ public class GatewaysManager {
return new Gson().toJson(gateways, list_type);
}
- public void fromEipServiceJson(JSONObject eip_definition) {
+ public void fromEipServiceJson(JSONObject eipDefinition) {
try {
- JSONArray gatewaysDefined = eip_definition.getJSONArray("gateways");
+ JSONArray gatewaysDefined = eipDefinition.getJSONArray("gateways");
for (int i = 0; i < gatewaysDefined.length(); i++) {
JSONObject gw = gatewaysDefined.getJSONObject(i);
if (isOpenVpnGateway(gw)) {
JSONObject secrets = secretsConfiguration();
- Gateway aux = new Gateway(eip_definition, secrets, gw);
+ Gateway aux = new Gateway(eipDefinition, secrets, gw);
if (!containsProfileWithSecrets(aux.getProfile())) {
addGateway(aux);
}