[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 &&
settings.shouldCookieBannerReEngagementDialog()
) {
settings.lastInteractionWithReEngageCookieBannerDialogInMS = System.currentTimeMillis()
settings.cookieBannerDetectedPreviously = true
val directions =
BrowserFragmentDirections.actionBrowserFragmentToCookieBannerDialogFragment()

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

@ -151,6 +151,7 @@
<!-- 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_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_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>

Loading…
Cancel
Save