Dan Ballard pushed to branch firefox-android-115.2.1-13.5-1 at The Tor Project / Applications / firefox-android
Commits:
- 
110d8f18
by clairehurst at 2024-05-15T19:04:04+00:00
4 changed files:
- fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt
- fenix/app/src/main/java/org/mozilla/fenix/settings/TorSecurityLevelFragment.kt
- fenix/app/src/main/res/navigation/nav_graph.xml
- fenix/app/src/main/res/xml/preferences.xml
Changes:
| ... | ... | @@ -65,6 +65,7 @@ import org.mozilla.fenix.nimbus.FxNimbus | 
| 65 | 65 |  import org.mozilla.fenix.perf.ProfilerViewModel
 | 
| 66 | 66 |  import org.mozilla.fenix.settings.account.AccountUiView
 | 
| 67 | 67 |  import org.mozilla.fenix.tor.QuickStartPreference
 | 
| 68 | +import org.mozilla.fenix.tor.SecurityLevel
 | |
| 68 | 69 |  import org.mozilla.fenix.tor.TorBridgeTransportConfig
 | 
| 69 | 70 |  import org.mozilla.fenix.tor.TorEvents
 | 
| 70 | 71 |  import org.mozilla.fenix.utils.Settings
 | 
| ... | ... | @@ -537,6 +538,7 @@ class SettingsFragment : PreferenceFragmentCompat() { | 
| 537 | 538 |          setupAmoCollectionOverridePreference(requireContext().settings())
 | 
| 538 | 539 |          setupGeckoLogsPreference(requireContext().settings())
 | 
| 539 | 540 |          setupAllowDomesticChinaFxaServerPreference()
 | 
| 541 | +        setupSecurityLevelPreference()
 | |
| 540 | 542 |          setupHttpsOnlyPreferences()
 | 
| 541 | 543 |          setupNotificationPreference()
 | 
| 542 | 544 |          setupSearchPreference()
 | 
| ... | ... | @@ -772,6 +774,19 @@ class SettingsFragment : PreferenceFragmentCompat() { | 
| 772 | 774 |          }
 | 
| 773 | 775 |      }
 | 
| 774 | 776 | |
| 777 | +    @VisibleForTesting
 | |
| 778 | +    internal fun setupSecurityLevelPreference() {
 | |
| 779 | +        val securityLevelPreference =
 | |
| 780 | +            requirePreference<Preference>(R.string.pref_key_tor_security_level_settings)
 | |
| 781 | +        securityLevelPreference.summary = context?.settings()?.torSecurityLevel()?.let {
 | |
| 782 | +            when (it) {
 | |
| 783 | +                SecurityLevel.STANDARD -> getString(R.string.tor_security_level_standard_option)
 | |
| 784 | +                SecurityLevel.SAFER -> getString(R.string.tor_security_level_safer_option)
 | |
| 785 | +                SecurityLevel.SAFEST -> getString(R.string.tor_security_level_safest_option)
 | |
| 786 | +            }
 | |
| 787 | +        }
 | |
| 788 | +    }
 | |
| 789 | + | |
| 775 | 790 |      @VisibleForTesting
 | 
| 776 | 791 |      internal fun setupHttpsOnlyPreferences() {
 | 
| 777 | 792 |          val httpsOnlyPreference =
 | 
| ... | ... | @@ -24,11 +24,6 @@ class TorSecurityLevelFragment : PreferenceFragmentCompat() { | 
| 24 | 24 |      private val securityLevelRadioGroups = mutableListOf<GroupableRadioButton>()
 | 
| 25 | 25 |      private var previousSecurityLevel: SecurityLevel? = null
 | 
| 26 | 26 | |
| 27 | -    override fun onResume() {
 | |
| 28 | -        super.onResume()
 | |
| 29 | -        showToolbar(getString(R.string.preferences_tor_security_level_options))
 | |
| 30 | -    }
 | |
| 31 | - | |
| 32 | 27 |      override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
 | 
| 33 | 28 |          setPreferencesFromResource(R.xml.tor_security_level_preferences, rootKey)
 | 
| 34 | 29 | 
| ... | ... | @@ -956,7 +956,7 @@ | 
| 956 | 956 |      <fragment
 | 
| 957 | 957 |          android:id="@+id/torSecurityLevelFragment"
 | 
| 958 | 958 |          android:name="org.mozilla.fenix.settings.TorSecurityLevelFragment"
 | 
| 959 | -        android:label="@string/preferences_tor_security_level_settings" />
 | |
| 959 | +        android:label="@string/preferences_tor_security_level_options" />
 | |
| 960 | 960 |      <fragment
 | 
| 961 | 961 |          android:id="@+id/privateBrowsingFragment"
 | 
| 962 | 962 |          android:name="org.mozilla.fenix.settings.PrivateBrowsingFragment"
 | 
| ... | ... | @@ -99,7 +99,7 @@ | 
| 99 | 99 |          <androidx.preference.Preference
 | 
| 100 | 100 |              android:key="@string/pref_key_tor_security_level_settings"
 | 
| 101 | 101 |              app:iconSpaceReserved="false"
 | 
| 102 | -            android:title="@string/preferences_tor_security_level_settings" />
 | |
| 102 | +            android:title="@string/preferences_tor_security_level_options" />
 | |
| 103 | 103 | |
| 104 | 104 |          <androidx.preference.Preference
 | 
| 105 | 105 |              android:key="@string/pref_key_private_browsing"
 |