[tor-commits] [orbot/master] Fixes #549 snowflake preferences are greyed on when bridges are in use
n8fr8 at torproject.org
n8fr8 at torproject.org
Wed Dec 22 21:55:10 UTC 2021
commit 2cc79c18342a912549e9e054f1d0001917f4265f
Author: b <dsnake at protonmail.com>
Date: Fri Dec 10 00:41:17 2021 -0500
Fixes #549 snowflake preferences are greyed on when bridges are in use
also added string res for snowflake proxy category so it can be localized
---
app/src/main/res/values/strings.xml | 3 ++-
app/src/main/res/xml/preferences.xml | 2 +-
.../org/torproject/android/core/ui/SettingsPreferencesActivity.kt | 5 +++++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e1310d85..c3a43f01 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -251,9 +251,10 @@
<string name="in_a_browser">In a browser, visit %s and tap "Get Bridges" > "Just Give Me Bridges!"</string>
<string name="paste_bridges">Paste Bridges</string>
<string name="use_qr_code">Use QR Code</string>
+ <string name="snowflake_proxy_pref_category">Snowflake Proxy (Experimental)</string>
<string name="bridge_snowflake">Connect through other Tor peers (experimental)</string>
<string name="be_a_snowflake_title">Run Snowflake Proxy</string>
- <string name="be_a_snowflake_desc">Allow other Tor users to connect to Tor through your device</string>
+ <string name="be_a_snowflake_desc">Allow other Tor users to connect to Tor through your device. (This can\'t be used if you connect alongside bridges)</string>
<string name="be_a_snowflake_title_limit">Snowflake Proxy Limits</string>
<string name="be_a_snowflake_desc_limit">Only when device is plugged in and on wifi</string>
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index 28e06052..0b2eb525 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -291,7 +291,7 @@
android:title="@string/pref_disable_network_title" />
</PreferenceCategory>
- <PreferenceCategory android:title="Experimental">
+ <PreferenceCategory android:title="@string/snowflake_proxy_pref_category">
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_be_a_snowflake"
diff --git a/appcore/src/main/java/org/torproject/android/core/ui/SettingsPreferencesActivity.kt b/appcore/src/main/java/org/torproject/android/core/ui/SettingsPreferencesActivity.kt
index 8aa3af17..04dd6266 100644
--- a/appcore/src/main/java/org/torproject/android/core/ui/SettingsPreferencesActivity.kt
+++ b/appcore/src/main/java/org/torproject/android/core/ui/SettingsPreferencesActivity.kt
@@ -13,6 +13,7 @@ import org.torproject.android.core.LocaleHelper
class SettingsPreferencesActivity : PreferenceActivity() {
private var prefLocale: ListPreference? = null
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addPreferencesFromResource(intent.getIntExtra(BUNDLE_KEY_PREFERENCES_XML, 0))
@@ -30,6 +31,10 @@ class SettingsPreferencesActivity : PreferenceActivity() {
finish()
false
}
+
+ val bridgesEnabled = getSharedPreferences("org.torproject.android_preferences", MODE_MULTI_PROCESS).getBoolean("pref_bridges_enabled", false)
+ findPreference("pref_be_a_snowflake")?.isEnabled = !bridgesEnabled
+ findPreference("pref_be_a_snowflake_limit").isEnabled = !bridgesEnabled
}
override fun attachBaseContext(newBase: Context) = super.attachBaseContext(LocaleHelper.onAttach(newBase))
More information about the tor-commits
mailing list