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: |