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

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

Issue 2743633002: iOS: Adding cell for the promo signin for settings. (Closed)
Patch Set: Singular they 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/settings/cells/signin_promo_item_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/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..62af0ac56bd548c8472266bab5e9c2ab719f3048 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
@@ -29,6 +29,7 @@
#import "ios/chrome/browser/ui/settings/cells/autofill_data_item.h"
#import "ios/chrome/browser/ui/settings/cells/autofill_edit_item.h"
#import "ios/chrome/browser/ui/settings/cells/native_app_item.h"
+#import "ios/chrome/browser/ui/settings/cells/signin_promo_item.h"
#import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h"
#import "ios/chrome/browser/ui/settings/cells/text_and_error_item.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
@@ -69,6 +70,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeAccountDetail,
ItemTypeAccountCheckMark,
ItemTypeAccountSignIn,
+ ItemTypeSigninPromo,
ItemTypeApp,
ItemTypePaymentsSingleLine,
ItemTypePaymentsDynamicHeight,
@@ -290,6 +292,8 @@ const CGFloat kHorizontalImageFixedSize = 40;
toSectionWithIdentifier:SectionIdentifierAccountCell];
[model addItem:[self accountSignInItem]
toSectionWithIdentifier:SectionIdentifierAccountCell];
+ [model addItem:[self signinPromoItem]
+ toSectionWithIdentifier:SectionIdentifierAccountCell];
// Account control cells.
[model addSectionWithIdentifier:SectionIdentifierAccountControlCell];
@@ -350,6 +354,7 @@ const CGFloat kHorizontalImageFixedSize = 40;
case ItemTypeAutofillStorageSwitch:
case ItemTypePaymentsDynamicHeight:
case ItemTypeAutofillDynamicHeight:
+ case ItemTypeSigninPromo:
return [MDCCollectionViewCell
cr_preferredHeightForWidth:CGRectGetWidth(collectionView.bounds)
forItem:item];
@@ -398,13 +403,17 @@ const CGFloat kHorizontalImageFixedSize = 40;
hidesInkViewAtIndexPath:(nonnull NSIndexPath*)indexPath {
NSInteger sectionIdentifier =
[self.collectionViewModel sectionIdentifierForSection:indexPath.section];
- switch (sectionIdentifier) {
- case SectionIdentifierFooters:
+ if (sectionIdentifier == SectionIdentifierFooters)
+ return YES;
+ CollectionViewItem* item =
+ [self.collectionViewModel itemAtIndexPath:indexPath];
+ switch (item.type) {
case ItemTypeSwitchBasic:
case ItemTypeSwitchDynamicHeight:
case ItemTypeApp:
case ItemTypeAutofillStorageSwitch:
case ItemTypeSwitchSync:
+ case ItemTypeSigninPromo:
return YES;
default:
return NO;
@@ -453,6 +462,19 @@ const CGFloat kHorizontalImageFixedSize = 40;
return accountSignInItem;
}
+- (CollectionViewItem*)signinPromoItem {
+ SigninPromoItem* signinPromoItem =
+ [[[SigninPromoItem alloc] initWithType:ItemTypeSigninPromo] autorelease];
+ signinPromoItem.profileName = @"Jane";
+ signinPromoItem.profileEmail = @"jane@example.com";
+ signinPromoItem.profileImage =
+ CircularImageFromImage(ios::GetChromeBrowserProvider()
+ ->GetSigninResourcesProvider()
+ ->GetDefaultAvatar(),
+ kHorizontalImageFixedSize);
+ return signinPromoItem;
+}
+
- (CollectionViewItem*)accountControlItem {
AccountControlItem* item = [[[AccountControlItem alloc]
initWithType:ItemTypeAccountControlDynamicHeight] autorelease];
« no previous file with comments | « ios/chrome/browser/ui/settings/cells/signin_promo_item_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698