Skip to content
Snippets Groups Projects
Commit 75b9543f authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern: Committed by Richard Pospesel
Browse files

squash! Add Tor integration and UI

Bug 41394: Implement a setting to always prioritize Onion sites.
parent 9e21e4b0
Branches
Tags
1 merge request!162Draft: Rebase Fenix
......@@ -132,7 +132,8 @@ class Core(
R.color.fx_mobile_layer_color_1
),
httpsOnlyMode = context.settings().getHttpsOnlyMode(),
spoofEnglish = context.settings().spoofEnglish
spoofEnglish = context.settings().spoofEnglish,
prioritizeOnions = context.settings().prioritizeOnions
)
GeckoEngine(
......
......
......@@ -426,8 +426,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 =
......@@ -439,6 +441,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
......
......
......@@ -215,6 +215,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 = ""
......
......
......@@ -321,4 +321,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>
......@@ -67,4 +67,7 @@
<!-- 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>
</resources>
......@@ -119,6 +119,11 @@
app:iconSpaceReserved="false"
android:title="@string/preferences_tor_network_settings" />
<SwitchPreference
android:key="@string/pref_key_tor_prioritize_onions"
app:iconSpaceReserved="false"
android:title="@string/preferences_tor_prioritize_onions" />
<androidx.preference.Preference
android:key="@string/pref_key_tracking_protection_settings"
app:iconSpaceReserved="false"
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment