Bug 1865357 - Add Global Privacy Control settings.

fenix/122.0
mcarare 6 months ago committed by mergify[bot]
parent e3f5c65939
commit 7521ec3424

@ -142,6 +142,7 @@ class Core(
R.color.fx_mobile_layer_color_1,
),
httpsOnlyMode = context.settings().getHttpsOnlyMode(),
globalPrivacyControlEnabled = context.settings().shouldEnableGlobalPrivacyControl,
cookieBannerHandlingMode = context.settings().getCookieBannerHandling(),
cookieBannerHandlingModePrivateBrowsing = context.settings().getCookieBannerHandlingPrivateMode(),
cookieBannerHandlingDetectOnlyMode = context.settings().shouldEnableCookieBannerDetectOnly,

@ -11,6 +11,7 @@ import androidx.preference.CheckBoxPreference
import androidx.preference.DropDownPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.GleanMetrics.TrackingProtection
import org.mozilla.fenix.HomeActivity
@ -103,6 +104,16 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
val preferenceExceptions =
requirePreference<Preference>(R.string.pref_key_tracking_protection_exceptions)
preferenceExceptions.onPreferenceClickListener = exceptionsClickListener
requirePreference<SwitchPreference>(R.string.pref_key_privacy_enable_global_privacy_control).apply {
onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
context.components.core.engine.settings.globalPrivacyControlEnabled = newValue as Boolean
context.components.useCases.sessionUseCases.reload.invoke()
return super.onPreferenceChange(preference, newValue)
}
}
}
}
private fun bindTrackingProtectionRadio(

@ -616,6 +616,11 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = true,
)
var shouldEnableGlobalPrivacyControl by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_privacy_enable_global_privacy_control),
false,
)
var shouldUseCookieBannerPrivateMode by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_cookie_banner_private_mode),
featureFlag = true,

@ -218,6 +218,7 @@
<string name="pref_key_open_links_in_apps_never" translatable="false">pref_key_open_links_in_apps_never</string>
<string name="pref_key_external_download_manager" translatable="false">pref_key_external_download_manager</string>
<string name="pref_key_allow_screenshots_in_private_mode" translatable="false">pref_key_allow_screenshots_in_private_mode</string>
<string name="pref_key_privacy_enable_global_privacy_control" translatable="false">pref_key_privacy_enable_global_privacy_control</string>
<string name="pref_key_adjust_campaign" translatable="false">pref_key_adjust_campaign</string>
<string name="pref_key_adjust_network" translatable="false">pref_key_adjust_network</string>

@ -1544,6 +1544,8 @@
<string name="preference_enhanced_tracking_protection_custom_cookies_4">All cookies (will cause websites to break)</string>
<!-- Option for enhanced tracking protection for the custom protection settings for cookies-->
<string name="preference_enhanced_tracking_protection_custom_cookies_5">Isolate cross-site cookies</string>
<!-- Preference for Global Privacy Control for the custom privacy settings for Global Privacy Control. '&amp;' is replaced with the ampersand symbol: &-->
<string name="preference_enhanced_tracking_protection_custom_global_privacy_control">Tell websites not to share &amp; sell data</string>
<!-- Preference for enhanced tracking protection for the custom protection settings for tracking content -->
<string name="preference_enhanced_tracking_protection_custom_tracking_content">Tracking content</string>
<!-- Option for enhanced tracking protection for the custom protection settings for tracking content-->

@ -77,6 +77,10 @@
android:key="@string/pref_key_tracking_protection_redirect_trackers"
android:layout="@layout/checkbox_left_preference_etp"
android:title="@string/etp_redirect_trackers_title" />
<androidx.preference.SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_privacy_enable_global_privacy_control"
android:title="@string/preference_enhanced_tracking_protection_custom_global_privacy_control" />
<Preference android:layout="@layout/preference_divider" />
<Preference
android:icon="@drawable/ic_internet"

Loading…
Cancel
Save