Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #7882: Enable cookie consent notice blocking by default (#7883)
Browse files Browse the repository at this point in the history
* Enable cookie consent notice blocking by default

* Fix tests
  • Loading branch information
cuba authored Aug 16, 2023
1 parent 8334b9a commit 6c17b53
Show file tree
Hide file tree
Showing 18 changed files with 5 additions and 516 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ extension BrowserViewController {
presentDefaultBrowserScreenCallout()
case .rewards:
presentBraveRewardsScreenCallout(skipSafeGuards: skipSafeGuards)
case .blockCookieConsentNotices:
presentCookieNotificationBlockingCallout(skipSafeGuards: skipSafeGuards)
case .vpnPromotion:
presentVPNPromotionCallout(skipSafeGuards: skipSafeGuards)
case .vpnLinkReceipt:
Expand Down Expand Up @@ -183,28 +181,6 @@ extension BrowserViewController {
present(controller, animated: true)
}

private func presentCookieNotificationBlockingCallout(skipSafeGuards: Bool = false) {
if !skipSafeGuards {
// Show Cookie Block Callout if setting is enabled and on second launch
// After Basic onboarding is shown
guard !Preferences.General.isFirstLaunch.value,
!FilterListStorage.shared.isEnabled(for: FilterList.cookieConsentNoticesComponentID),
Preferences.FullScreenCallout.omniboxCalloutCompleted.value else {
return
}
}

let popover = PopoverController(
contentController: CookieNotificationBlockingConsentViewController(yesCallback: {
FilterListStorage.shared.enableFilterList(for: FilterList.cookieConsentNoticesComponentID, isEnabled: true)
}),
contentSizeBehavior: .preferredContentSize)
popover.addsConvenientDismissalMargins = false

isOnboardingOrFullScreenCalloutPresented = true
popover.present(from: topToolbar.locationView.shieldsButton, on: self)
}

private func presentVPNPromotionCallout(skipSafeGuards: Bool = false) {
if !skipSafeGuards {
// Onboarding should be completed to show callouts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,6 @@ class RetentionPreferencesDebugMenuViewController: TableViewController {
}
},
cellReuseId: "DefaultBrowserCalloutCell"),
.boolRow(
title: "Cookie consent notice blocking callout shown",
detailText: "Flag determining if callout to show the cookie consent blocking callout was shown",
toggleValue: Preferences.FullScreenCallout.blockCookieConsentNoticesCalloutCompleted.value,
valueChange: {
Preferences.FullScreenCallout.blockCookieConsentNoticesCalloutCompleted.value = $0
},
cellReuseId: "CookieConsentNoticeBlockingCalloutCell"),
],
footer: .title("These are the preferences that stored in preferences for determining the If certain elements are shown to user.")
)
Expand Down
5 changes: 4 additions & 1 deletion Sources/Brave/WebFilters/FilterListStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ private extension AdblockFilterListCatalogEntry {
/// This method returns the default value for this filter list if the user does not manually toggle it.
/// - Warning: Make sure you use `componentID` to identify the filter list, as `uuid` will be deprecated in the future.
var defaultToggle: Bool {
let componentIDsToOverride = [FilterList.mobileAnnoyancesComponentID]
let componentIDsToOverride = [
FilterList.mobileAnnoyancesComponentID,
FilterList.cookieConsentNoticesComponentID
]

if componentIDsToOverride.contains(componentId) {
return true
Expand Down
26 changes: 0 additions & 26 deletions Sources/BraveStrings/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4731,32 +4731,6 @@ extension Strings {
value: "Block Cookie Consent Notices",
comment: "A title for a toggle that allows user to block cookie consent notices"
)

/// A title for a popup that notifies the user that we can block cookie consent notices
public static let blockCookieConsentNoticesPopupTitle = NSLocalizedString(
"BlockCookieConsentNoticesPopupTitle",
tableName: "BraveShared", bundle: .module,
value: "Tired of cookie consent notices?",
comment: "A title for a popup that notifies the user that we can block cookie consent notices"
)
/// A description for a popup that notifies the user that we can block cookie consent notices
public static let blockCookieConsentNoticesPopupDescription = NSLocalizedString(
"BlockCookieConsentNoticesPopupDescription", tableName: "BraveShared", bundle: .module,
value: "Brave already blocks third-party cookies. We can block cookie consent notices, too.",
comment: "A description for a popup that notifies the user that we can block cookie consent notices"
)
/// An action (button title) that enables cookie consent blocking and dismisses the popup.
public static let yesBlockCookieConsentNotices = NSLocalizedString(
"YesBlockCookieConsentNotices", tableName: "BraveShared", bundle: .module,
value: "Yes, block cookie consent notices",
comment: "An action (button title) that enables cookie consent blocking and dismisses the popup"
)
/// An action (button title) that does not block cookie consent notices and dismisses the popup
public static let noThanks = NSLocalizedString(
"NoThanks", tableName: "BraveShared", bundle: .module,
value: "No thanks",
comment: "An action (button title) that does not block cookie consent notices and dismisses the popup"
)
}

// MARK: Hotkey Titles
Expand Down
177 changes: 0 additions & 177 deletions Sources/BraveUI/Images/GIFImage.swift

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

5 changes: 0 additions & 5 deletions Sources/Onboarding/OnboardingPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ extension Preferences {

extension Preferences {
public final class FullScreenCallout {
/// Whether the block cookie consent notices callout is shown.
public static let blockCookieConsentNoticesCalloutCompleted = Option<Bool>(
key: "fullScreenCallout.full-screen-cookie-consent-notices-callout-completed",
default: false)

/// Whether the bottom bar callout is shown.
public static let bottomBarCalloutCompleted = Option<Bool>(
key: "fullScreenCallout.full-screen-bottom-bar-callout-completed",
Expand Down
Loading

0 comments on commit 6c17b53

Please sign in to comment.