Bug 1864859 - Make cookie banner handling follow the same defaults as desktop.

fenix/121.0
Arturo Mejia 6 months ago committed by mergify[bot]
parent 63b491d297
commit 7cc21836c1

@ -272,7 +272,7 @@ features:
type: Map<CookieBannersSection, Int>
default:
{
"feature-ui": 1,
"feature-ui": 0,
"feature-setting-value": 0,
"feature-setting-value-pbm": 0,
"feature-setting-detect-only": 0,
@ -285,7 +285,7 @@ features:
"sections-enabled": {
"feature-ui": 1,
"feature-setting-value": 0,
"feature-setting-value-pbm": 0,
"feature-setting-value-pbm": 1,
"feature-setting-detect-only": 0,
"feature-setting-global-rules": 0,
"feature-setting-global-rules-sub-frames": 0,
@ -296,7 +296,18 @@ features:
"sections-enabled": {
"feature-ui": 1,
"feature-setting-value": 0,
"feature-setting-value-pbm": 0,
"feature-setting-value-pbm": 1,
"feature-setting-detect-only": 0,
"feature-setting-global-rules": 0,
"feature-setting-global-rules-sub-frames": 0,
}
}
- channel: beta
value: {
"sections-enabled": {
"feature-ui": 1,
"feature-setting-value": 0,
"feature-setting-value-pbm": 1,
"feature-setting-detect-only": 0,
"feature-setting-global-rules": 0,
"feature-setting-global-rules-sub-frames": 0,

@ -17,6 +17,7 @@ import org.mozilla.fenix.helpers.AppAndSystemHelper.registerAndCleanupIdlingReso
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.RecyclerViewIdlingResource
import org.mozilla.fenix.helpers.TestAssetHelper.getEnhancedTrackingProtectionAsset
import org.mozilla.fenix.helpers.TestHelper
import org.mozilla.fenix.helpers.TestHelper.verifySnackBarText
import org.mozilla.fenix.helpers.TestHelper.waitUntilSnackbarGone
import org.mozilla.fenix.ui.robots.addonsMenu
@ -148,6 +149,7 @@ class SettingsAddonsTest {
@SmokeTest
@Test
fun verifyUBlockWorksInPrivateModeTest() {
TestHelper.appContext.settings().shouldShowCookieBannersCFR = false
val addonName = "uBlock Origin"
addonsMenu {

@ -13,12 +13,14 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.customannotations.SmokeTest
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.AppAndSystemHelper.assertYoutubeAppOpens
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule
import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndText
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestHelper
import org.mozilla.fenix.helpers.TestHelper.exitMenu
import org.mozilla.fenix.ui.robots.clickPageObject
import org.mozilla.fenix.ui.robots.homeScreen
@ -201,6 +203,7 @@ class SettingsAdvancedTest {
// Assumes Youtube is installed and enabled
@Test
fun privateBrowsingAskBeforeOpeningLinkInAppCancelTest() {
TestHelper.appContext.settings().shouldShowCookieBannersCFR = false
val externalLinksPage = TestAssetHelper.getExternalLinksAsset(mockWebServer)
homeScreen {

@ -0,0 +1,25 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.settings.cookiebannerhandling
import android.content.Context
import android.util.AttributeSet
import androidx.preference.SwitchPreference
import org.mozilla.fenix.ext.settings
/**
* Custom [SwitchPreference] that automatically creates the switch for the
* cookie banner handling feature depending on the current Nimbus configurations.
*/
class CustomCBHSwitchPreference @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
) : SwitchPreference(context, attrs) {
init {
with(context) {
setDefaultValue(settings().shouldUseCookieBannerPrivateModeDefaultValue)
}
}
}

@ -619,9 +619,12 @@ class Settings(private val appContext: Context) : PreferencesHolder {
var shouldUseCookieBannerPrivateMode by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_cookie_banner_private_mode),
featureFlag = true,
default = { cookieBannersSection[CookieBannersSection.FEATURE_SETTING_VALUE_PBM] == 1 },
default = { shouldUseCookieBannerPrivateModeDefaultValue },
)
val shouldUseCookieBannerPrivateModeDefaultValue: Boolean
get() = cookieBannersSection[CookieBannersSection.FEATURE_SETTING_VALUE_PBM] == 1
val shouldUseCookieBanner: Boolean
get() = cookieBannersSection[CookieBannersSection.FEATURE_SETTING_VALUE] == 1

@ -102,8 +102,7 @@
app:iconSpaceReserved="false"
android:title="@string/preferences_https_only_title" />
<androidx.preference.SwitchPreference
android:defaultValue="false"
<org.mozilla.fenix.settings.cookiebannerhandling.CustomCBHSwitchPreference
android:key="@string/pref_key_cookie_banner_private_mode"
app:iconSpaceReserved="false"
app:isPreferenceVisible="false"

Loading…
Cancel
Save