From 0fabc3fd565e454d4e94a13abccf51644d0a0cfb Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Thu, 17 Feb 2022 12:29:37 -0500 Subject: [PATCH] Fix #4995: Don't show Brave News inline ads when there are no feed items --- .../Frontend/Brave Today/Composer/FeedDataSource.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Client/Frontend/Brave Today/Composer/FeedDataSource.swift b/Client/Frontend/Brave Today/Composer/FeedDataSource.swift index d0065564603..83eadc42ffe 100644 --- a/Client/Frontend/Brave Today/Composer/FeedDataSource.swift +++ b/Client/Frontend/Brave Today/Composer/FeedDataSource.swift @@ -756,6 +756,15 @@ class FeedDataSource { generatedCards.append(contentsOf: elementCards) } } + if generatedCards.count < 10, generatedCards.allSatisfy({ + if case .ad = $0 { + return true + } + return false + }) { + // If there are less than 10 cards and they all are ads, show nothing + generatedCards.removeAll() + } DispatchQueue.main.async { completion(generatedCards) }