summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2024-10-11 01:14:58 +0200
committercyberta <cyberta@riseup.net>2024-12-11 00:09:34 +0000
commite26a71fe5d755bbd598111fe01e6e805a2eab6fb (patch)
treee05a3c3d716dd6b25b7d602b1cbf1df7fc1ba0bd
parentbc02e3672cc639458feecdeb42a358c3b06abe12 (diff)
add setters and getters to attach bitmask-cores's gateway, bridges and provider model classes to the app's provider class
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java
index 15bc4b6f..8b15e785 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java
@@ -52,6 +52,11 @@ import java.util.Set;
import de.blinkt.openvpn.core.connection.Connection.TransportProtocol;
import de.blinkt.openvpn.core.connection.Connection.TransportType;
+import mobilemodels.Bridges;
+import mobilemodels.Gateways;
+import models.ModelsBridge;
+import models.ModelsEIPService;
+import models.ModelsProvider;
import motd.IStringCollection;
import motd.Motd;
@@ -73,6 +78,10 @@ public final class Provider implements Parcelable {
private String geoipUrl = "";
private String motdUrl = "";
private Gateways gateways = null;
+
+ private ModelsProvider modelsProvider = null;
+ private ModelsEIPService service = null;
+ private Bridges bridges = null;
private String domain = "";
private String providerIp = ""; // ip of the provider main url
private String providerApiIp = ""; // ip of the provider api url
@@ -184,6 +193,29 @@ public final class Provider implements Parcelable {
}
};
+ public void setBridges(Bridges bridges) {
+ this.bridges = bridges;
+ }
+
+ public Bridges getBridges() {
+ return this.bridges;
+ }
+ public void setGateways(Gateways gateways) {
+ this.gateways = gateways;
+ }
+
+ public Gateways getGateways() {
+ return gateways;
+ }
+
+ public void setService(ModelsEIPService service) {
+ this.service = service;
+ }
+
+ public ModelsEIPService getService() {
+ return this.service;
+ }
+
public boolean isConfigured() {
if (apiVersion < 5) {
return !mainUrl.isEmpty() &&
@@ -195,6 +227,9 @@ public final class Provider implements Parcelable {
hasPrivateKey();
} else {
return !mainUrl.isEmpty() &&
+ modelsProvider != null &&
+ service != null &&
+ gateways != null &&
hasVpnCertificate() &&
hasPrivateKey();
}
@@ -418,6 +453,10 @@ public final class Provider implements Parcelable {
&& !getEipServiceJson().has(ERRORS);
}
+ public boolean hasServiceInfo() {
+ return service != null;
+ }
+
public boolean hasGatewaysInDifferentLocations() {
try {
return getEipServiceJson().getJSONObject(LOCATIONS).length() > 1;
@@ -799,4 +838,8 @@ public final class Provider implements Parcelable {
lastGeoIpUpdate = 0L;
lastEipServiceUpdate = 0L;
}
+
+ public void setModelsProvider(ModelsProvider p) {
+ this.modelsProvider = p;
+ }
}