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

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

Issue 2877513003: ContentSuggestionsDataSource returns CollectionViewItem (Closed)
Patch Set: Address comments Created 3 years, 7 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_view_controller.mm
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
index ba83a32a87ac73f7dce71f15744acc7f7197dc54..5e7741ec883fc08e44abc4ae6586b1ca51505564 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -9,7 +9,6 @@
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item.h"
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h"
#include "url/gurl.h"
@@ -18,6 +17,10 @@
#error "This file requires ARC support."
#endif
+namespace {
+using CSCollectionViewItem = CollectionViewItem<SuggestedContent>;
+}
+
@interface ContentSuggestionsViewController ()
@property(nonatomic, strong)
@@ -81,21 +84,23 @@
}];
}
-- (void)addSuggestions:(NSArray<ContentSuggestion*>*)suggestions {
+- (void)addSuggestions:(NSArray<CSCollectionViewItem*>*)suggestions
+ toSectionInfo:(ContentSuggestionsSectionInformation*)sectionInfo {
if (suggestions.count == 0) {
return;
}
[self.collectionView performBatchUpdates:^{
- NSIndexSet* addedSections =
- [self.collectionUpdater addSectionsForSuggestionsToModel:suggestions];
+ NSIndexSet* addedSections = [self.collectionUpdater
+ addSectionsForSectionInfoToModel:@[ sectionInfo ]];
[self.collectionView insertSections:addedSections];
}
completion:nil];
[self.collectionView performBatchUpdates:^{
NSArray<NSIndexPath*>* addedItems =
- [self.collectionUpdater addSuggestionsToModel:suggestions];
+ [self.collectionUpdater addSuggestionsToModel:suggestions
+ withSectionInfo:sectionInfo];
[self.collectionView insertItemsAtIndexPaths:addedItems];
}
completion:nil];

Powered by Google App Engine
This is Rietveld 408576698