summaryrefslogtreecommitdiff
path: root/app/src/main/java/se
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2017-10-13 11:34:42 +0000
committercyberta <cyberta@riseup.net>2017-10-13 11:34:42 +0000
commitef91d9235cccbd4dcd9e120c8fff910e0d448022 (patch)
tree88b00bcb87c116190e45f1045c22952fb0ee4991 /app/src/main/java/se
parentef98b18734c25da77abe4f0067635cf795218c65 (diff)
parent97ff21c74619269a8c7dc9d8ff1485200db58d8c (diff)
Merge branch '8758_switch_providers' into 'master'
#8758 fix switching providers See merge request leap/bitmask_android!11
Diffstat (limited to 'app/src/main/java/se')
-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
2 files changed, 9 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 428ac706..73c7337b 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
@@ -168,6 +168,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) {