Commit ea4ae9b3 authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Rearranging sign-in/accounts settings cells

The account cell and Google services cell are moved into the account
section.
The changes is visible when the user is signed out, the Google services
cell doesn't share anymore the same section than the sign-in promo.

When signed out:
Before:
https://drive.google.com/open?id=15Y-rwBi292Ii8mNm0x6E0mRWl1sQN-Gd
After:
https://drive.google.com/open?id=17WgNeKqKzZPe0PcGhmY2832L44eoRekD
Mock:
https://docs.google.com/presentation/d/1cZfr5FGWGSy0PNaQ8uzik0alLAH-5glh1vsb030vha8/edit?ts=5b2bed3b#slide=id.g3ae6bac383_31_11

When signed-in:
Before:
https://drive.google.com/open?id=18qP0MZSMwlJZkXBTUq9cvt6q7tbaslaR
After:
https://drive.google.com/open?id=16yaGI24UmZ3ufb3lrnfbxW91C7SEre7L
Mock:
https://docs.google.com/presentation/d/1cZfr5FGWGSy0PNaQ8uzik0alLAH-5glh1vsb030vha8/edit?ts=5b2bed3b#slide=id.g3ae6bac383_31_43

Bug: 827072
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I163053b2355947df67c2df7d8305a4e07ecb39b8
Reviewed-on: https://chromium-review.googlesource.com/1158506Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580132}
parent 58bdb9de
...@@ -95,6 +95,7 @@ const CGFloat kAccountProfilePhotoDimension = 40.0f; ...@@ -95,6 +95,7 @@ const CGFloat kAccountProfilePhotoDimension = 40.0f;
typedef NS_ENUM(NSInteger, SectionIdentifier) { typedef NS_ENUM(NSInteger, SectionIdentifier) {
SectionIdentifierSignIn = kSectionIdentifierEnumZero, SectionIdentifierSignIn = kSectionIdentifierEnumZero,
SectionIdentifierAccount,
SectionIdentifierBasics, SectionIdentifierBasics,
SectionIdentifierAdvanced, SectionIdentifierAdvanced,
SectionIdentifierInfo, SectionIdentifierInfo,
...@@ -350,11 +351,11 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id, ...@@ -350,11 +351,11 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id,
CollectionViewModel* model = self.collectionViewModel; CollectionViewModel* model = self.collectionViewModel;
// Sign in/Account section
[model addSectionWithIdentifier:SectionIdentifierSignIn];
AuthenticationService* authService = AuthenticationService* authService =
AuthenticationServiceFactory::GetForBrowserState(_browserState); AuthenticationServiceFactory::GetForBrowserState(_browserState);
if (!authService->IsAuthenticated()) { if (!authService->IsAuthenticated()) {
// Sign in section
[model addSectionWithIdentifier:SectionIdentifierSignIn];
if ([SigninPromoViewMediator if ([SigninPromoViewMediator
shouldDisplaySigninPromoViewWithAccessPoint: shouldDisplaySigninPromoViewWithAccessPoint:
signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS signin_metrics::AccessPoint::ACCESS_POINT_SETTINGS
...@@ -374,15 +375,22 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id, ...@@ -374,15 +375,22 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id,
[model addItem:[self signInTextItem] [model addItem:[self signInTextItem]
toSectionWithIdentifier:SectionIdentifierSignIn]; toSectionWithIdentifier:SectionIdentifierSignIn];
} else { } else {
// Account section
[model addSectionWithIdentifier:SectionIdentifierAccount];
_hasRecordedSigninImpression = NO; _hasRecordedSigninImpression = NO;
[_signinPromoViewMediator signinPromoViewRemoved]; [_signinPromoViewMediator signinPromoViewRemoved];
_signinPromoViewMediator = nil; _signinPromoViewMediator = nil;
[model addItem:[self accountCellItem] [model addItem:[self accountCellItem]
toSectionWithIdentifier:SectionIdentifierSignIn]; toSectionWithIdentifier:SectionIdentifierAccount];
} }
if (IsUnifiedConsentEnabled()) { if (IsUnifiedConsentEnabled()) {
if (![model hasSectionForSectionIdentifier:SectionIdentifierAccount]) {
// Add the Account section for the Google services cell, if the user is
// signed-out.
[model addSectionWithIdentifier:SectionIdentifierAccount];
}
[model addItem:[self googleServicesCellItem] [model addItem:[self googleServicesCellItem]
toSectionWithIdentifier:SectionIdentifierSignIn]; toSectionWithIdentifier:SectionIdentifierAccount];
} }
// Basics section // Basics section
...@@ -1052,12 +1060,12 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id, ...@@ -1052,12 +1060,12 @@ void SigninObserverBridge::GoogleSignedOut(const std::string& account_id,
- (void)reloadAccountCell { - (void)reloadAccountCell {
if (![self.collectionViewModel hasItemForItemType:ItemTypeAccount if (![self.collectionViewModel hasItemForItemType:ItemTypeAccount
sectionIdentifier:SectionIdentifierSignIn]) { sectionIdentifier:SectionIdentifierAccount]) {
return; return;
} }
NSIndexPath* accountCellIndexPath = NSIndexPath* accountCellIndexPath =
[self.collectionViewModel indexPathForItemType:ItemTypeAccount [self.collectionViewModel indexPathForItemType:ItemTypeAccount
sectionIdentifier:SectionIdentifierSignIn]; sectionIdentifier:SectionIdentifierAccount];
CollectionViewAccountItem* identityAccountItem = CollectionViewAccountItem* identityAccountItem =
base::mac::ObjCCast<CollectionViewAccountItem>( base::mac::ObjCCast<CollectionViewAccountItem>(
[self.collectionViewModel itemAtIndexPath:accountCellIndexPath]); [self.collectionViewModel itemAtIndexPath:accountCellIndexPath]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment