Commit 5d76942f authored by Yi Gu's avatar Yi Gu Committed by Commit Bot

Reland "[iOS] Updating enable/disable items in the Google Services settings"

This reverts commit 5f3d09d3.

Reason for revert: ios-simulator was flaky. I reverted the original patch aggressively because the issue was marked as "tree closers". Relanding it now.

Original change's description:
> Revert "[iOS] Updating enable/disable items in the Google Services settings"
> 
> This reverts commit 3b62417e.
> 
> Reason for revert: Suspecting this patch caused gclient runhooks failing on ios simulator. https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/ios-simulator-xcode-clang/58250
> 
> Original change's description:
> > [iOS] Updating enable/disable items in the Google Services settings
> > 
> > "Google activity controls", "Encryption", and "Manage synced data..."
> > is enabled when the user is authenticated and disabled otherwise.
> > 
> > Screenshot shared with Chromium accounts:
> >   + Signed out:
> > https://drive.google.com/open?id=19lXF2SdgpLdHUlTZ4WpxipDBdQNCshbU
> >   + Signed in with consent accepted:
> > https://drive.google.com/open?id=1SV3HhbG3hAbre5mSe06Dhjda4dJC4cck
> >   + Signed in with consent not accepted:
> > https://drive.google.com/open?id=1r5umMw6vf8yzh8X7V8V6LzRJVJLq8Rxs
> > 
> > Bug: 883101
> > Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
> > Change-Id: I3e2180c83f42adccb2717f2fdb96efa254751bbc
> > Reviewed-on: https://chromium-review.googlesource.com/c/1290937
> > Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
> > Reviewed-by: Sergio Collazos <sczs@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#601537}
> 
> TBR=jlebel@chromium.org,sczs@chromium.org
> 
> Change-Id: Iac738ad46478cda09124b37b22b8936a8f8d7e20
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 883101
> Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
> Reviewed-on: https://chromium-review.googlesource.com/c/1293758
> Reviewed-by: Yi Gu <yigu@chromium.org>
> Commit-Queue: Yi Gu <yigu@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#601580}

TBR=jlebel@chromium.org,sczs@chromium.org,yigu@chromium.org

Change-Id: I65dadf64329be701eb5df6e99a183de60f9ad3d3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 883101
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/c/1293996Reviewed-by: default avatarYi Gu <yigu@chromium.org>
Commit-Queue: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601611}
parent 9bcf7b9a
...@@ -611,7 +611,9 @@ textItemWithItemType:(NSInteger)itemType ...@@ -611,7 +611,9 @@ textItemWithItemType:(NSInteger)itemType
BOOL enabled = self.isAuthenticated && !self.isConsentGiven; BOOL enabled = self.isAuthenticated && !self.isConsentGiven;
[self updateSectionWithCollapsibleItem:self.syncPersonalizationItem [self updateSectionWithCollapsibleItem:self.syncPersonalizationItem
items:self.personalizedItems items:self.personalizedItems
enabled:enabled]; collapsibleItemEnabled:enabled
switchItemEnabled:enabled
textItemEnabled:self.isAuthenticated];
syncer::ModelType autofillModelType = syncer::ModelType autofillModelType =
_syncSetupService->GetModelType(SyncSetupService::kSyncAutofill); _syncSetupService->GetModelType(SyncSetupService::kSyncAutofill);
BOOL isAutofillOn = _syncSetupService->IsDataTypePreferred(autofillModelType); BOOL isAutofillOn = _syncSetupService->IsDataTypePreferred(autofillModelType);
...@@ -627,16 +629,21 @@ textItemWithItemType:(NSInteger)itemType ...@@ -627,16 +629,21 @@ textItemWithItemType:(NSInteger)itemType
BOOL enabled = !self.isAuthenticated || !self.isConsentGiven; BOOL enabled = !self.isAuthenticated || !self.isConsentGiven;
[self updateSectionWithCollapsibleItem:self.nonPersonalizedServicesItem [self updateSectionWithCollapsibleItem:self.nonPersonalizedServicesItem
items:self.nonPersonalizedItems items:self.nonPersonalizedItems
enabled:enabled]; collapsibleItemEnabled:enabled
switchItemEnabled:enabled
textItemEnabled:enabled];
} }
// Set a section (collapsible item, with all the items inside) to be enabled // Updates |collapsibleItem| and |items| using |collapsibleItemEnabled|,
// or disabled. // |switchItemEnabled| and |textItemEnabled|.
- (void)updateSectionWithCollapsibleItem: - (void)updateSectionWithCollapsibleItem:
(SettingsCollapsibleItem*)collapsibleItem (SettingsCollapsibleItem*)collapsibleItem
items:(ItemArray)items items:(ItemArray)items
enabled:(BOOL)enabled { collapsibleItemEnabled:(BOOL)collapsibleItemEnabled
UIColor* textColor = enabled ? nil : [[MDCPalette greyPalette] tint500]; switchItemEnabled:(BOOL)switchItemEnabled
textItemEnabled:(BOOL)textItemEnabled {
UIColor* textColor =
collapsibleItemEnabled ? nil : [[MDCPalette greyPalette] tint500];
collapsibleItem.textColor = textColor; collapsibleItem.textColor = textColor;
for (CollectionViewItem* item in items) { for (CollectionViewItem* item in items) {
if ([item isKindOfClass:[SyncSwitchItem class]]) { if ([item isKindOfClass:[SyncSwitchItem class]]) {
...@@ -672,11 +679,11 @@ textItemWithItemType:(NSInteger)itemType ...@@ -672,11 +679,11 @@ textItemWithItemType:(NSInteger)itemType
NOTREACHED(); NOTREACHED();
break; break;
} }
switchItem.enabled = enabled; switchItem.enabled = switchItemEnabled;
} else if ([item isKindOfClass:[CollectionViewTextItem class]]) { } else if ([item isKindOfClass:[CollectionViewTextItem class]]) {
CollectionViewTextItem* textItem = CollectionViewTextItem* textItem =
base::mac::ObjCCast<CollectionViewTextItem>(item); base::mac::ObjCCast<CollectionViewTextItem>(item);
textItem.enabled = enabled; textItem.enabled = textItemEnabled;
} else { } else {
NOTREACHED(); NOTREACHED();
} }
......
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