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

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

Issue 2741343005: ContentSuggestions collection adds items with animation (Closed)
Patch Set: Rebase on correct head 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 | « ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fc6137156993d22a183cf6da93908d76f00d19f6..a7a7fa67509c183e6d292b84ffcb9a7747f344db 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
@@ -89,6 +89,26 @@ const NSTimeInterval kAnimationDuration = 0.35;
}];
}
+- (void)addSuggestions:(NSArray<ContentSuggestion*>*)suggestions {
+ if (suggestions.count == 0) {
+ return;
+ }
+
+ [self.collectionView performBatchUpdates:^{
+ NSIndexSet* addedSections =
+ [self.collectionUpdater addSectionsForSuggestionsToModel:suggestions];
+ [self.collectionView insertSections:addedSections];
+ }
+ completion:nil];
+
+ [self.collectionView performBatchUpdates:^{
+ NSArray<NSIndexPath*>* addedItems =
+ [self.collectionUpdater addSuggestionsToModel:suggestions];
+ [self.collectionView insertItemsAtIndexPaths:addedItems];
+ }
+ completion:nil];
+}
+
#pragma mark - UIViewController
- (void)viewDidLoad {
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698