summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/base/models/Location.java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-07-30 18:22:12 +0200
committercyBerta <cyberta@riseup.net>2021-11-15 16:13:41 +0100
commit84d604de74d46c9d29d8d8ae20467c0320d2ffb3 (patch)
tree62e61755f30469272b15e2bed548044d71aefd53 /app/src/main/java/se/leap/bitmaskclient/base/models/Location.java
parent5c4c3cde26fafbd763e4a879dc46ca959b1a7d27 (diff)
show bridges icon in gateway selector for locations supporting them
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base/models/Location.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/models/Location.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/Location.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Location.java
index 8e032d18..3ec7d38c 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/models/Location.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Location.java
@@ -1,16 +1,37 @@
+/**
+ * Copyright (c) 2021 LEAP Encryption Access Project and contributers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
package se.leap.bitmaskclient.base.models;
import androidx.annotation.NonNull;
+import java.util.HashSet;
+import de.blinkt.openvpn.core.connection.Connection;
public class Location {
@NonNull public String name;
+ @NonNull public HashSet<Connection.TransportType> supportedTransports;
public double averageLoad;
public int numberOfGateways;
- public Location(@NonNull String name, double averageLoad, int numberOfGateways) {
+ public Location(@NonNull String name, double averageLoad, int numberOfGateways, @NonNull HashSet<Connection.TransportType> supportedTransports) {
this.name = name;
this.averageLoad = averageLoad;
this.numberOfGateways = numberOfGateways;
+ this.supportedTransports = supportedTransports;
}
@Override
@@ -22,7 +43,8 @@ public class Location {
if (Double.compare(location.averageLoad, averageLoad) != 0) return false;
if (numberOfGateways != location.numberOfGateways) return false;
- return name.equals(location.name);
+ if (!name.equals(location.name)) return false;
+ return supportedTransports.equals(location.supportedTransports);
}
@Override
@@ -30,6 +52,7 @@ public class Location {
int result;
long temp;
result = name.hashCode();
+ result = 31 * result + supportedTransports.hashCode();
temp = Double.doubleToLongBits(averageLoad);
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + numberOfGateways;