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

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

Issue 2873503005: Create individual cells for MostVisited tiles (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
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_unittest.mm ('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_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 cc7a8113ac083a193b388689a02712c752252d67..a682c7c05e3e789823c395961e2633913ff67d23 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
@@ -14,7 +14,6 @@
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_article_item.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_footer_item.h"
-#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_reading_list_item.h"
#import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_text_item.h"
@@ -238,9 +237,6 @@ SectionIdentifier SectionIdentifierForInfo(
return [NSArray array];
}
- NSMutableArray<ContentSuggestionsMostVisited*>* mostVisitedToAdd =
- [NSMutableArray array];
-
CSCollectionViewModel* model =
self.collectionViewController.collectionViewModel;
NSMutableArray<NSIndexPath*>* indexPaths = [NSMutableArray array];
@@ -293,37 +289,18 @@ SectionIdentifier SectionIdentifierForInfo(
break;
}
case ContentSuggestionTypeMostVisited: {
- NSInteger section =
- [model sectionForSectionIdentifier:SectionIdentifierMostVisited];
- NSIndexPath* indexPath =
- [NSIndexPath indexPathForItem:0 inSection:section];
-
- if ([model numberOfItemsInSection:section] == 0) {
- [model addItem:[[ContentSuggestionsMostVisitedItem alloc]
- initWithType:ItemTypeMostVisited]
- toSectionWithIdentifier:SectionIdentifierMostVisited];
- [indexPaths addObject:indexPath];
- }
-
- ContentSuggestionsMostVisited* mostVisited =
- [ContentSuggestionsMostVisited mostVisitedWithTitle:suggestion.title
- attributes:nil];
- [mostVisitedToAdd addObject:mostVisited];
+ ContentSuggestionsMostVisitedItem* mostVisitedItem =
+ [[ContentSuggestionsMostVisitedItem alloc]
+ initWithType:ItemTypeMostVisited];
+ mostVisitedItem.title = suggestion.title;
+ [model addItem:mostVisitedItem
+ toSectionWithIdentifier:SectionIdentifierMostVisited];
+ [indexPaths addObject:indexPath];
break;
}
}
}
- if ([model hasSectionForSectionIdentifier:SectionIdentifierMostVisited]) {
- NSInteger section =
- [model sectionForSectionIdentifier:SectionIdentifierMostVisited];
- NSIndexPath* indexPath = [NSIndexPath indexPathForItem:0 inSection:section];
- ContentSuggestionsMostVisitedItem* item =
- base::mac::ObjCCast<ContentSuggestionsMostVisitedItem>(
- [model itemAtIndexPath:indexPath]);
- item.suggestions = mostVisitedToAdd;
- }
-
return indexPaths;
}
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698