Skip to content

Commit

Permalink
Fix brave/brave-ios#8217: Remove Cookie Consent info popup. (brave/br…
Browse files Browse the repository at this point in the history
  • Loading branch information
iccub authored Oct 17, 2023
1 parent 71cb650 commit 7d5df48
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ extension BrowserViewController {
- VPN Promotion
- Default Browser
- Rewards
- Cookie Notification
- VPN Link Receipt
*/
func presentFullScreenCallouts() {
Expand All @@ -53,8 +52,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,25 +180,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 FilterListStorage.shared.isEnabled(for: FilterList.cookieConsentNoticesComponentID),
Preferences.FullScreenCallout.omniboxCalloutCompleted.value else {
return
}
}

let popover = PopoverController(
contentController: CookieNotificationBlockingConsentViewController(),
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
11 changes: 0 additions & 11 deletions Sources/Brave/WebFilters/FilterListStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ import Combine
/// Load the filter list settings
func loadFilterListSettings() {
allFilterListSettings = FilterListSetting.loadAllSettings(fromMemory: !persistChanges)

// This is a fix for upgrading from the old cookie consent callout.
// Since we never stored non-default cookie settings,
// the only way to ensure someone's previous settings are kept is if we manually
// disabled it here if the callout was previously shown and the setting is not stored.
// In a future upgrade this can be removed as the setting is now always saved
// (not just for non-defaults or enabled).
if Preferences.FullScreenCallout.blockCookieConsentNoticesCalloutCompleted.value &&
!allFilterListSettings.contains(where: { $0.componentId == FilterList.cookieConsentNoticesComponentID }) {
pendingDefaults[FilterList.cookieConsentNoticesComponentID] = false
}
}

/// Load filter lists from the ad block service and subscribe to any filter list changes
Expand Down
41 changes: 6 additions & 35 deletions Sources/BraveStrings/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4340,6 +4340,12 @@ extension Strings {
value: "No Saved Website Data",
comment: "Shown when the user has no website data (such as cookies, caches, or local storage) persisted to their device."
)

public static let blockCookieConsentNotices = NSLocalizedString(
"BlockCookieConsentNotices",
tableName: "BraveShared", bundle: .module,
value: "Block Cookie Consent Notices",
comment: "A title for a setting that enables cookie consent notices")
}

// MARK: - Privacy hub
Expand Down Expand Up @@ -4791,41 +4797,6 @@ extension Strings {
comment: "Setting title for option to automatically redirect a url to another url")
}

// MARK: - Cookie consent notices
extension Strings {
/// A title for a setting that enables cookie consent notices
public static let blockCookieConsentNotices = NSLocalizedString(
"BlockCookieConsentNotices",
tableName: "BraveShared", bundle: .module,
value: "Block Cookie Consent Notices",
comment: "A title for a setting that enables cookie consent notices"
)

/// A title for a popup that informs the user that brave is blocking cookie consent notices
public static let blockCookieConsentNoticesPopupTitle = NSLocalizedString(
"BlockCookieConsentNoticesPopupTitle",
tableName: "BraveShared", bundle: .module,
value: "Brave is blocking cookie consent notices",
comment: "A title for a popup that informs the user that brave is blocking cookie consent notices"
)

/// A title for a popup that informs the user that brave is blocking cookie consent notices
public static let blockCookieConsentNoticesPopupDescription = NSLocalizedString(
"BlockCookieConsentNoticesPopupDescription",
tableName: "BraveShared", bundle: .module,
value: "Brave already blocks harmful cookies. Now, we automatically block those annoying cookie consent notices, too.",
comment: "A description of why we are blocking cookie consent notices found on the cookie consent blocking popup"
)

/// A title for a button that dismisses the popup informing a use that brave is blocking cookie consent notices
public static let blockCookieConsentNoticesDismissButtonTitle = NSLocalizedString(
"BlockCookieConsentNoticesDismissButtonTitle",
tableName: "BraveShared", bundle: .module,
value: "Got it",
comment: "A title for a button that dismisses the popup informing a use that brave is blocking cookie consent notices"
)
}

// MARK: Hotkey Titles

extension Strings {
Expand Down

This file was deleted.

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

This file was deleted.

This file was deleted.

Binary file not shown.
4 changes: 0 additions & 4 deletions Sources/Onboarding/OnboardingPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +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>(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ public enum FullScreenCalloutType: CaseIterable {
- VPN Promotion
- Default Browser
- Rewards
- Cookie Notification
- VPN Link Receipt
*/
case p3a, vpnUpdateBilling, bottomBar, vpnPromotion, defaultBrowser, rewards, blockCookieConsentNotices, vpnLinkReceipt
case p3a, vpnUpdateBilling, bottomBar, vpnPromotion, defaultBrowser, rewards, vpnLinkReceipt

/// The number of days passed to show certain type of callout
var period: Int {
Expand All @@ -33,7 +32,6 @@ public enum FullScreenCalloutType: CaseIterable {
case .vpnPromotion: return 4
case .defaultBrowser: return 10
case .rewards: return 8
case .blockCookieConsentNotices: return 0
case .vpnLinkReceipt: return 0
}
}
Expand All @@ -53,8 +51,6 @@ public enum FullScreenCalloutType: CaseIterable {
return Preferences.DefaultBrowserIntro.completed
case .rewards:
return Preferences.FullScreenCallout.rewardsCalloutCompleted
case .blockCookieConsentNotices:
return Preferences.FullScreenCallout.blockCookieConsentNoticesCalloutCompleted
case .vpnLinkReceipt:
return Preferences.Onboarding.vpnLinkReceiptShown
}
Expand Down

0 comments on commit 7d5df48

Please sign in to comment.