Commit a5dd223f authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Commit Bot

[iOS] Add MICE Settings proposal that separates Sync & Google Services.

- Adds the entrypoint to Settings from NTP profile image.
- Updates the Settings screen to separate Sync from Google Services.
- Adds the new G icon for Google Services.

https://drive.google.com/file/d/1EdCu2VT7I8DBERCr-SZlXXBlZh9OVaNS/view?usp=sharing

Bug: 1125631
Change-Id: I6354c7e93d116b0ed69f54100988e38a8bff7529
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2442794
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814285}
parent 8f88a664
...@@ -885,9 +885,15 @@ Because your account is managed by <ph name="HOSTED_DOMAIN">$1<ex>google.com</ex ...@@ -885,9 +885,15 @@ Because your account is managed by <ph name="HOSTED_DOMAIN">$1<ex>google.com</ex
<message name="IDS_IOS_GOOGLE_SERVICES_SETTINGS_SIGN_IN_DETAIL_TEXT" desc="Invite the user to sign-in and explains the benefit. [iOS only]"> <message name="IDS_IOS_GOOGLE_SERVICES_SETTINGS_SIGN_IN_DETAIL_TEXT" desc="Invite the user to sign-in and explains the benefit. [iOS only]">
Sync and personalize across devices. Sync and personalize across devices.
</message> </message>
<message name="IDS_IOS_GOOGLE_SERVICES_SETTINGS_TITLE" desc="Title for the view in the Settings for enabling/disabling Sync and all the Google services. [Length: 26em] [iOS only]"> <message name="IDS_IOS_GOOGLE_SERVICES_SYNC_SETTINGS_TITLE" desc="Title for the view in the Settings for enabling/disabling Sync and all the Google services. [Length: 26em] [iOS only]">
Sync and Google Services Sync and Google Services
</message> </message>
<message name="IDS_IOS_GOOGLE_SERVICES_SETTINGS_TITLE" desc="Title for the view in the Settings for enabling/disabling Google services. [Length: 26em] [iOS only]">
Google Services
</message>
<message name="IDS_IOS_GOOGLE_SYNC_SETTINGS_TITLE" desc="Title for the view in the Settings for enabling/disabling Sync. [Length: 26em] [iOS only]">
Sync
</message>
<message name="IDS_IOS_GOOGLE_SERVICES_SETTINGS_SYNC_DISABLBED_BY_ADMINISTRATOR_STATUS" desc="Error displayed when the sync is disabled by the enterprise policy. The user doesn't have a regular gmail account."> <message name="IDS_IOS_GOOGLE_SERVICES_SETTINGS_SYNC_DISABLBED_BY_ADMINISTRATOR_STATUS" desc="Error displayed when the sync is disabled by the enterprise policy. The user doesn't have a regular gmail account.">
Sync is disabled by your administrator Sync is disabled by your administrator
</message> </message>
......
43b73968521e12aff187d33b60f4c12a96f1ad64
\ No newline at end of file
c86d9bbb7aa35a76e82b590c1ee426731ba9bbf5
\ No newline at end of file
43b73968521e12aff187d33b60f4c12a96f1ad64
\ No newline at end of file
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#import "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.h" #import "ios/chrome/browser/ui/authentication/signin/consistency_promo_signin/consistency_promo_signin_coordinator.h"
#import "components/signin/public/base/account_consistency_method.h"
#import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/ui/authentication/signin/signin_coordinator+protected.h" #import "ios/chrome/browser/ui/authentication/signin/signin_coordinator+protected.h"
...@@ -75,6 +76,7 @@ ...@@ -75,6 +76,7 @@
- (void)start { - (void)start {
[super start]; [super start];
DCHECK(base::FeatureList::IsEnabled(signin::kMobileIdentityConsistency));
self.identityChooserCoordinator = [[IdentityChooserCoordinator alloc] self.identityChooserCoordinator = [[IdentityChooserCoordinator alloc]
initWithBaseViewController:self.baseViewController initWithBaseViewController:self.baseViewController
browser:self.browser]; browser:self.browser];
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/ios/ios_util.h" #include "base/ios/ios_util.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "components/signin/public/base/account_consistency_method.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/ntp/new_tab_page_tab_helper.h" #import "ios/chrome/browser/ntp/new_tab_page_tab_helper.h"
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
...@@ -446,7 +447,11 @@ const NSString* kScribbleFakeboxElementId = @"fakebox"; ...@@ -446,7 +447,11 @@ const NSString* kScribbleFakeboxElementId = @"fakebox";
- (void)identityDiscTapped { - (void)identityDiscTapped {
base::RecordAction(base::UserMetricsAction("MobileNTPIdentityDiscTapped")); base::RecordAction(base::UserMetricsAction("MobileNTPIdentityDiscTapped"));
[self.dispatcher showGoogleServicesSettingsFromViewController:nil]; if (base::FeatureList::IsEnabled(signin::kMobileIdentityConsistency)) {
[self.dispatcher showSettingsFromViewController:self];
} else {
[self.dispatcher showGoogleServicesSettingsFromViewController:nil];
}
} }
// TODO(crbug.com/807330) The fakebox is currently a collection of views spread // TODO(crbug.com/807330) The fakebox is currently a collection of views spread
......
...@@ -83,6 +83,7 @@ source_set("settings") { ...@@ -83,6 +83,7 @@ source_set("settings") {
"resources:settings_content_settings", "resources:settings_content_settings",
"resources:settings_debug", "resources:settings_debug",
"resources:settings_error", "resources:settings_error",
"resources:settings_google_services",
"resources:settings_info", "resources:settings_info",
"resources:settings_language_settings", "resources:settings_language_settings",
"resources:settings_passwords", "resources:settings_passwords",
......
...@@ -184,6 +184,14 @@ imageset("sync_and_google_services_sync_on") { ...@@ -184,6 +184,14 @@ imageset("sync_and_google_services_sync_on") {
] ]
} }
imageset("settings_google_services") {
sources = [
"settings_google_services.imageset/Contents.json",
"settings_google_services.imageset/settings_google_services@2x.png",
"settings_google_services.imageset/settings_google_services@3x.png",
]
}
imageset("settings_unsafe_state") { imageset("settings_unsafe_state") {
sources = [ sources = [
"settings_unsafe_state.imageset/Contents.json", "settings_unsafe_state.imageset/Contents.json",
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "settings_google_services@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "settings_google_services@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/search_engines/search_engines_pref_names.h" #include "components/search_engines/search_engines_pref_names.h"
#include "components/search_engines/util.h" #include "components/search_engines/util.h"
#include "components/signin/public/base/account_consistency_method.h"
#include "components/signin/public/base/signin_metrics.h" #include "components/signin/public/base/signin_metrics.h"
#include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/identity_manager.h"
#import "components/signin/public/identity_manager/objc/identity_manager_observer_bridge.h" #import "components/signin/public/identity_manager/objc/identity_manager_observer_bridge.h"
...@@ -114,6 +115,7 @@ NSString* const kSyncAndGoogleServicesSyncOffImageName = ...@@ -114,6 +115,7 @@ NSString* const kSyncAndGoogleServicesSyncOffImageName =
@"sync_and_google_services_sync_off"; @"sync_and_google_services_sync_off";
NSString* const kSyncAndGoogleServicesSyncOnImageName = NSString* const kSyncAndGoogleServicesSyncOnImageName =
@"sync_and_google_services_sync_on"; @"sync_and_google_services_sync_on";
NSString* const kSettingsGoogleServicesImageName = @"settings_google_services";
NSString* const kSettingsSearchEngineImageName = @"settings_search_engine"; NSString* const kSettingsSearchEngineImageName = @"settings_search_engine";
NSString* const kSettingsPasswordsImageName = @"settings_passwords"; NSString* const kSettingsPasswordsImageName = @"settings_passwords";
NSString* const kSettingsAutofillCreditCardImageName = NSString* const kSettingsAutofillCreditCardImageName =
...@@ -147,7 +149,7 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -147,7 +149,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeSignInButton = kItemTypeEnumZero, ItemTypeSignInButton = kItemTypeEnumZero,
ItemTypeSigninPromo, ItemTypeSigninPromo,
ItemTypeAccount, ItemTypeAccount,
ItemGoogleServices, ItemTypeSyncAndGoogleServices,
ItemTypeHeader, ItemTypeHeader,
ItemTypeSearchEngine, ItemTypeSearchEngine,
ItemTypeManagedDefaultSearchEngine, ItemTypeManagedDefaultSearchEngine,
...@@ -428,12 +430,21 @@ NSString* kDevViewSourceKey = @"DevViewSource"; ...@@ -428,12 +430,21 @@ NSString* kDevViewSourceKey = @"DevViewSource";
toSectionWithIdentifier:SectionIdentifierAccount]; toSectionWithIdentifier:SectionIdentifierAccount];
} }
if (![model hasSectionForSectionIdentifier:SectionIdentifierAccount]) { if (![model hasSectionForSectionIdentifier:SectionIdentifierAccount]) {
// Add the Account section for the Google services cell, if the user is // Add the Account section for the Sync & Google services cell, if the user
// signed-out. // is signed-out.
[model addSectionWithIdentifier:SectionIdentifierAccount]; [model addSectionWithIdentifier:SectionIdentifierAccount];
} }
[model addItem:[self googleServicesCellItem]
toSectionWithIdentifier:SectionIdentifierAccount]; // Adds experimental Google Services item separate from Sync.
if (base::FeatureList::IsEnabled(signin::kMobileIdentityConsistency)) {
[model addItem:[self syncCellItem]
toSectionWithIdentifier:SectionIdentifierAccount];
[model addItem:[self googleServicesCellItem]
toSectionWithIdentifier:SectionIdentifierAccount];
} else {
[model addItem:[self syncAndGoogleServicesCellItem]
toSectionWithIdentifier:SectionIdentifierAccount];
}
// Defaults section. // Defaults section.
if (@available(iOS 14, *)) { if (@available(iOS 14, *)) {
...@@ -547,17 +558,45 @@ NSString* kDevViewSourceKey = @"DevViewSource"; ...@@ -547,17 +558,45 @@ NSString* kDevViewSourceKey = @"DevViewSource";
} }
- (TableViewItem*)googleServicesCellItem { - (TableViewItem*)googleServicesCellItem {
TableViewImageItem* googleServicesItem =
[[TableViewImageItem alloc] initWithType:ItemTypeSyncAndGoogleServices];
googleServicesItem.accessoryType =
UITableViewCellAccessoryDisclosureIndicator;
googleServicesItem.title =
l10n_util::GetNSString(IDS_IOS_GOOGLE_SERVICES_SETTINGS_TITLE);
googleServicesItem.accessibilityIdentifier = kSettingsGoogleServicesCellId;
googleServicesItem.image =
[UIImage imageNamed:kSettingsGoogleServicesImageName];
return googleServicesItem;
}
- (TableViewItem*)syncCellItem {
// TODO(crbug.com/805214): This branded icon image needs to come from // TODO(crbug.com/805214): This branded icon image needs to come from
// BrandedImageProvider. // BrandedImageProvider.
TableViewImageItem* googleServicesItem = TableViewImageItem* googleServicesItem =
[[TableViewImageItem alloc] initWithType:ItemGoogleServices]; [[TableViewImageItem alloc] initWithType:ItemTypeSyncAndGoogleServices];
googleServicesItem.accessoryType = googleServicesItem.accessoryType =
UITableViewCellAccessoryDisclosureIndicator; UITableViewCellAccessoryDisclosureIndicator;
googleServicesItem.title = googleServicesItem.title =
l10n_util::GetNSString(IDS_IOS_GOOGLE_SERVICES_SETTINGS_TITLE); l10n_util::GetNSString(IDS_IOS_GOOGLE_SYNC_SETTINGS_TITLE);
googleServicesItem.accessibilityIdentifier =
kSettingsGoogleSyncAndServicesCellId;
[self updateSyncAndGoogleServicesItem:googleServicesItem];
return googleServicesItem;
}
- (TableViewItem*)syncAndGoogleServicesCellItem {
// TODO(crbug.com/805214): This branded icon image needs to come from
// BrandedImageProvider.
TableViewImageItem* googleServicesItem =
[[TableViewImageItem alloc] initWithType:ItemTypeSyncAndGoogleServices];
googleServicesItem.accessoryType =
UITableViewCellAccessoryDisclosureIndicator;
googleServicesItem.title =
l10n_util::GetNSString(IDS_IOS_GOOGLE_SERVICES_SYNC_SETTINGS_TITLE);
googleServicesItem.accessibilityIdentifier = googleServicesItem.accessibilityIdentifier =
kSettingsGoogleSyncAndServicesCellId; kSettingsGoogleSyncAndServicesCellId;
[self updateGoogleServicesItem:googleServicesItem]; [self updateSyncAndGoogleServicesItem:googleServicesItem];
return googleServicesItem; return googleServicesItem;
} }
...@@ -956,7 +995,7 @@ NSString* kDevViewSourceKey = @"DevViewSource"; ...@@ -956,7 +995,7 @@ NSString* kDevViewSourceKey = @"DevViewSource";
controller = [[AccountsTableViewController alloc] initWithBrowser:_browser controller = [[AccountsTableViewController alloc] initWithBrowser:_browser
closeSettingsOnAddAccount:NO]; closeSettingsOnAddAccount:NO];
break; break;
case ItemGoogleServices: case ItemTypeSyncAndGoogleServices:
base::RecordAction(base::UserMetricsAction("Settings.GoogleServices")); base::RecordAction(base::UserMetricsAction("Settings.GoogleServices"));
[self showSyncGoogleService]; [self showSyncGoogleService];
break; break;
...@@ -1232,9 +1271,10 @@ NSString* kDevViewSourceKey = @"DevViewSource"; ...@@ -1232,9 +1271,10 @@ NSString* kDevViewSourceKey = @"DevViewSource";
} }
} }
// Updates the Google services item to display the right icon and status message // Updates the Sync & Google services item to display the right icon and status
// in the detail text of the cell. // message in the detail text of the cell.
- (void)updateGoogleServicesItem:(TableViewImageItem*)googleServicesItem { - (void)updateSyncAndGoogleServicesItem:
(TableViewImageItem*)googleServicesItem {
googleServicesItem.detailTextColor = nil; googleServicesItem.detailTextColor = nil;
syncer::SyncService* syncService = syncer::SyncService* syncService =
ProfileSyncServiceFactory::GetForBrowserState(_browserState); ProfileSyncServiceFactory::GetForBrowserState(_browserState);
...@@ -1279,15 +1319,15 @@ NSString* kDevViewSourceKey = @"DevViewSource"; ...@@ -1279,15 +1319,15 @@ NSString* kDevViewSourceKey = @"DevViewSource";
} }
// Updates and reloads the Google service cell. // Updates and reloads the Google service cell.
- (void)reloadGoogleServicesCell { - (void)reloadSyncAndGoogleServicesCell {
NSIndexPath* googleServicesCellIndexPath = NSIndexPath* googleServicesCellIndexPath =
[self.tableViewModel indexPathForItemType:ItemGoogleServices [self.tableViewModel indexPathForItemType:ItemTypeSyncAndGoogleServices
sectionIdentifier:SectionIdentifierAccount]; sectionIdentifier:SectionIdentifierAccount];
TableViewImageItem* googleServicesItem = TableViewImageItem* googleServicesItem =
base::mac::ObjCCast<TableViewImageItem>( base::mac::ObjCCast<TableViewImageItem>(
[self.tableViewModel itemAtIndexPath:googleServicesCellIndexPath]); [self.tableViewModel itemAtIndexPath:googleServicesCellIndexPath]);
DCHECK(googleServicesItem); DCHECK(googleServicesItem);
[self updateGoogleServicesItem:googleServicesItem]; [self updateSyncAndGoogleServicesItem:googleServicesItem];
[self reconfigureCellsForItems:@[ googleServicesItem ]]; [self reconfigureCellsForItems:@[ googleServicesItem ]];
} }
...@@ -1378,7 +1418,7 @@ NSString* kDevViewSourceKey = @"DevViewSource"; ...@@ -1378,7 +1418,7 @@ NSString* kDevViewSourceKey = @"DevViewSource";
#pragma mark SyncObserverModelBridge #pragma mark SyncObserverModelBridge
- (void)onSyncStateChanged { - (void)onSyncStateChanged {
[self reloadGoogleServicesCell]; [self reloadSyncAndGoogleServicesCell];
} }
#pragma mark - IdentityRefreshLogic #pragma mark - IdentityRefreshLogic
......
...@@ -28,6 +28,9 @@ extern NSString* const kSettingsVoiceSearchCellId; ...@@ -28,6 +28,9 @@ extern NSString* const kSettingsVoiceSearchCellId;
// The accessibility identifier of the Sync and Google services cell. // The accessibility identifier of the Sync and Google services cell.
extern NSString* const kSettingsGoogleSyncAndServicesCellId; extern NSString* const kSettingsGoogleSyncAndServicesCellId;
// The accessibility identifier of the Google services cell.
extern NSString* const kSettingsGoogleServicesCellId;
// The accessibility identifier of the Passwords cell. // The accessibility identifier of the Passwords cell.
extern NSString* const kSettingsPasswordsCellId; extern NSString* const kSettingsPasswordsCellId;
......
...@@ -17,6 +17,8 @@ NSString* const kSettingsManagedSearchEngineCellId = ...@@ -17,6 +17,8 @@ NSString* const kSettingsManagedSearchEngineCellId =
NSString* const kSettingsVoiceSearchCellId = @"kSettingsVoiceSearchCellId"; NSString* const kSettingsVoiceSearchCellId = @"kSettingsVoiceSearchCellId";
NSString* const kSettingsGoogleSyncAndServicesCellId = NSString* const kSettingsGoogleSyncAndServicesCellId =
@"kSettingsGoogleSyncAndServicesCellId"; @"kSettingsGoogleSyncAndServicesCellId";
NSString* const kSettingsGoogleServicesCellId =
@"kSettingsGoogleServicesCellId";
NSString* const kSettingsPasswordsCellId = @"kSettingsPasswordsCellId"; NSString* const kSettingsPasswordsCellId = @"kSettingsPasswordsCellId";
NSString* const kSettingsPaymentMethodsCellId = NSString* const kSettingsPaymentMethodsCellId =
@"kSettingsPaymentMethodsCellId"; @"kSettingsPaymentMethodsCellId";
......
...@@ -553,14 +553,9 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id, ...@@ -553,14 +553,9 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id,
} }
+ (id<GREYMatcher>)googleServicesSettingsButton { + (id<GREYMatcher>)googleServicesSettingsButton {
NSString* syncAndGoogleServicesTitle = return grey_allOf(
l10n_util::GetNSStringWithFixup(IDS_IOS_GOOGLE_SERVICES_SETTINGS_TITLE); grey_kindOfClass([UITableViewCell class]), grey_sufficientlyVisible(),
id<GREYMatcher> mainTextLabelMatcher = grey_accessibilityID(kSettingsGoogleSyncAndServicesCellId), nil);
grey_allOf(grey_accessibilityLabel(syncAndGoogleServicesTitle),
grey_sufficientlyVisible(), nil);
return grey_allOf(grey_kindOfClass([UITableViewCell class]),
grey_sufficientlyVisible(),
grey_descendant(mainTextLabelMatcher), nil);
} }
+ (id<GREYMatcher>)googleServicesSettingsView { + (id<GREYMatcher>)googleServicesSettingsView {
......
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