From 784f651e8b0765a40e97696e789f7b7f60197099 Mon Sep 17 00:00:00 2001 From: Arturo Mejia Date: Thu, 9 Mar 2023 17:50:30 -0500 Subject: [PATCH] Bug 1821468 - Update the copy for the cookie banner experiment --- app/nimbus.fml.yaml | 13 +--- .../dialog/CookieBannerReEngagementDialog.kt | 25 +++++-- .../CookieBannerReEngagementDialogUtils.kt | 75 ------------------- app/src/main/res/values/strings.xml | 24 +++--- 4 files changed, 38 insertions(+), 99 deletions(-) diff --git a/app/nimbus.fml.yaml b/app/nimbus.fml.yaml index a5bd4645b8..4962027aaf 100644 --- a/app/nimbus.fml.yaml +++ b/app/nimbus.fml.yaml @@ -105,8 +105,7 @@ features: { "feature-ui": 0, "feature-setting-value": 0, - "dialog-re-engage-time": 4, - "dialog-text-variant": 0, + "dialog-re-engage-time": 4 } defaults: - channel: developer @@ -114,8 +113,7 @@ features: "sections-enabled": { "feature-ui": 1, "feature-setting-value": 0, - "dialog-re-engage-time": 4, - "dialog-text-variant": 0, + "dialog-re-engage-time": 4 } } - channel: nightly @@ -123,8 +121,7 @@ features: "sections-enabled": { "feature-ui": 1, "feature-setting-value": 0, - "dialog-re-engage-time": 4, - "dialog-text-variant": 0, + "dialog-re-engage-time": 4 } } unified-search: @@ -244,10 +241,6 @@ types: description: An integer indicating the number of hours that needs to happen before the re-engagement dialog shows again since the last seen, for example if set to 4 that means if the users has seen the dialog, it will see it 4 hours later. - dialog-text-variant: - description: An integer from 0 to 2, indicating which text variant should be used on the re-engagement dialog. - 0 to indicate the variant control should be used, 1 indicates the variant 1 should be used, - 2 indicates the variant 2 should be used, each variant can be found in the mockups for cookie banner handling. OnboardingPanel: description: The types of onboarding panels in the onboarding page variants: diff --git a/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/cookiebanners/dialog/CookieBannerReEngagementDialog.kt b/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/cookiebanners/dialog/CookieBannerReEngagementDialog.kt index ac32e6c5a1..fd156f963c 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/cookiebanners/dialog/CookieBannerReEngagementDialog.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/cookiebanners/dialog/CookieBannerReEngagementDialog.kt @@ -36,12 +36,27 @@ class CookieBannerReEngagementDialog : DialogFragment() { setContent { FirefoxTheme { - val cookieBannerDialogSelectedVariant = - CookieBannerReEngagementDialogUtils.getCookieBannerDialogVariants(requireContext()) + val title = + context.getString( + R.string.reduce_cookie_banner_dialog_title, + context.getString(R.string.app_name), + ) + + val message = + context.getString( + R.string.reduce_cookie_banner_dialog_body, + context.getString(R.string.app_name), + ) + + val allowButtonText = + context.getString( + R.string.reduce_cookie_banner_dialog_change_setting_button, + ) + CookieBannerReEngagementDialogCompose( - dialogTitle = cookieBannerDialogSelectedVariant.title, - dialogText = cookieBannerDialogSelectedVariant.message, - allowButtonText = cookieBannerDialogSelectedVariant.positiveTextButton, + dialogTitle = title, + dialogText = message, + allowButtonText = allowButtonText, declineButtonText = getString(R.string.reduce_cookie_banner_dialog_not_now_button), onAllowButtonClicked = { CookieBanners.allowReEngagementDialog.record(NoExtras()) diff --git a/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/cookiebanners/dialog/CookieBannerReEngagementDialogUtils.kt b/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/cookiebanners/dialog/CookieBannerReEngagementDialogUtils.kt index 488aef4f6b..ffa3c98d8a 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/cookiebanners/dialog/CookieBannerReEngagementDialogUtils.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/cookiebanners/dialog/CookieBannerReEngagementDialogUtils.kt @@ -4,82 +4,19 @@ package org.mozilla.fenix.settings.quicksettings.protections.cookiebanners.dialog -import android.content.Context import androidx.navigation.NavController import mozilla.components.concept.engine.EngineSession.CookieBannerHandlingMode.REJECT_ALL import mozilla.components.concept.engine.EngineSession.CookieBannerHandlingStatus import org.mozilla.fenix.R import org.mozilla.fenix.browser.BrowserFragmentDirections import org.mozilla.fenix.ext.nav -import org.mozilla.fenix.nimbus.CookieBannersSection -import org.mozilla.fenix.nimbus.FxNimbus import org.mozilla.fenix.utils.Settings import mozilla.components.concept.engine.Settings as EngineSettings -private const val CONTROL_VARIANT = 0 -private const val VARIANT_ONE = 1 -private const val VARIANT_TWO = 2 - /** * An utility object for interacting with the re-engagement cookie banner dialog. */ object CookieBannerReEngagementDialogUtils { - /** - * Returns a the current [CookieBannerDialogVariant] to the given nimbus experiment. - */ - fun getCookieBannerDialogVariants(context: Context): CookieBannerDialogVariant { - val textVariant = - FxNimbus.features.cookieBanners.value().sectionsEnabled[CookieBannersSection.DIALOG_TEXT_VARIANT] - return when (textVariant) { - CONTROL_VARIANT -> CookieBannerDialogVariant( - title = context.getString(R.string.reduce_cookie_banner_control_experiment_dialog_title), - message = context.getString( - R.string.reduce_cookie_banner_control_experiment_dialog_body_2, - context.getString( - R.string.app_name, - ), - ), - positiveTextButton = context.getString( - R.string.reduce_cookie_banner_control_experiment_dialog_change_setting_button, - ), - ) - VARIANT_ONE -> CookieBannerDialogVariant( - title = context.getString(R.string.reduce_cookie_banner_variant_1_experiment_dialog_title), - message = context.getString( - R.string.reduce_cookie_banner_variant_1_experiment_dialog_body_1, - context.getString(R.string.app_name), - ), - positiveTextButton = context.getString( - R.string.reduce_cookie_banner_variant_1_experiment_dialog_change_setting_button, - ), - ) - VARIANT_TWO -> CookieBannerDialogVariant( - title = context.getString(R.string.reduce_cookie_banner_variant_2_experiment_dialog_title), - message = context.getString( - R.string.reduce_cookie_banner_variant_2_experiment_dialog_body_1, - context.getString(R.string.app_name), - ), - positiveTextButton = context.getString( - R.string.reduce_cookie_banner_variant_2_experiment_dialog_change_setting_button, - ), - ) - else -> { - CookieBannerDialogVariant( - title = context.getString(R.string.reduce_cookie_banner_control_experiment_dialog_title), - message = context.getString( - R.string.reduce_cookie_banner_control_experiment_dialog_body_2, - context.getString( - R.string.app_name, - ), - ), - positiveTextButton = context.getString( - R.string.reduce_cookie_banner_control_experiment_dialog_change_setting_button, - ), - ) - } - } - } - /** * Tries to show the re-engagement cookie banner dialog, when the right conditions are met, o * otherwise the dialog won't show. @@ -115,16 +52,4 @@ object CookieBannerReEngagementDialogUtils { engineSettings.cookieBannerHandlingMode = REJECT_ALL } } - - /** - * Data class for cookie banner dialog variant - * @property title of the dialog - * @property message of the dialog - * @property positiveTextButton indicates the text of the positive button of the dialog - */ - data class CookieBannerDialogVariant( - val title: String, - val message: String, - val positiveTextButton: String, - ) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7e8e4ee985..3e6b436b8a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -368,35 +368,41 @@ %1$s tries to automatically reject all cookie requests on supported sites. - Cookie banners begone! + Allow Firefox to reject cookie banners? + + Allow %1$s to reject cookie banners? Automatically reject cookie requests, when possible. Otherwise, accept all cookies to dismiss cookie banners. Automatically reject cookie requests, when possible. - Allow %1$s to automatically reject cookie requests when possible? + Allow %1$s to automatically reject cookie requests when possible? + + %1$s can automatically reject many cookie banner requests. Not Now - Dismiss banners + Dismiss banners You’ll see fewer cookie requests - See fewer cookie pop-ups + See fewer cookie pop-ups Automatically answer cookie pop-ups for distraction-free browsing. %1$s will reject all requests if possible, or accept all if not. - Automatically answer cookie pop-ups for distraction-free browsing. %1$s will reject all requests if possible. + Automatically answer cookie pop-ups for distraction-free browsing. %1$s will reject all requests if possible. - Dismiss Pop-ups + Dismiss Pop-ups - Cookie Banner Reduction + Cookie Banner Reduction Allow %1$s to decline a site’s cookie consent request if possible or accept cookie access when not possible? - Allow %1$s to decline a site’s cookie consent request if possible? + Allow %1$s to decline a site’s cookie consent request if possible? - Allow + Allow + + Allow Automatically attempts to connect to sites using HTTPS encryption protocol for increased security.