diff options
author | cyBerta <cyberta@riseup.net> | 2019-10-19 01:28:19 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2019-10-19 01:28:19 +0200 |
commit | 561eb26edf5e23aaa4da1770d69c04a7614eb3ab (patch) | |
tree | 52a4011a98323630c9398887ee6c3bc4bc32ba9d /app | |
parent | 5af21a8d45f54eec039ffa08386d02f91c16b6e5 (diff) |
VpnProfiles are equal if they have the same ip and transport
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/VpnProfile.java | 9 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/VpnProfile.java b/app/src/main/java/de/blinkt/openvpn/VpnProfile.java index f139fdc9..50362085 100644 --- a/app/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/app/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -70,6 +70,7 @@ import se.leap.bitmaskclient.R; import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4; import static se.leap.bitmaskclient.Constants.PROVIDER_PROFILE; +import static se.leap.bitmaskclient.utils.ConfigHelper.stringEqual; public class VpnProfile implements Serializable, Cloneable { // Note that this class cannot be moved to core where it belongs since @@ -259,11 +260,11 @@ public class VpnProfile implements Serializable, Cloneable { @Override public boolean equals(Object obj) { if (obj instanceof VpnProfile) { - VpnProfile vpnProfile = (VpnProfile) obj; - return mUuid.equals(vpnProfile.mUuid); - } else { - return false; + VpnProfile vp = (VpnProfile) obj; + return stringEqual(vp.mGatewayIp, mGatewayIp) && + vp.mUsePluggableTransports == mUsePluggableTransports; } + return false; } public void clearDefaults() { diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java index d0c0ce0c..ca76a799 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/ConfigHelper.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.Resources; import android.os.Looper; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.support.annotation.StringRes; import org.json.JSONException; @@ -186,4 +187,9 @@ public class ConfigHelper { String appName = resources.getString(R.string.app_name); return resources.getString(resourceId, appName); } + + public static boolean stringEqual(@Nullable String string1, @Nullable String string2) { + return (string1 == null && string2 == null) || + (string1 != null && string1.equals(string2)); + } } |