[fenix] Bug 1809136 - Address CookieBannerReEngagementDialog not showing after expired timer

pull/600/head
Arturo Mejia 2 years ago committed by mergify[bot]
parent 160af0e485
commit e3522ee163

@ -84,6 +84,7 @@ object CookieBannerReEngagementDialogUtils {
if (status == CookieBannerHandlingStatus.DETECTED && if (status == CookieBannerHandlingStatus.DETECTED &&
settings.shouldCookieBannerReEngagementDialog() settings.shouldCookieBannerReEngagementDialog()
) { ) {
settings.lastInteractionWithReEngageCookieBannerDialogInMS = System.currentTimeMillis()
settings.cookieBannerDetectedPreviously = true settings.cookieBannerDetectedPreviously = true
val directions = val directions =
BrowserFragmentDirections.actionBrowserFragmentToCookieBannerDialogFragment() BrowserFragmentDirections.actionBrowserFragmentToCookieBannerDialogFragment()

@ -552,6 +552,13 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = false, default = false,
) )
var lastInteractionWithReEngageCookieBannerDialogInMS by longPreference(
appContext.getPreferenceKey(
R.string.pref_key_cookie_banner_re_engage_dialog_last_interaction_with_dialog_in_ms,
),
default = 0L,
)
var cookieBannerDetectedPreviously by booleanPreference( var cookieBannerDetectedPreviously by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_cookie_banner_first_banner_detected), appContext.getPreferenceKey(R.string.pref_key_cookie_banner_first_banner_detected),
default = false, default = false,
@ -576,7 +583,8 @@ class Settings(private val appContext: Context) : PreferencesHolder {
val shouldShowDialog = val shouldShowDialog =
shouldShowCookieBannerUI && !userOptOutOfReEngageCookieBannerDialog && !shouldUseCookieBanner shouldShowCookieBannerUI && !userOptOutOfReEngageCookieBannerDialog && !shouldUseCookieBanner
return if (!shouldShowTotalCookieProtectionCFR && shouldShowDialog) { return if (!shouldShowTotalCookieProtectionCFR && shouldShowDialog) {
!cookieBannerDetectedPreviously || timeNowInMillis() - lastBrowseActivity >= timerForCookieBannerDialog !cookieBannerDetectedPreviously ||
timeNowInMillis() - lastInteractionWithReEngageCookieBannerDialogInMS >= timerForCookieBannerDialog
} else { } else {
false false
} }

@ -151,6 +151,7 @@
<!-- Cookie Banner Reduction Settings--> <!-- Cookie Banner Reduction Settings-->
<string name="pref_key_cookie_banner_settings" translatable="false">pref_key_cookie_banner_settings</string> <string name="pref_key_cookie_banner_settings" translatable="false">pref_key_cookie_banner_settings</string>
<string name="pref_key_cookie_banner_re_engage_dialog_last_interaction_with_dialog_in_ms" translatable="false">pref_key_cookie_banner_re_engage_dialog_last_interaction_with_dialog_in_ms</string>
<string name="pref_key_cookie_banner_re_engage_dialog_dismissed" translatable="false">pref_key_cookie_banner_re_engage_dialog_dismissed</string> <string name="pref_key_cookie_banner_re_engage_dialog_dismissed" translatable="false">pref_key_cookie_banner_re_engage_dialog_dismissed</string>
<string name="pref_key_cookie_banner_first_banner_detected" translatable="false">pref_key_cookie_banner_first_banner_detected</string> <string name="pref_key_cookie_banner_first_banner_detected" translatable="false">pref_key_cookie_banner_first_banner_detected</string>
<string name="pref_key_cookie_banner_v1" translatable="false">pref_key_cookie_banner_v1</string> <string name="pref_key_cookie_banner_v1" translatable="false">pref_key_cookie_banner_v1</string>

Loading…
Cancel
Save