From 65a09aa799e525d3bc60f5f4f489a3d70c6a8554 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 6 Jul 2019 17:37:48 +0200 Subject: get rid of ics-openvpn's ProfileManager, reduces boilerplate and dead code --- app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java') 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 317a91bd..55ade1ae 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java @@ -132,4 +132,18 @@ public class Gateway { public String toString() { return new Gson().toJson(this, Gateway.class); } + + @Override + public boolean equals(Object obj) { + return obj instanceof Gateway && + (this.mVpnProfile != null && + ((Gateway) obj).mVpnProfile != null && + this.mVpnProfile.mConnections != null && + ((Gateway) obj).mVpnProfile != null && + this.mVpnProfile.mConnections.length > 0 && + ((Gateway) obj).mVpnProfile.mConnections.length > 0 && + this.mVpnProfile.mConnections[0].mServerName != null && + this.mVpnProfile.mConnections[0].mServerName.equals(((Gateway) obj).mVpnProfile.mConnections[0].mServerName)) || + this.mVpnProfile == null && ((Gateway) obj).mVpnProfile == null; + } } -- cgit v1.2.3