Pier Angelo Vendrame pushed to branch tor-browser-102.2.1-12.0-1 at The Tor Project / Applications / fenix
Commits: e1146f6e by Pier Angelo Vendrame at 2022-10-27T15:21:36+00:00 squash! Add Tor integration and UI
Bug 41394: Implement a setting to always prioritize Onion sites.
- - - - -
6 changed files:
- app/src/main/java/org/mozilla/fenix/components/Core.kt - app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt - app/src/main/java/org/mozilla/fenix/utils/Settings.kt - app/src/main/res/values/preference_keys.xml - app/src/main/res/values/torbrowser_strings.xml - app/src/main/res/xml/preferences.xml
Changes:
===================================== app/src/main/java/org/mozilla/fenix/components/Core.kt ===================================== @@ -133,7 +133,8 @@ class Core( ), httpsOnlyMode = context.settings().getHttpsOnlyMode(), torSecurityLevel = context.settings().torSecurityLevel().intRepresentation, - spoofEnglish = context.settings().spoofEnglish + spoofEnglish = context.settings().spoofEnglish, + prioritizeOnions = context.settings().prioritizeOnions )
GeckoEngine(
===================================== app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt ===================================== @@ -429,8 +429,10 @@ class SettingsFragment : PreferenceFragmentCompat() { }
private fun setupPreferences() { + val prioritizeOnionsKey = getPreferenceKey(R.string.pref_key_tor_prioritize_onions) val leakKey = getPreferenceKey(R.string.pref_key_leakcanary) val debuggingKey = getPreferenceKey(R.string.pref_key_remote_debugging) + val preferencePrioritizeOnions = findPreference<Preference>(prioritizeOnionsKey) val preferenceLeakCanary = findPreference<Preference>(leakKey) val preferenceRemoteDebugging = findPreference<Preference>(debuggingKey) val preferenceMakeDefaultBrowser = @@ -442,6 +444,11 @@ class SettingsFragment : PreferenceFragmentCompat() { onPreferenceChangeListener = SharedPreferenceUpdater() }
+ preferencePrioritizeOnions?.setOnPreferenceChangeListener<Boolean> { preference, newValue -> + preference.context.components.core.engine.settings.prioritizeOnions = newValue + true + } + if (!Config.channel.isReleased) { preferenceLeakCanary?.setOnPreferenceChangeListener { _, newValue -> val isEnabled = newValue == true
===================================== app/src/main/java/org/mozilla/fenix/utils/Settings.kt ===================================== @@ -243,6 +243,11 @@ class Settings(private val appContext: Context) : PreferencesHolder { default = false )
+ var prioritizeOnions by booleanPreference( + appContext.getPreferenceKey(R.string.pref_key_tor_prioritize_onions), + default = false + ) + var defaultSearchEngineName by stringPreference( appContext.getPreferenceKey(R.string.pref_key_search_engine), default = ""
===================================== app/src/main/res/values/preference_keys.xml ===================================== @@ -323,4 +323,6 @@ <string name="pref_key_tor_network_settings_bridges_enabled">pref_key_tor_network_settings_bridges_enabled</string>
<string name="pref_key_spoof_english" translatable="false">pref_key_spoof_english</string> + + <string name="pref_key_tor_prioritize_onions" translatable="false">pref_key_tor_prioritize_onions</string> </resources>
===================================== app/src/main/res/values/torbrowser_strings.xml ===================================== @@ -73,6 +73,9 @@ <!-- Spoof locale to English --> <string name="tor_spoof_english">Request English versions of web pages for enhanced privacy</string>
+ <!-- Onion location --> + <string name="preferences_tor_prioritize_onions">Prioritize .onion sites</string> + <!-- YEC 2022 campaign https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/41303 -->
<!-- LOCALIZATION NOTE (yec2022_powered_by_privacy): a header for a list of things which are powered by/enabled by/possible due to privacy (each item should have positive connotations/associations in the translated languages) -->
===================================== app/src/main/res/xml/preferences.xml ===================================== @@ -124,6 +124,11 @@ android:key="@string/pref_key_tor_network_settings" android:title="@string/preferences_tor_network_settings" />
+ <SwitchPreference + app:iconSpaceReserved="false" + android:key="@string/pref_key_tor_prioritize_onions" + android:title="@string/preferences_tor_prioritize_onions" /> + <androidx.preference.Preference android:key="@string/pref_key_tracking_protection_settings" app:iconSpaceReserved="false"
View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/commit/e1146f6e2b5696...