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

Unified Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm

Issue 2739873003: Remove suggestions notified as invalid (Closed)
Patch Set: Update 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
Index: ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
index c0f4c134adbfdf8296b77b5930e89e14a1c12ca7..d7204595f08fce6a632e2edfe45f59b3e1866a7f 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
@@ -129,6 +129,36 @@ SectionIdentifier SectionIdentifierForInfo(
[self reloadData];
}
+- (void)clearSuggestion:(ContentSuggestionIdentifier*)suggestionIdentifier {
+ SectionIdentifier sectionIdentifier =
+ SectionIdentifierForInfo(suggestionIdentifier.sectionInfo);
+ if (![self.collectionViewController.collectionViewModel
+ hasSectionForSectionIdentifier:sectionIdentifier]) {
+ return;
+ }
+
+ NSArray<CollectionViewItem<ContentSuggestionIdentification>*>*
+ itemsInSection = [self.collectionViewController.collectionViewModel
+ itemsInSectionWithIdentifier:sectionIdentifier];
+
+ CollectionViewItem<ContentSuggestionIdentification>* correspondingItem = nil;
+ for (CollectionViewItem<ContentSuggestionIdentification>* item in
+ itemsInSection) {
+ if (item.suggestionIdentifier == suggestionIdentifier) {
+ correspondingItem = item;
+ break;
+ }
+ }
+
+ if (!correspondingItem)
+ return;
+
+ NSIndexPath* indexPath = [self.collectionViewController.collectionViewModel
+ indexPathForItem:correspondingItem
+ inSectionWithIdentifier:sectionIdentifier];
+ [self.collectionViewController dismissEntryAtIndexPath:indexPath];
+}
+
#pragma mark - Public methods
- (BOOL)shouldUseCustomStyleForSection:(NSInteger)section {

Powered by Google App Engine
This is Rietveld 408576698