diff options
| author | cyBerta <cyberta@riseup.net> | 2025-04-12 13:09:10 +0200 |
|---|---|---|
| committer | cyBerta <cyberta@riseup.net> | 2025-04-12 13:09:10 +0200 |
| commit | 36b90a089af1c4fcc71d3a850089879fe797b305 (patch) | |
| tree | 4b988b889654a62e1f9aea449fb94c4908419751 /app/src/main/java/se | |
| parent | 3e2850f8339b8dd9b9acc01e9662adbdc3f05234 (diff) | |
GatewaySelectionFragment: show reset bridges hint only if the provider supports connecting without them
Diffstat (limited to 'app/src/main/java/se')
| -rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java | 7 | ||||
| -rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java | 9 |
2 files changed, 12 insertions, 4 deletions
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) { |
