Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2030)

Unified Diff: ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm

Issue 2745593002: Remove categories notified as invalid (Closed)
Patch Set: Add comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
index 1a5ea6668cf488d2f83ad741a0e3afc2ce4564d7..fe99bd5b3364ad2f1bb45fe5d4d3dfa691db5802 100644
--- a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
+++ b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
@@ -193,7 +193,16 @@ ntp_snippets::ContentSuggestion::ID SuggestionIDForSectionID(
(ntp_snippets::ContentSuggestionsService*)suggestionsService
category:(ntp_snippets::Category)category
statusChangedTo:(ntp_snippets::CategoryStatus)status {
- // Update dataSink.
+ if (!ntp_snippets::IsCategoryStatusInitOrAvailable(status)) {
+ // Remove the category from the UI if it is not available.
+ ContentSuggestionsCategoryWrapper* wrapper =
+ [[ContentSuggestionsCategoryWrapper alloc] initWithCategory:category];
+ ContentSuggestionsSectionInformation* sectionInfo =
+ self.sectionInformationByCategory[wrapper];
+
+ [self.dataSink clearSection:sectionInfo];
+ [self.sectionInformationByCategory removeObjectForKey:wrapper];
+ }
}
- (void)contentSuggestionsService:
« no previous file with comments | « no previous file | ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698