From 36b90a089af1c4fcc71d3a850089879fe797b305 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 12 Apr 2025 13:09:10 +0200 Subject: GatewaySelectionFragment: show reset bridges hint only if the provider supports connecting without them --- .../bitmaskclient/base/fragments/GatewaySelectionFragment.java | 7 +++---- app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java | 9 +++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java index bb5a06c4..c22317a1 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java @@ -48,8 +48,6 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.ref.WeakReference; import java.util.List; -import java.util.Observable; -import java.util.Observer; import de.blinkt.openvpn.core.VpnStatus; import de.blinkt.openvpn.core.connection.Connection; @@ -144,10 +142,11 @@ public class GatewaySelectionFragment extends Fragment implements PropertyChange } private void initBridgesHint(@NonNull View view) { + boolean allowResettingBridges = getUseBridges() && gatewaysManager.hasLocationsForOpenVPN(); bridgesHint = view.findViewById(R.id.manual_subtitle); - bridgesHint.setVisibility(getUseBridges() ? VISIBLE : GONE); + bridgesHint.setVisibility(allowResettingBridges ? VISIBLE : GONE); disableBridges = view.findViewById(R.id.disable_bridges); - disableBridges.setVisibility(getUseBridges() ? VISIBLE : GONE); + disableBridges.setVisibility(allowResettingBridges ? VISIBLE : GONE); disableBridges.setOnClickListener(v -> { useBridges(false); }); 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 16f12e02..b207fb14 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java @@ -314,6 +314,15 @@ public class GatewaysManager { return null; } + public boolean hasLocationsForOpenVPN() { + for (Gateway gateway : gateways.values()) { + if (gateway.supportsTransport(OPENVPN, null)) { + return true; + } + } + return false; + } + public Load getLoadForLocation(@Nullable String name, TransportType transportType) { Location location = getLocation(name); if (location == null) { -- cgit v1.2.3