summaryrefslogtreecommitdiff
path: root/app/src/main/java/se
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2022-06-11 01:16:39 +0200
committercyBerta <cyberta@riseup.net>2022-06-11 01:16:39 +0200
commitbf7fd8510e29687c9bce591dc40f03c1f5577875 (patch)
tree3d3d8820ec579efd9abd32e2f6ebf71f423a716d /app/src/main/java/se
parentc20478bfa2a07487b81f79c58fbe8a11f4b64bc1 (diff)
improve gateway pinning: continue parsing presorted gateway lists in debug builds, if no gateway was pinned
Diffstat (limited to 'app/src/main/java/se')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java12
1 files changed, 7 insertions, 5 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..d573e70c 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -420,9 +420,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 +431,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;
}
}