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

Unified Diff: ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm

Issue 2749543002: Add a footer item for the Content Suggestions (Closed)
Patch Set: Address comments 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/settings/material_cell_catalog_view_controller.mm
diff --git a/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm b/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
index c4759207b6408486ea21634ab7682db5420f9135..e30c638f62d85a9ff5ea0abdf9eea96038617308 100644
--- a/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
@@ -23,6 +23,8 @@
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
+#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.h"
+#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_footer_item.h"
#import "ios/chrome/browser/ui/icons/chrome_icon.h"
#import "ios/chrome/browser/ui/settings/cells/account_control_item.h"
#import "ios/chrome/browser/ui/settings/cells/account_signin_item.h"
@@ -50,6 +52,7 @@ typedef NS_ENUM(NSInteger, SectionIdentifier) {
SectionIdentifierAccountCell,
SectionIdentifierAccountControlCell,
SectionIdentifierFooters,
+ SectionIdentifierContentSuggestionsCell,
};
typedef NS_ENUM(NSInteger, ItemType) {
@@ -78,6 +81,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeAutofillStorageSwitch,
ItemTypeAccountControlDynamicHeight,
ItemTypeFooter,
+ ItemTypeContentSuggestions,
};
// Image fixed horizontal size.
@@ -298,6 +302,13 @@ const CGFloat kHorizontalImageFixedSize = 40;
[model addItem:[self accountControlItemWithExtraLongText]
toSectionWithIdentifier:SectionIdentifierAccountControlCell];
+ // Content Suggestions cells.
+ [model addSectionWithIdentifier:SectionIdentifierContentSuggestionsCell];
+ [model addItem:[self contentSuggestionsArticleItem]
+ toSectionWithIdentifier:SectionIdentifierContentSuggestionsCell];
+ [model addItem:[self contentSuggestionsFooterItem]
+ toSectionWithIdentifier:SectionIdentifierContentSuggestionsCell];
+
// Footers.
[model addSectionWithIdentifier:SectionIdentifierFooters];
[model addItem:[self shortFooterItem]
@@ -340,6 +351,7 @@ const CGFloat kHorizontalImageFixedSize = 40;
CollectionViewItem* item =
[self.collectionViewModel itemAtIndexPath:indexPath];
switch (item.type) {
+ case ItemTypeContentSuggestions:
case ItemTypeFooter:
case ItemTypeSwitchDynamicHeight:
case ItemTypeSwitchSync:
@@ -646,4 +658,27 @@ const CGFloat kHorizontalImageFixedSize = 40;
return footerItem;
}
+- (ContentSuggestionsArticleItem*)contentSuggestionsArticleItem {
+ ContentSuggestionsArticleItem* articleItem =
+ [[ContentSuggestionsArticleItem alloc]
+ initWithType:ItemTypeContentSuggestions
+ title:@"This is an incredible article, you should read it!"
+ subtitle:@"Really, this is the best article I have ever seen, it "
+ @"is mandatory to read it! It describe how to write "
lpromero 2017/03/14 10:16:19 describes
gambard 2017/03/14 11:02:24 Done.
+ @"the best article."
+ delegate:nil
+ url:GURL()];
+ articleItem.publisher = @"Top Publisher.com";
+ return articleItem;
+}
+
+- (ContentSuggestionsFooterItem*)contentSuggestionsFooterItem {
+ ContentSuggestionsFooterItem* footerItem =
+ [[ContentSuggestionsFooterItem alloc]
+ initWithType:ItemTypeContentSuggestions
+ title:@"Footer title"
+ block:nil];
+ return footerItem;
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698