summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2022-06-11 01:05:49 +0000
committercyberta <cyberta@riseup.net>2022-06-11 01:05:49 +0000
commit161cca62ed1f5d23ce9fb6a5e49b1a3ec66e1450 (patch)
tree0d3d5600090d5ca0aff446b6340bccfae2d8ed5b /app/src
parentc20478bfa2a07487b81f79c58fbe8a11f4b64bc1 (diff)
parent899c19a87260a708d11e095083077daf42fa5c37 (diff)
Merge branch 'gateway_pinning_improvement' into 'master'
Debug improvements See merge request leap/bitmask_android!194
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
index 7fc810cc..a11c7e34 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -339,9 +339,11 @@ public class GatewaysManager {
if (gateways.get(aux.getHost()) == null) {
addGateway(aux);
}
- } catch (JSONException | ConfigParser.ConfigParseError | IOException e) {
+ } catch (JSONException | IOException e) {
e.printStackTrace();
VpnStatus.logError("Unable to parse gateway config!");
+ } catch (ConfigParser.ConfigParseError e) {
+ VpnStatus.logError("Unable to parse gateway config: " + e.getLocalizedMessage());
}
}
} catch (NullPointerException npe) {
@@ -420,9 +422,10 @@ public class GatewaysManager {
private void configureFromCurrentProvider() {
Provider provider = ProviderObservable.getInstance().getCurrentProvider();
parseDefaultGateways(provider);
- if (BuildConfig.BUILD_TYPE.equals("debug")) {
- keepOnlyPinnedGateway();
- } else if (hasSortedGatewaysWithLoad(provider)) {
+ if (BuildConfig.BUILD_TYPE.equals("debug") && handleGatewayPinning()) {
+ return;
+ }
+ if (hasSortedGatewaysWithLoad(provider)) {
parseGatewaysWithLoad(provider);
} else {
parseSimpleGatewayList(provider);
@@ -430,16 +433,17 @@ public class GatewaysManager {
}
- private void keepOnlyPinnedGateway() {
+ private boolean handleGatewayPinning() {
String host = PreferenceHelper.getPinnedGateway(this.context);
if (host == null) {
- return;
+ return false;
}
Gateway gateway = gateways.get(host);
gateways.clear();
if (gateway != null) {
gateways.put(host, gateway);
}
+ return true;
}
}