diff options
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/EIP.java | 1 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java | 11 |
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) { |