summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2025-02-03 16:11:18 +0100
committercyBerta <cyberta@riseup.net>2025-02-03 16:21:57 +0100
commit447cfa0ce606257b5c976ca8cc8cd8656211b9c9 (patch)
tree29a9c11334e395706df173fcba19e8e90bc7fb83
parentc5ee72fb3181df7cff17bed335acf1bcd983997b (diff)
deduplicate code and improve intialization of discovery settings in circumvention settings screen
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/CensorshipCircumventionFragment.java7
1 files changed, 4 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 888a6f6f..e8789b32 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
@@ -69,19 +69,20 @@ public class CensorshipCircumventionFragment extends Fragment {
private void initDiscovery() {
+ boolean hasIntroducer = ProviderObservable.getInstance().getCurrentProvider().hasIntroducer();
RadioButton automaticallyRadioButton = new RadioButton(binding.getRoot().getContext());
automaticallyRadioButton.setText(getText(R.string.automatically_select));
automaticallyRadioButton.setId(DISCOVERY_AUTOMATICALLY);
- automaticallyRadioButton.setChecked(!(hasSnowflakePrefs() && getUseSnowflake()) && !ProviderObservable.getInstance().getCurrentProvider().hasIntroducer());
+ automaticallyRadioButton.setChecked(!hasSnowflakePrefs() && !hasIntroducer);
binding.discoveryRadioGroup.addView(automaticallyRadioButton);
RadioButton snowflakeRadioButton = new RadioButton(binding.getRoot().getContext());
snowflakeRadioButton.setText(getText(R.string.snowflake));
snowflakeRadioButton.setId(DISCOVERY_SNOWFLAKE);
- snowflakeRadioButton.setChecked(hasSnowflakePrefs() && getUseSnowflake());
+ snowflakeRadioButton.setChecked(!hasIntroducer && hasSnowflakePrefs() && getUseSnowflake());
binding.discoveryRadioGroup.addView(snowflakeRadioButton);
- if (ProviderObservable.getInstance().getCurrentProvider().hasIntroducer()) {
+ if (hasIntroducer) {
RadioButton inviteProxyRadioButton = new RadioButton(binding.getRoot().getContext());
inviteProxyRadioButton.setText(getText(R.string.invite_proxy));
inviteProxyRadioButton.setId(DISCOVERY_INVITE_PROXY);