1
0
Fork 0

For #1749 - Use Strict ETP by default, use Feature Flag for Settings

master
Emily Kager 2019-09-11 15:06:07 -07:00 committed by Emily Kager
parent dffc027e3a
commit 418b1ba890
4 changed files with 21 additions and 9 deletions

View File

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

View File

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

View File

@ -5,31 +5,33 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.Preference
app:allowDividerBelow="false"
android:key="@string/pref_key_etp_learn_more"
android:layout="@layout/tracking_protection_learn_more_preference"
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
android:defaultValue="true"
android:icon="@drawable/ic_tracking_protection_enabled"
android:key="@string/pref_key_tracking_protection"
android:title="@string/preference_enhanced_tracking_protection" />
<org.mozilla.fenix.settings.RadioButtonInfoPreference
android:defaultValue="false"
android:dependency="@string/pref_key_tracking_protection"
android:defaultValue="true"
android:key="@string/pref_key_tracking_protection_standard"
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
android:defaultValue="true"
android:dependency="@string/pref_key_tracking_protection"
android:defaultValue="false"
android:key="@string/pref_key_tracking_protection_strict"
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
app:allowDividerAbove="true"
android:icon="@drawable/ic_info"
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>

View File

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