Commit f2657080 authored by sczs's avatar sczs Committed by Chromium LUCI CQ

[ios] Ignores newSuggestionsInCategory if Discover is enabled.

The crash from 1145109 seems to happens due to an update from
newSuggestionsInCategory triggering a layoutSubviews pass on
Discover.

Since ContentSuggestionsServiceObserver is used for the old content
suggestions system (and not Discover's) this callback will now be
ignored if the Discover feed is being used.


Bug: 1145109
Change-Id: Iec40e155028f6406e702147371d208dc69471efc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2605284Reviewed-by: default avatarJavier Flores <javierrobles@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839456}
parent 8fc50b7a
......@@ -162,6 +162,8 @@ const NSInteger kMaxNumMostVisitedTiles = 4;
if (self) {
_contentSuggestionsEnabled =
prefService->FindPreference(prefs::kArticlesForYouEnabled);
// TODO(crbug.com/1085419): Stop observing this Service once DiscoverFeed is
// launched.
_suggestionBridge =
std::make_unique<ContentSuggestionsServiceBridge>(self, contentService);
_contentService = contentService;
......@@ -443,6 +445,11 @@ const NSInteger kMaxNumMostVisitedTiles = 4;
- (void)contentSuggestionsService:
(ntp_snippets::ContentSuggestionsService*)suggestionsService
newSuggestionsInCategory:(ntp_snippets::Category)category {
// Ignore newSuggestionsInCategory if the DiscoverFeed is enabled, if not
// these might cause some unecessary section updates and crashes.
if (IsDiscoverFeedEnabled())
return;
ContentSuggestionsCategoryWrapper* wrapper =
[ContentSuggestionsCategoryWrapper wrapperWithCategory:category];
if (!self.sectionInformationByCategory[wrapper]) {
......@@ -467,8 +474,6 @@ const NSInteger kMaxNumMostVisitedTiles = 4;
statusChangedTo:(ntp_snippets::CategoryStatus)status {
// Ignore all ContentSuggestionsService if the DiscoverFeed is enabled, if not
// these might cause some unecessary section updates and crashes.
// TODO(crbug.com/1105624): Stop observing this Service once DiscoverFeed is
// launched.
if (IsDiscoverFeedEnabled())
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment