From 8d7bedaa40129ae809f3e1261228b00042872f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Wed, 31 Dec 2014 16:51:56 +0100 Subject: Don't remove vpn profiles if possible. --- .../test/testConfigurationWizard.java | 2 +- .../test/testDashboardIntegration.java | 13 ++++++++++ .../main/java/se/leap/bitmaskclient/Dashboard.java | 4 +++- .../java/se/leap/bitmaskclient/EipFragment.java | 17 +++++-------- .../java/se/leap/bitmaskclient/OnBootReceiver.java | 28 ++++++++++++---------- .../main/java/se/leap/bitmaskclient/eip/EIP.java | 20 ++++++++++------ .../java/se/leap/bitmaskclient/eip/Gateway.java | 25 +++++++------------ .../se/leap/bitmaskclient/ConfigurationWizard.java | 12 +++++----- 8 files changed, 67 insertions(+), 54 deletions(-) diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java index 229c3452..78ce1c81 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java @@ -49,7 +49,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2 profiles = vpl.getProfiles(); - for (Iterator 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); + } } diff --git a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java index 3d9bb7b1..af8a5d46 100644 --- a/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/app/src/release/java/se/leap/bitmaskclient/ConfigurationWizard.java @@ -58,16 +58,16 @@ implements NewProviderDialogInterface, ProviderDetailFragmentInterface, Download @Inject ProviderListAdapter adapter; private ProviderManager provider_manager; - private Intent mConfigState = new Intent(); + private Intent mConfigState = new Intent(); private Provider selected_provider; final public static String TAG = ConfigurationWizard.class.getSimpleName(); - final public static String TYPE_OF_CERTIFICATE = "type_of_certificate"; - final public static String ANON_CERTIFICATE = "anon_certificate"; - final public static String AUTHED_CERTIFICATE = "authed_certificate"; + final public static String TYPE_OF_CERTIFICATE = "type_of_certificate"; + final public static String ANON_CERTIFICATE = "anon_certificate"; + final public static String AUTHED_CERTIFICATE = "authed_certificate"; - final protected static String PROVIDER_SET = "PROVIDER SET"; - final protected static String SERVICES_RETRIEVED = "SERVICES RETRIEVED"; + final protected static String PROVIDER_SET = "PROVIDER SET"; + final protected static String SERVICES_RETRIEVED = "SERVICES RETRIEVED"; final protected static String ASSETS_URL_FOLDER = "urls"; final private static String PROGRESSBAR_TEXT = TAG + "PROGRESSBAR_TEXT"; -- cgit v1.2.3