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

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

Issue 2761263003: Allow CollectionViewModel/Controller queries without SectionIdentifier (Closed)
Patch Set: Cleanup Created 3 years, 8 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 a775e4614961d087b0c20e3194aa76cd7d0f77ea..a1489168ca873bae768e17c7828c5141e2453aba 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
@@ -184,8 +184,7 @@ SectionIdentifier SectionIdentifierForInfo(
return;
NSIndexPath* indexPath = [self.collectionViewController.collectionViewModel
- indexPathForItem:correspondingItem
- inSectionWithIdentifier:sectionIdentifier];
+ indexPathForItem:correspondingItem];
[self.collectionViewController dismissEntryAtIndexPath:indexPath];
}
@@ -339,9 +338,6 @@ SectionIdentifier SectionIdentifierForInfo(
#pragma mark - ContentSuggestionsArticleItemDelegate
- (void)loadImageForArticleItem:(ContentSuggestionsArticleItem*)articleItem {
- NSInteger sectionIdentifier =
- SectionIdentifierForInfo(articleItem.suggestionIdentifier.sectionInfo);
-
__weak ContentSuggestionsCollectionUpdater* weakSelf = self;
__weak ContentSuggestionsArticleItem* weakArticle = articleItem;
@@ -354,8 +350,7 @@ SectionIdentifier SectionIdentifierForInfo(
strongArticle.image = image;
[strongSelf.collectionViewController
- reconfigureCellsForItems:@[ strongArticle ]
- inSectionWithIdentifier:sectionIdentifier];
+ reconfigureCellsForItems:@[ strongArticle ]];
};
[self.dataSource.imageFetcher
@@ -485,7 +480,8 @@ SectionIdentifier SectionIdentifierForInfo(
weakItem.attributes =
[FaviconAttributes attributesWithImage:favicon];
- [weakSelf reconfigure:weakItem];
+ [weakSelf.collectionViewController
+ reconfigureCellsForItems:@[ weakItem ]];
}];
return articleItem;
@@ -535,7 +531,8 @@ SectionIdentifier SectionIdentifierForInfo(
callback(attributes);
- [strongSelf reconfigure:strongItem];
+ [strongSelf.collectionViewController
+ reconfigureCellsForItems:@[ strongItem ]];
};
[self.dataSource fetchFaviconAttributesForURL:URL completion:completionBlock];
@@ -554,21 +551,4 @@ SectionIdentifier SectionIdentifierForInfo(
return [NSIndexPath indexPathForItem:itemNumber inSection:section];
}
-// Reconfigures the |item| in the collection view.
-- (void)reconfigure:(CSCollectionViewItem*)item {
- CSCollectionViewModel* model =
- self.collectionViewController.collectionViewModel;
-
- for (NSInteger sectionNumber = 0; sectionNumber < [model numberOfSections];
- sectionNumber++) {
- NSInteger sectionIdentifier =
- [model sectionIdentifierForSection:sectionNumber];
- if ([model hasItem:item inSectionWithIdentifier:sectionIdentifier]) {
- [self.collectionViewController
- reconfigureCellsForItems:@[ item ]
- inSectionWithIdentifier:sectionIdentifier];
- }
- }
-}
-
@end

Powered by Google App Engine
This is Rietveld 408576698