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

[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: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601537}
parent 1cf07359
...@@ -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