summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2017-10-09 15:22:23 +0200
committercyBerta <cyberta@riseup.net>2017-10-09 15:22:23 +0200
commit97ff21c74619269a8c7dc9d8ff1485200db58d8c (patch)
tree22a9301b1c961478c4ed7b3a71b8bcd283aa5e3c /app/src/main/java
parentadc6f7672c380d534fc963d868fe5aebcab54b4a (diff)
#8758 fix switching providers
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EIP.java1
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java11
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java2
3 files changed, 10 insertions, 4 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 5b72a4e7..eb83814a 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
@@ -170,6 +170,7 @@ public final class EIP extends IntentService {
}
private void updateGateways() {
+ gateways_manager.clearGatewaysAndProfiles();
gateways_manager.fromEipServiceJson(eip_definition);
gatewaysToPreferences();
}
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 f41049c5..6a7e3d0b 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -143,15 +143,20 @@ public class GatewaysManager {
return result;
}
+ protected void clearGatewaysAndProfiles() {
+ gateways.clear();
+ ArrayList<VpnProfile> profiles = new ArrayList<>(profile_manager.getProfiles());
+ for (VpnProfile profile : profiles) {
+ profile_manager.removeProfile(context, profile);
+ }
+ }
+
private void addGateway(Gateway gateway) {
removeDuplicatedGateway(gateway);
-
gateways.add(gateway);
VpnProfile profile = gateway.getProfile();
profile_manager.addProfile(profile);
- //profile_manager.saveProfile(context, profile);
- //profile_manager.saveProfileList(context);
}
private void removeDuplicatedGateway(Gateway gateway) {
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
index 0b9c5832..10a95dfb 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
@@ -56,7 +56,7 @@ public class VpnConfigGenerator {
String key = keys.next().toString();
common_options += key + " ";
- for (String word : general_configuration.getString(key).split(" "))
+ for (String word : String.valueOf(general_configuration.get(key)).split(" "))
common_options += word + " ";
common_options += new_line;