diff options
author | Norbel AMBANUMBEN <aanorbel@gmail.com> | 2024-10-22 21:08:10 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2024-11-28 22:53:30 +0100 |
commit | 7e72d95516f375ab55e24659dd7f21948fe87070 (patch) | |
tree | 974718b10c05bae9a740fe5a0e00f47f96ea3857 /app/src/main | |
parent | 7aeea7e4a157f6c54bf469fda3307f781bd6e188 (diff) |
chore: disable bridges when UDP is enabled.
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java | 3 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java | 16 |
2 files changed, 16 insertions, 3 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java index 9351756d..ca27f8e9 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java @@ -1,6 +1,5 @@ package se.leap.bitmaskclient.base.fragments; -import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getObfuscationPinningKCP; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseObfs4; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseObfs4Kcp; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUsePortHopping; @@ -102,7 +101,7 @@ public class CensorshipCircumventionFragment extends Fragment { private void initTunneling() { RadioButton noneRadioButton = new RadioButton(binding.getRoot().getContext()); noneRadioButton.setText(getText(R.string.none)); - noneRadioButton.setChecked(!getUseObfs4() && !getObfuscationPinningKCP()); + noneRadioButton.setChecked(!getUseObfs4() && !getUseObfs4Kcp()); noneRadioButton.setId(TUNNELING_NONE); binding.tunnelingRadioGroup.addView(noneRadioButton); diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java index d0fa3aa4..1a9fd809 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java @@ -115,6 +115,13 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh Toast.makeText(getContext(), R.string.reconnecting, Toast.LENGTH_LONG).show(); } }); + + //We check the UI state of the useUdpEntry here as well, in order to avoid a situation + //where both entries are disabled, because both preferences are enabled. + //bridges can be enabled not only from here but also from error handling + boolean useUDP = getPreferUDP() && useUdpEntry.isEnabled(); + automaticCircumvention.setEnabled(!useUDP); + automaticCircumvention.setSubtitle(getString(useUDP?R.string.disabled_while_udp_on:R.string.automatic_bridge_description)); } else { automaticCircumvention.setVisibility(GONE); } @@ -131,6 +138,13 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh openManualConfigurationFragment(); }); manualConfiguration.setOnClickListener((buttonView) -> openManualConfigurationFragment()); + + //We check the UI state of the useUdpEntry here as well, in order to avoid a situation + //where both entries are disabled, because both preferences are enabled. + //bridges can be enabled not only from here but also from error handling + boolean useUDP = getPreferUDP() && useUdpEntry.isEnabled(); + manualConfiguration.setEnabled(!useUDP); + manualConfiguration.setSubtitle(getString(useUDP? R.string.disabled_while_udp_on:R.string.manual_bridge_description)); } private void openManualConfigurationFragment() { @@ -362,9 +376,9 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh return; } if (key.equals(USE_BRIDGES) || key.equals(PREFER_UDP)) { - //initUseBridgesEntry(rootView); initPreferUDPEntry(rootView); initManualCircumventionEntry(rootView); + initAutomaticCircumventionEntry(rootView); } else if (key.equals(USE_IPv6_FIREWALL)) { initFirewallEntry(getView()); } else if (key.equals(GATEWAY_PINNING)) { |