diff options
author | cyBerta <cyberta@riseup.net> | 2024-11-15 01:28:03 +0100 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2024-12-11 00:09:34 +0000 |
commit | 82943aabda399bd983968b2bde51c6ab3cb063b5 (patch) | |
tree | e4f479acc21afbf06ef16a9f12d704ffefdb8208 /app/src/main/java/se | |
parent | e51cb3c7809d87e7e7b0e7513068b7b46a741b42 (diff) |
fix getDomain() implementation in Provider after api v5 integration
Diffstat (limited to 'app/src/main/java/se')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/models/Provider.java | 16 |
1 files changed, 9 insertions, 7 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 ff9c48c0..17b200f2 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 @@ -94,7 +94,7 @@ public final class Provider implements Parcelable { private String certificatePin = ""; private String certificatePinEncoding = ""; private String caCert = ""; - private int apiVersion = 5; + private int apiVersion = 3; private int[] apiVersions = new int[0]; private String privateKeyString = ""; private transient PrivateKey privateKey = null; @@ -141,16 +141,19 @@ public final class Provider implements Parcelable { public Provider(String mainUrl) { this(mainUrl, null); + domain = getHostFromUrl(mainUrl); } public Provider(String mainUrl, String geoipUrl) { setMainUrl(mainUrl); setGeoipUrl(geoipUrl); + domain = getHostFromUrl(mainUrl); } public static Provider createCustomProvider(String mainUrl, String domain, Introducer introducer) { Provider p = new Provider(mainUrl); p.domain = domain; + p.introducer = introducer; return p; } @@ -428,15 +431,14 @@ public final class Provider implements Parcelable { } public String getDomain() { + if ((apiVersion < 5 && (domain == null || domain.isEmpty())) || + (modelsProvider == null)) { + return getHostFromUrl(mainUrl); + } if (apiVersion < 5) { return domain; } - try { - return modelsProvider.getDomain(); - } catch (NullPointerException ignore) { - return ""; - } - + return modelsProvider.getDomain(); } public String getMainUrl() { |