[fenix] For https://github.com/mozilla-mobile/fenix/issues/1749 - Use Strict ETP by default, use Feature Flag for Settings

pull/600/head
Emily Kager 5 years ago committed by Emily Kager
parent 8fcdbab068
commit f2ff2c4f32

@ -11,6 +11,7 @@ import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference import androidx.preference.SwitchPreference
import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
@ -87,6 +88,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
private fun bindStrict() { private fun bindStrict() {
val keyStrict = getString(R.string.pref_key_tracking_protection_strict) val keyStrict = getString(R.string.pref_key_tracking_protection_strict)
radioStrict = requireNotNull(findPreference(keyStrict)) radioStrict = requireNotNull(findPreference(keyStrict))
radioStrict.isVisible = FeatureFlags.etpCategories
radioStrict.onInfoClickListener { radioStrict.onInfoClickListener {
nav( nav(
R.id.trackingProtectionFragment, R.id.trackingProtectionFragment,
@ -102,6 +104,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
private fun bindRecommended() { private fun bindRecommended() {
val keyStandard = getString(R.string.pref_key_tracking_protection_standard) val keyStandard = getString(R.string.pref_key_tracking_protection_standard)
radioStandard = requireNotNull(findPreference(keyStandard)) radioStandard = requireNotNull(findPreference(keyStandard))
radioStandard.isVisible = FeatureFlags.etpCategories
radioStandard.onInfoClickListener { radioStandard.onInfoClickListener {
nav( nav(
R.id.trackingProtectionFragment, R.id.trackingProtectionFragment,

@ -165,7 +165,7 @@ class Settings private constructor(
val useStrictTrackingProtection by booleanPreference( val useStrictTrackingProtection by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict), appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict),
false true
) )
val themeSettingString: String val themeSettingString: String

@ -5,31 +5,33 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.Preference <androidx.preference.Preference
app:allowDividerBelow="false"
android:key="@string/pref_key_etp_learn_more" android:key="@string/pref_key_etp_learn_more"
android:layout="@layout/tracking_protection_learn_more_preference" android:layout="@layout/tracking_protection_learn_more_preference"
android:summary="@string/preference_enhanced_tracking_protection_explanation" android:summary="@string/preference_enhanced_tracking_protection_explanation"
android:title="@string/preference_enhanced_tracking_protection_explanation_title" /> android:title="@string/preference_enhanced_tracking_protection_explanation_title"
app:allowDividerBelow="false" />
<SwitchPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:icon="@drawable/ic_tracking_protection_enabled" android:icon="@drawable/ic_tracking_protection_enabled"
android:key="@string/pref_key_tracking_protection" android:key="@string/pref_key_tracking_protection"
android:title="@string/preference_enhanced_tracking_protection" /> android:title="@string/preference_enhanced_tracking_protection" />
<org.mozilla.fenix.settings.RadioButtonInfoPreference <org.mozilla.fenix.settings.RadioButtonInfoPreference
android:defaultValue="false"
android:dependency="@string/pref_key_tracking_protection" android:dependency="@string/pref_key_tracking_protection"
android:defaultValue="true"
android:key="@string/pref_key_tracking_protection_standard" android:key="@string/pref_key_tracking_protection_standard"
android:summary="@string/preference_enhanced_tracking_protection_standard_description" android:summary="@string/preference_enhanced_tracking_protection_standard_description"
android:title="@string/preference_enhanced_tracking_protection_standard" /> android:title="@string/preference_enhanced_tracking_protection_standard"
app:isPreferenceVisible="false" />
<org.mozilla.fenix.settings.RadioButtonInfoPreference <org.mozilla.fenix.settings.RadioButtonInfoPreference
android:defaultValue="true"
android:dependency="@string/pref_key_tracking_protection" android:dependency="@string/pref_key_tracking_protection"
android:defaultValue="false"
android:key="@string/pref_key_tracking_protection_strict" android:key="@string/pref_key_tracking_protection_strict"
android:summary="@string/preference_enhanced_tracking_protection_strict_description" android:summary="@string/preference_enhanced_tracking_protection_strict_description"
android:title="@string/preference_enhanced_tracking_protection_strict" /> android:title="@string/preference_enhanced_tracking_protection_strict"
app:isPreferenceVisible="false" />
<Preference <Preference
app:allowDividerAbove="true"
android:icon="@drawable/ic_info" android:icon="@drawable/ic_info"
android:key="@string/pref_key_tracking_protection_exceptions" android:key="@string/pref_key_tracking_protection_exceptions"
android:title="@string/preferences_tracking_protection_exceptions" /> android:title="@string/preferences_tracking_protection_exceptions"
app:allowDividerAbove="true" />
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>

@ -229,6 +229,13 @@ class SettingsTest {
assertFalse(settings.shouldUseTrackingProtection) assertFalse(settings.shouldUseTrackingProtection)
} }
@Test
fun shouldUseTrackingProtectionStrict() {
// When
// Then
assertTrue(settings.useStrictTrackingProtection)
}
@Test @Test
fun shouldUseAutoBatteryTheme() { fun shouldUseAutoBatteryTheme() {
// When just created // When just created

Loading…
Cancel
Save