summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-12-31 16:51:56 +0100
committerParménides GV <parmegv@sdf.org>2014-12-31 16:51:56 +0100
commit8d7bedaa40129ae809f3e1261228b00042872f62 (patch)
tree022a867957c29f26f28638cc0db93ff5bb8b49c8 /app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
parent44b59b984f76da62d409b585047224cb1e958016 (diff)
Don't remove vpn profiles if possible.
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java25
1 files changed, 9 insertions, 16 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 3ee9443c..79239308 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
@@ -68,24 +68,8 @@ public class Gateway {
timezone = getTimezone(eip_definition);
mName = locationAsName(eip_definition);
- // Currently deletes VpnProfile for host, if there already is one, and builds new
- ProfileManager vpl = ProfileManager.getInstance(context);
- Collection<VpnProfile> profiles = vpl.getProfiles();
- for (Iterator<VpnProfile> it = profiles.iterator(); it.hasNext(); ){
- VpnProfile p = it.next();
-
- if ( p.mName.equalsIgnoreCase( mName ) ) {
- it.remove();
- vpl.removeProfile(context, p);
- }
- }
-
mVpnProfile = createVPNProfile();
mVpnProfile.mName = mName;
-
- vpl.addProfile(mVpnProfile);
- vpl.saveProfile(context, mVpnProfile);
- vpl.saveProfileList(context);
}
private JSONObject getGeneralConfiguration(JSONObject eip_definition) {
@@ -153,4 +137,13 @@ public class Gateway {
public int getTimezone() {
return timezone;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if(o instanceof Gateway) {
+ return ((Gateway) o).getProfile().mConnections.equals(mVpnProfile.mConnections);
+ }
+ else
+ return super.equals(o);
+ }
}