diff options
author | Norbel AMBANUMBEN <aanorbel@gmail.com> | 2024-10-16 00:26:04 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2024-11-28 22:53:30 +0100 |
commit | fe8fc4da464ab0daf2f36513222099075d3635f5 (patch) | |
tree | 3c1060c92de00e424e59156d144b021a582efb3d /app/src | |
parent | 9b062bf2f2a3a7c07e667410c12e56a09f5a9232 (diff) |
updated settings
Diffstat (limited to 'app/src')
4 files changed, 30 insertions, 18 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 269286cd..ed64ab00 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 @@ -2,11 +2,13 @@ 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; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseSnowflake; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.hasSnowflakePrefs; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setObfuscationPinningKCP; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setUseObfs4; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setUseObfs4Kcp; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setUsePortHopping; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useSnowflake; import static se.leap.bitmaskclient.base.utils.ViewHelper.setActionBarSubtitle; @@ -72,13 +74,11 @@ public class CensorshipCircumventionFragment extends Fragment { noneRadioButton.setChecked(!(hasSnowflakePrefs() && getUseSnowflake()) && !ProviderObservable.getInstance().getCurrentProvider().hasIntroducer()); binding.discoveryRadioGroup.addView(noneRadioButton); - if (hasSnowflakePrefs()) { - RadioButton snowflakeRadioButton = new RadioButton(binding.getRoot().getContext()); - snowflakeRadioButton.setText(getText(R.string.snowflake)); - snowflakeRadioButton.setId(DISCOVERY_SNOWFLAKE); - snowflakeRadioButton.setChecked(hasSnowflakePrefs() && getUseSnowflake()); - binding.discoveryRadioGroup.addView(snowflakeRadioButton); - } + RadioButton snowflakeRadioButton = new RadioButton(binding.getRoot().getContext()); + snowflakeRadioButton.setText(getText(R.string.snowflake)); + snowflakeRadioButton.setId(DISCOVERY_SNOWFLAKE); + snowflakeRadioButton.setChecked(hasSnowflakePrefs() && getUseSnowflake()); + binding.discoveryRadioGroup.addView(snowflakeRadioButton); if (ProviderObservable.getInstance().getCurrentProvider().hasIntroducer()){ RadioButton inviteProxyRadioButton = new RadioButton(binding.getRoot().getContext()); @@ -116,19 +116,19 @@ public class CensorshipCircumventionFragment extends Fragment { RadioButton obfs4KcpRadioButton = new RadioButton(binding.getRoot().getContext()); obfs4KcpRadioButton.setText(getText(R.string.tunnelling_obfs4_kcp)); obfs4KcpRadioButton.setId(TUNNELING_OBFS4_KCP); - obfs4KcpRadioButton.setChecked(getObfuscationPinningKCP()); + obfs4KcpRadioButton.setChecked(getUseObfs4Kcp()); binding.tunnelingRadioGroup.addView(obfs4KcpRadioButton); } binding.tunnelingRadioGroup.setOnCheckedChangeListener((group, checkedId) -> { if (checkedId == TUNNELING_NONE) { - setObfuscationPinningKCP(false); + setUseObfs4Kcp(false); setUseObfs4(false); } else if (checkedId == TUNNELING_OBFS4) { - setObfuscationPinningKCP(false); + setUseObfs4Kcp(false); setUseObfs4(true); } else if (checkedId == TUNNELING_OBFS4_KCP) { - setObfuscationPinningKCP(true); + setUseObfs4Kcp(true); setUseObfs4(false); } 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 1a63e145..52b2cc5e 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 @@ -22,10 +22,12 @@ import static se.leap.bitmaskclient.base.utils.PreferenceHelper.hasSnowflakePref import static se.leap.bitmaskclient.base.utils.PreferenceHelper.preferUDP; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setAllowExperimentalTransports; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setUseObfs4; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setUseObfs4Kcp; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setUseObfuscationPinning; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setUsePortHopping; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useBridges; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useObfuscationPinning; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.usesManualBridges; import static se.leap.bitmaskclient.base.utils.ViewHelper.setActionBarSubtitle; import android.app.AlertDialog; @@ -96,14 +98,14 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh private void initAutomaticCircumventionEntry(View rootView) { IconSwitchEntry automaticCircumvention = rootView.findViewById(R.id.bridge_automatic_switch); - automaticCircumvention.setChecked(!hasManualCircumventionConfig()); + automaticCircumvention.setChecked(!usesManualBridges()); automaticCircumvention.setOnCheckedChangeListener((buttonView, isChecked) -> { if (!buttonView.isPressed()) { return; } if (isChecked){ useBridges(false); - setUseObfuscationPinning(false); + setUseObfs4Kcp(false); setUseObfs4(false); setUsePortHopping(false); } @@ -112,7 +114,7 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh private void initManualCircumventionEntry(View rootView) { IconSwitchEntry manualConfiguration = rootView.findViewById(R.id.bridge_manual_switch); - manualConfiguration.setChecked(hasManualCircumventionConfig()); + manualConfiguration.setChecked(usesManualBridges()); manualConfiguration.setOnCheckedChangeListener((buttonView, isChecked) -> { if (!buttonView.isPressed()) { return; @@ -128,10 +130,6 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh fragmentManager.replace(R.id.main_container, fragment, MainActivity.TAG); } - private boolean hasManualCircumventionConfig() { - return getUseSnowflake() || getUseObfs4() || getObfuscationPinningKCP() || getUsePortHopping(); - } - @Override public void onDestroy() { PreferenceHelper.unregisterOnSharedPreferenceChangeListener(this); diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java index 535cd474..c24feda5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java @@ -56,6 +56,7 @@ public interface Constants { String CUSTOM_PROVIDER_DOMAINS = "custom_provider_domains"; String USE_PORT_HOPPING = "use_port_hopping"; String USE_OBSF4 = "use_obsf4"; + String USE_OBSF4_KCP = "use_obsf4_kcp"; ////////////////////////////////////////////// diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java index 1f7b2597..407976c3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java @@ -41,6 +41,7 @@ import static se.leap.bitmaskclient.base.models.Constants.USE_BRIDGES; import static se.leap.bitmaskclient.base.models.Constants.USE_IPv6_FIREWALL; import static se.leap.bitmaskclient.base.models.Constants.USE_OBFUSCATION_PINNING; import static se.leap.bitmaskclient.base.models.Constants.USE_OBSF4; +import static se.leap.bitmaskclient.base.models.Constants.USE_OBSF4_KCP; import static se.leap.bitmaskclient.base.models.Constants.USE_PORT_HOPPING; import static se.leap.bitmaskclient.base.models.Constants.USE_SNOWFLAKE; import static se.leap.bitmaskclient.base.models.Constants.USE_SYSTEM_PROXY; @@ -582,6 +583,18 @@ public class PreferenceHelper { putBoolean(USE_OBSF4, useObsf4); } + public static void setUseObfs4Kcp(boolean useObfs4Kcp) { + putBoolean(USE_OBSF4_KCP, useObfs4Kcp); + } + + public static boolean getUseObfs4Kcp() { + return getBoolean(USE_OBSF4_KCP, false); + } + + public static boolean usesManualBridges(){ + return getUseSnowflake() || getUseObfs4() || getUseObfs4Kcp() || getUsePortHopping(); + } + public static boolean useIpv6Firewall() { return getBoolean(USE_IPv6_FIREWALL, false); } |