Commit e1146f6e authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

squash! Add Tor integration and UI

Bug 41394: Implement a setting to always prioritize Onion sites.
parent fadbafad
Loading
Loading
Loading
Loading
+2 −1
Changes for app/src/main/java/org/mozilla/fenix/components/Core.kt: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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(
+7 −0
Changes for app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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
+5 −0
Changes for app/src/main/java/org/mozilla/fenix/utils/Settings.kt: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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 = ""
+2 −0
Changes for app/src/main/res/values/preference_keys.xml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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>
+3 −0
Changes for app/src/main/res/values/torbrowser_strings.xml: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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) -->
Loading