[iOS] Add "Chrome settings" button to the account menu
Screen-recording in https://g-issues.chromium.org/issues/392534699#comment2 The settings icon, and re-ordering the sections will be done in follow-up CLs. Bug: 392534699 Change-Id: I271117912eaa312ba96ba60dbdf7530ea2426f7a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6269397 Commit-Queue: Jood Hajeer <jood@google.com> Reviewed-by: Jérôme Lebel <jlebel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1421044}
This commit is contained in:
ios/chrome
app
strings
ios_chromium_strings.grd
ios_chromium_strings_grd
ios_google_chrome_strings.grdios_google_chrome_strings_grd
browser
@ -191,6 +191,9 @@
|
|||||||
<message name="IDS_IOS_ABOUT_VERSION_COPYRIGHT" desc="Copyright information on the about pages">
|
<message name="IDS_IOS_ABOUT_VERSION_COPYRIGHT" desc="Copyright information on the about pages">
|
||||||
Copyright <ph name="YEAR">$1</ph> The Chromium Authors. All rights reserved.
|
Copyright <ph name="YEAR">$1</ph> The Chromium Authors. All rights reserved.
|
||||||
</message>
|
</message>
|
||||||
|
<message name="IDS_IOS_ACCOUNT_MENU_OPEN_SETTINGS" desc="The button title in the account menu to open settings. [iOS only]">
|
||||||
|
Chromium settings
|
||||||
|
</message>
|
||||||
<message name="IDS_IOS_ACCOUNT_TABLE_ERROR_ENTER_PASSPHRASE_MESSAGE" desc="The error message to show in the account table when there is a passphrase error. [iOS only]">
|
<message name="IDS_IOS_ACCOUNT_TABLE_ERROR_ENTER_PASSPHRASE_MESSAGE" desc="The error message to show in the account table when there is a passphrase error. [iOS only]">
|
||||||
To use and save Chromium data in your Google Account, enter your passphrase.
|
To use and save Chromium data in your Google Account, enter your passphrase.
|
||||||
</message>
|
</message>
|
||||||
|
1
ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_ACCOUNT_MENU_OPEN_SETTINGS.png.sha1
Normal file
1
ios/chrome/app/strings/ios_chromium_strings_grd/IDS_IOS_ACCOUNT_MENU_OPEN_SETTINGS.png.sha1
Normal file
@ -0,0 +1 @@
|
|||||||
|
28ed7b17000e46cff4732d0e49ff358ba528834f
|
@ -191,6 +191,9 @@
|
|||||||
<message name="IDS_IOS_ABOUT_VERSION_COPYRIGHT" desc="Copyright information on the about pages">
|
<message name="IDS_IOS_ABOUT_VERSION_COPYRIGHT" desc="Copyright information on the about pages">
|
||||||
Copyright <ph name="YEAR">$1</ph> Google LLC. All rights reserved.
|
Copyright <ph name="YEAR">$1</ph> Google LLC. All rights reserved.
|
||||||
</message>
|
</message>
|
||||||
|
<message name="IDS_IOS_ACCOUNT_MENU_OPEN_SETTINGS" desc="The button title in the account menu to open settings. [iOS only]">
|
||||||
|
Chrome settings
|
||||||
|
</message>
|
||||||
<message name="IDS_IOS_ACCOUNT_TABLE_ERROR_ENTER_PASSPHRASE_MESSAGE" desc="The error message to show in the account table when there is a passphrase error. [iOS only]">
|
<message name="IDS_IOS_ACCOUNT_TABLE_ERROR_ENTER_PASSPHRASE_MESSAGE" desc="The error message to show in the account table when there is a passphrase error. [iOS only]">
|
||||||
To use and save Chrome data in your Google Account, enter your passphrase.
|
To use and save Chrome data in your Google Account, enter your passphrase.
|
||||||
</message>
|
</message>
|
||||||
|
1
ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_ACCOUNT_MENU_OPEN_SETTINGS.png.sha1
Normal file
1
ios/chrome/app/strings/ios_google_chrome_strings_grd/IDS_IOS_ACCOUNT_MENU_OPEN_SETTINGS.png.sha1
Normal file
@ -0,0 +1 @@
|
|||||||
|
28ed7b17000e46cff4732d0e49ff358ba528834f
|
@ -25,5 +25,7 @@ extern NSString* const kAccountMenuSignoutButtonId;
|
|||||||
extern NSString* const kAccountMenuSecondaryAccountButtonId;
|
extern NSString* const kAccountMenuSecondaryAccountButtonId;
|
||||||
// The accessibility identifier for the account menu activity indicator.
|
// The accessibility identifier for the account menu activity indicator.
|
||||||
extern NSString* const kAccountMenuActivityIndicatorId;
|
extern NSString* const kAccountMenuActivityIndicatorId;
|
||||||
|
// The accessibility identifier of the open settings button.
|
||||||
|
extern NSString* const kAccountMenuOpenSettingsButtonId;
|
||||||
|
|
||||||
#endif // IOS_CHROME_BROWSER_AUTHENTICATION_UI_BUNDLED_ACCOUNT_MENU_ACCOUNT_MENU_CONSTANTS_H_
|
#endif // IOS_CHROME_BROWSER_AUTHENTICATION_UI_BUNDLED_ACCOUNT_MENU_ACCOUNT_MENU_CONSTANTS_H_
|
||||||
|
@ -18,3 +18,5 @@ NSString* const kAccountMenuErrorMessageId = @"AccountMenuErrorMessageId";
|
|||||||
NSString* const kAccountMenuSignoutButtonId = @"AccountMenuSignoutButtonId";
|
NSString* const kAccountMenuSignoutButtonId = @"AccountMenuSignoutButtonId";
|
||||||
NSString* const kAccountMenuActivityIndicatorId =
|
NSString* const kAccountMenuActivityIndicatorId =
|
||||||
@"AccountMenuActivityIndicatorId";
|
@"AccountMenuActivityIndicatorId";
|
||||||
|
NSString* const kAccountMenuOpenSettingsButtonId =
|
||||||
|
@"AccountMenuOpenSettingsButtonId";
|
||||||
|
@ -292,6 +292,19 @@ void ChangeProfileSignInContinuation(id<SystemIdentity> identity,
|
|||||||
[_manageAccountsCoordinator start];
|
[_manageAccountsCoordinator start];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)didTapSettingsButton {
|
||||||
|
// Close the account menu and open the Settings page.
|
||||||
|
__weak __typeof(self) weakSelf = self;
|
||||||
|
[self interruptWithAction:SigninCoordinatorInterrupt::DismissWithAnimation
|
||||||
|
completion:^{
|
||||||
|
id<ApplicationCommands> applicationHandler =
|
||||||
|
HandlerForProtocol(
|
||||||
|
weakSelf.browser->GetCommandDispatcher(),
|
||||||
|
ApplicationCommands);
|
||||||
|
[applicationHandler showSettingsFromViewController:nil];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)signOutFromTargetRect:(CGRect)targetRect
|
- (void)signOutFromTargetRect:(CGRect)targetRect
|
||||||
forSwitch:(BOOL)forSwitch
|
forSwitch:(BOOL)forSwitch
|
||||||
completion:(void (^)(BOOL))completion {
|
completion:(void (^)(BOOL))completion {
|
||||||
|
@ -485,6 +485,20 @@ id<GREYMatcher> snackbarMessageMatcher(FakeSystemIdentity* identity) {
|
|||||||
[SigninEarlGrey verifySignedInWithFakeIdentity:kManagedIdentity2];
|
[SigninEarlGrey verifySignedInWithFakeIdentity:kManagedIdentity2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test the open Settings button.
|
||||||
|
- (void)testOpenSettings {
|
||||||
|
[SigninEarlGrey signinWithFakeIdentity:kPrimaryIdentity];
|
||||||
|
[self selectIdentityDisc];
|
||||||
|
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(
|
||||||
|
kAccountMenuOpenSettingsButtonId)]
|
||||||
|
performAction:grey_tap()];
|
||||||
|
[self assertAccountMenuIsNotShown];
|
||||||
|
// Check that the Settings page is presented.
|
||||||
|
[[EarlGrey
|
||||||
|
selectElementWithMatcher:chrome_test_util::SettingsCollectionView()]
|
||||||
|
assertWithMatcher:grey_notNil()];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Test snackbar
|
#pragma mark - Test snackbar
|
||||||
|
|
||||||
// Verifies identity confirmation snackbar shows on startup with multiple
|
// Verifies identity confirmation snackbar shows on startup with multiple
|
||||||
|
@ -431,6 +431,13 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)didTapSettingsButton {
|
||||||
|
if (self.userInteractionsBlocked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[self.delegate didTapSettingsButton];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Callbacks
|
#pragma mark - Callbacks
|
||||||
|
|
||||||
// Callback for didTapAddAccount
|
// Callback for didTapAddAccount
|
||||||
|
@ -56,6 +56,9 @@
|
|||||||
- (void)didTapAddAccountWithCompletion:
|
- (void)didTapAddAccountWithCompletion:
|
||||||
(SigninCoordinatorCompletionCallback)completion;
|
(SigninCoordinatorCompletionCallback)completion;
|
||||||
|
|
||||||
|
// The user tapped to open Settings page.
|
||||||
|
- (void)didTapSettingsButton;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // IOS_CHROME_BROWSER_AUTHENTICATION_UI_BUNDLED_ACCOUNT_MENU_ACCOUNT_MENU_MEDIATOR_DELEGATE_H_
|
#endif // IOS_CHROME_BROWSER_AUTHENTICATION_UI_BUNDLED_ACCOUNT_MENU_ACCOUNT_MENU_MEDIATOR_DELEGATE_H_
|
||||||
|
@ -37,6 +37,9 @@
|
|||||||
// The user tapped on "Add account…".
|
// The user tapped on "Add account…".
|
||||||
- (void)didTapAddAccount;
|
- (void)didTapAddAccount;
|
||||||
|
|
||||||
|
// The user tapped to open Settings page.
|
||||||
|
- (void)didTapSettingsButton;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // IOS_CHROME_BROWSER_AUTHENTICATION_UI_BUNDLED_ACCOUNT_MENU_ACCOUNT_MENU_MUTATOR_H_
|
#endif // IOS_CHROME_BROWSER_AUTHENTICATION_UI_BUNDLED_ACCOUNT_MENU_ACCOUNT_MENU_MUTATOR_H_
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#import "ios/chrome/browser/signin/model/constants.h"
|
#import "ios/chrome/browser/signin/model/constants.h"
|
||||||
#import "ios/chrome/common/ui/colors/semantic_color_names.h"
|
#import "ios/chrome/common/ui/colors/semantic_color_names.h"
|
||||||
#import "ios/chrome/common/ui/util/image_util.h"
|
#import "ios/chrome/common/ui/util/image_util.h"
|
||||||
|
#import "ios/chrome/grit/ios_branded_strings.h"
|
||||||
#import "ios/chrome/grit/ios_strings.h"
|
#import "ios/chrome/grit/ios_strings.h"
|
||||||
#import "ui/base/l10n/l10n_util.h"
|
#import "ui/base/l10n/l10n_util.h"
|
||||||
|
|
||||||
@ -66,19 +67,23 @@ typedef NS_ENUM(NSUInteger, SectionIdentifier) {
|
|||||||
SyncErrorsSectionIdentifier = kSectionIdentifierEnumZero,
|
SyncErrorsSectionIdentifier = kSectionIdentifierEnumZero,
|
||||||
// List of accounts.
|
// List of accounts.
|
||||||
AccountsSectionIdentifier,
|
AccountsSectionIdentifier,
|
||||||
// Manage accounts ans sign-out.
|
// Manage accounts and sign-out.
|
||||||
SignOutSectionIdentifier,
|
SignOutSectionIdentifier,
|
||||||
|
// Settings.
|
||||||
|
SettingsSectionIdentifier,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef NS_ENUM(NSUInteger, RowIdentifier) {
|
typedef NS_ENUM(NSUInteger, RowIdentifier) {
|
||||||
// Error section
|
// Error section.
|
||||||
RowIdentifierErrorExplanation = kItemTypeEnumZero,
|
RowIdentifierErrorExplanation = kItemTypeEnumZero,
|
||||||
RowIdentifierErrorButton,
|
RowIdentifierErrorButton,
|
||||||
// Signout section
|
// Signout section.
|
||||||
RowIdentifierSignOut,
|
RowIdentifierSignOut,
|
||||||
// Accounts section.
|
// Accounts section.
|
||||||
RowIdentifierAddAccount,
|
RowIdentifierAddAccount,
|
||||||
// The secondary account entries use the gaia ID as item identifier.
|
// The secondary account entries use the gaia ID as item identifier.
|
||||||
|
// Settings section.
|
||||||
|
RowIdentifierSettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Custom detent identifier for when the bottom sheet is minimized.
|
// Custom detent identifier for when the bottom sheet is minimized.
|
||||||
@ -348,6 +353,7 @@ NSString* const kCustomExpandedDetentIdentifier = @"customExpandedDetent";
|
|||||||
NSString* label = nil;
|
NSString* label = nil;
|
||||||
NSString* accessibilityIdentifier = nil;
|
NSString* accessibilityIdentifier = nil;
|
||||||
NSString* accessibilityLabel = nil;
|
NSString* accessibilityLabel = nil;
|
||||||
|
UIColor* textColor = [UIColor colorNamed:kBlueColor];
|
||||||
switch (rowIdentifier) {
|
switch (rowIdentifier) {
|
||||||
case RowIdentifierErrorExplanation: {
|
case RowIdentifierErrorExplanation: {
|
||||||
SettingsImageDetailTextCell* cell =
|
SettingsImageDetailTextCell* cell =
|
||||||
@ -380,6 +386,11 @@ NSString* const kCustomExpandedDetentIdentifier = @"customExpandedDetent";
|
|||||||
l10n_util::GetNSString(IDS_IOS_GOOGLE_ACCOUNT_SETTINGS_SIGN_OUT_ITEM);
|
l10n_util::GetNSString(IDS_IOS_GOOGLE_ACCOUNT_SETTINGS_SIGN_OUT_ITEM);
|
||||||
accessibilityIdentifier = kAccountMenuSignoutButtonId;
|
accessibilityIdentifier = kAccountMenuSignoutButtonId;
|
||||||
break;
|
break;
|
||||||
|
case RowIdentifierSettings:
|
||||||
|
label = l10n_util::GetNSString(IDS_IOS_ACCOUNT_MENU_OPEN_SETTINGS);
|
||||||
|
accessibilityIdentifier = kAccountMenuOpenSettingsButtonId;
|
||||||
|
textColor = [UIColor colorNamed:kSolidBlackColor];
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
@ -391,7 +402,7 @@ NSString* const kCustomExpandedDetentIdentifier = @"customExpandedDetent";
|
|||||||
cell.textLabel.text = label;
|
cell.textLabel.text = label;
|
||||||
cell.accessibilityLabel = accessibilityLabel ? accessibilityLabel : label;
|
cell.accessibilityLabel = accessibilityLabel ? accessibilityLabel : label;
|
||||||
cell.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
|
cell.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
|
||||||
cell.textLabel.textColor = [UIColor colorNamed:kBlueColor];
|
cell.textLabel.textColor = textColor;
|
||||||
cell.userInteractionEnabled = YES;
|
cell.userInteractionEnabled = YES;
|
||||||
cell.accessibilityIdentifier = accessibilityIdentifier;
|
cell.accessibilityIdentifier = accessibilityIdentifier;
|
||||||
return cell;
|
return cell;
|
||||||
@ -466,6 +477,10 @@ NSString* const kCustomExpandedDetentIdentifier = @"customExpandedDetent";
|
|||||||
[snapshot appendItemsWithIdentifiers:@[ @(RowIdentifierSignOut) ]
|
[snapshot appendItemsWithIdentifiers:@[ @(RowIdentifierSignOut) ]
|
||||||
intoSectionWithIdentifier:@(SignOutSectionIdentifier)];
|
intoSectionWithIdentifier:@(SignOutSectionIdentifier)];
|
||||||
|
|
||||||
|
[snapshot appendSectionsWithIdentifiers:@[ @(SettingsSectionIdentifier) ]];
|
||||||
|
[snapshot appendItemsWithIdentifiers:@[ @(RowIdentifierSettings) ]
|
||||||
|
intoSectionWithIdentifier:@(SettingsSectionIdentifier)];
|
||||||
|
|
||||||
[_accountMenuDataSource applySnapshot:snapshot animatingDifferences:YES];
|
[_accountMenuDataSource applySnapshot:snapshot animatingDifferences:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,6 +520,9 @@ NSString* const kCustomExpandedDetentIdentifier = @"customExpandedDetent";
|
|||||||
base::UserMetricsAction("Signin_AccountMenu_AddAccount"));
|
base::UserMetricsAction("Signin_AccountMenu_AddAccount"));
|
||||||
[self.mutator didTapAddAccount];
|
[self.mutator didTapAddAccount];
|
||||||
break;
|
break;
|
||||||
|
case RowIdentifierSettings:
|
||||||
|
[self.mutator didTapSettingsButton];
|
||||||
|
break;
|
||||||
case RowIdentifierErrorExplanation:
|
case RowIdentifierErrorExplanation:
|
||||||
break;
|
break;
|
||||||
case RowIdentifierErrorButton:
|
case RowIdentifierErrorButton:
|
||||||
|
10
ios/chrome/browser/authentication/ui_bundled/account_menu/account_menu_view_controller_unittests.mm
10
ios/chrome/browser/authentication/ui_bundled/account_menu/account_menu_view_controller_unittests.mm
@ -219,7 +219,7 @@ class AccountMenuViewControllerTest : public PlatformTest,
|
|||||||
|
|
||||||
// Test the view controller when it starts.
|
// Test the view controller when it starts.
|
||||||
TEST_P(AccountMenuViewControllerTest, TestDefaultSetting) {
|
TEST_P(AccountMenuViewControllerTest, TestDefaultSetting) {
|
||||||
EXPECT_EQ(2, TableView().numberOfSections);
|
EXPECT_EQ(3, TableView().numberOfSections);
|
||||||
// The secondary account and Add Account...
|
// The secondary account and Add Account...
|
||||||
EXPECT_EQ(2, [TableView() numberOfRowsInSection:0]);
|
EXPECT_EQ(2, [TableView() numberOfRowsInSection:0]);
|
||||||
// Sign Out
|
// Sign Out
|
||||||
@ -282,7 +282,7 @@ TEST_P(AccountMenuViewControllerTest, TestSetError) {
|
|||||||
buttonLabelID:IDS_IOS_ACCOUNT_TABLE_ERROR_ENTER_PASSPHRASE_BUTTON];
|
buttonLabelID:IDS_IOS_ACCOUNT_TABLE_ERROR_ENTER_PASSPHRASE_BUTTON];
|
||||||
data_source_.accountErrorUIInfo = errorInfo;
|
data_source_.accountErrorUIInfo = errorInfo;
|
||||||
[view_controller_ updateErrorSection:errorInfo];
|
[view_controller_ updateErrorSection:errorInfo];
|
||||||
EXPECT_EQ(3, TableView().numberOfSections);
|
EXPECT_EQ(4, TableView().numberOfSections);
|
||||||
// The error section
|
// The error section
|
||||||
EXPECT_EQ(2, [TableView() numberOfRowsInSection:0]);
|
EXPECT_EQ(2, [TableView() numberOfRowsInSection:0]);
|
||||||
// The secondary account and Add Account...
|
// The secondary account and Add Account...
|
||||||
@ -318,7 +318,7 @@ TEST_P(AccountMenuViewControllerTest, TestAddAccount) {
|
|||||||
updateAccountListWithGaiaIDsToAdd:@[ kSecondaryIdentity2.gaiaID ]
|
updateAccountListWithGaiaIDsToAdd:@[ kSecondaryIdentity2.gaiaID ]
|
||||||
gaiaIDsToRemove:@[]
|
gaiaIDsToRemove:@[]
|
||||||
gaiaIDsToKeep:@[ kSecondaryIdentity.gaiaID ]];
|
gaiaIDsToKeep:@[ kSecondaryIdentity.gaiaID ]];
|
||||||
EXPECT_EQ(2, TableView().numberOfSections);
|
EXPECT_EQ(3, TableView().numberOfSections);
|
||||||
// The secondary accounts and Add Account...
|
// The secondary accounts and Add Account...
|
||||||
EXPECT_EQ(3, [TableView() numberOfRowsInSection:0]);
|
EXPECT_EQ(3, [TableView() numberOfRowsInSection:0]);
|
||||||
// Sign Out
|
// Sign Out
|
||||||
@ -332,7 +332,7 @@ TEST_P(AccountMenuViewControllerTest, TestRemoveAccount) {
|
|||||||
updateAccountListWithGaiaIDsToAdd:@[]
|
updateAccountListWithGaiaIDsToAdd:@[]
|
||||||
gaiaIDsToRemove:@[ kSecondaryIdentity.gaiaID ]
|
gaiaIDsToRemove:@[ kSecondaryIdentity.gaiaID ]
|
||||||
gaiaIDsToKeep:@[]];
|
gaiaIDsToKeep:@[]];
|
||||||
EXPECT_EQ(2, TableView().numberOfSections);
|
EXPECT_EQ(3, TableView().numberOfSections);
|
||||||
// No Secondary account. Just Add Account...
|
// No Secondary account. Just Add Account...
|
||||||
EXPECT_EQ(1, [TableView() numberOfRowsInSection:0]);
|
EXPECT_EQ(1, [TableView() numberOfRowsInSection:0]);
|
||||||
// Sign Out
|
// Sign Out
|
||||||
@ -343,7 +343,7 @@ TEST_P(AccountMenuViewControllerTest, TestRemoveAccount) {
|
|||||||
// controller.
|
// controller.
|
||||||
TEST_P(AccountMenuViewControllerTest, TestUpdatePrimaryAccount) {
|
TEST_P(AccountMenuViewControllerTest, TestUpdatePrimaryAccount) {
|
||||||
[view_controller_ updatePrimaryAccount];
|
[view_controller_ updatePrimaryAccount];
|
||||||
EXPECT_EQ(2, TableView().numberOfSections);
|
EXPECT_EQ(3, TableView().numberOfSections);
|
||||||
// The secondary account and Add Account...
|
// The secondary account and Add Account...
|
||||||
EXPECT_EQ(2, [TableView() numberOfRowsInSection:0]);
|
EXPECT_EQ(2, [TableView() numberOfRowsInSection:0]);
|
||||||
// Sign Out
|
// Sign Out
|
||||||
|
Reference in New Issue
Block a user