From bf7fd8510e29687c9bce591dc40f03c1f5577875 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 11 Jun 2022 01:16:39 +0200 Subject: improve gateway pinning: continue parsing presorted gateway lists in debug builds, if no gateway was pinned --- .../main/java/se/leap/bitmaskclient/eip/GatewaysManager.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'app/src') 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; } } -- cgit v1.2.3