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

[iOS] Adding UI to display sync error

Adding cell to a sync error if it exists. This cell disappears when the error
is fixed. The asset is missing.

https://docs.google.com/presentation/d/1cZfr5FGWGSy0PNaQ8uzik0alLAH-5glh1vsb030vha8/edit?ts=5aba5455#slide=id.g3e63bc1501_10_15

Screenshot (shared with chromium accounts):
https://drive.google.com/open?id=1S8kzlFmUwErOTn3BFC-2rR7KBeOX-V9i

Bug: 849754
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I69eeac598b5d1742528acb16d8c0cc672580b402
Reviewed-on: https://chromium-review.googlesource.com/1231333
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594753}
parent 35b382aa
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
// The detail text to display. // The detail text to display.
@property(nonatomic, copy) NSString* detailText; @property(nonatomic, copy) NSString* detailText;
// Command to trigger when the switch is toggled. The default value is 0.
@property(nonatomic, assign) NSInteger commandID;
@end @end
// Cell representation for SettingsImageDetailTextItem. // Cell representation for SettingsImageDetailTextItem.
......
...@@ -41,6 +41,7 @@ const CGFloat kHorizontalImagePadding = 10; ...@@ -41,6 +41,7 @@ const CGFloat kHorizontalImagePadding = 10;
@synthesize image = _image; @synthesize image = _image;
@synthesize text = _text; @synthesize text = _text;
@synthesize detailText = _detailText; @synthesize detailText = _detailText;
@synthesize commandID = _commandID;
- (instancetype)initWithType:(NSInteger)type { - (instancetype)initWithType:(NSInteger)type {
self = [super initWithType:type]; self = [super initWithType:type];
......
...@@ -16,10 +16,19 @@ ...@@ -16,10 +16,19 @@
@property(nonatomic, strong, readonly) @property(nonatomic, strong, readonly)
CollectionViewModel<CollectionViewItem*>* collectionViewModel; CollectionViewModel<CollectionViewItem*>* collectionViewModel;
// Reloads |sections|. // Inserts sections at |sections| indexes. Does nothing if the model is not
// loaded yet.
- (void)insertSections:(NSIndexSet*)sections;
// Deletes sections at |sections| indexes. Does nothing if the model is not
// loaded yet.
- (void)deleteSections:(NSIndexSet*)sections;
// Reloads |sections|. Does nothing if the model is not loaded yet.
- (void)reloadSections:(NSIndexSet*)sections; - (void)reloadSections:(NSIndexSet*)sections;
// Reloads only a specific |item|. // Reloads only a specific |item|. Does nothing if the model is not loaded
// yet.
- (void)reloadItem:(CollectionViewItem*)item; - (void)reloadItem:(CollectionViewItem*)item;
@end @end
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "ios/chrome/browser/sync/sync_setup_service_factory.h" #include "ios/chrome/browser/sync/sync_setup_service_factory.h"
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/commands/show_signin_command.h"
#import "ios/chrome/browser/ui/icons/chrome_icon.h" #import "ios/chrome/browser/ui/icons/chrome_icon.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_local_commands.h" #import "ios/chrome/browser/ui/settings/google_services_settings_local_commands.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_mediator.h" #import "ios/chrome/browser/ui/settings/google_services_settings_mediator.h"
...@@ -96,6 +97,25 @@ ...@@ -96,6 +97,25 @@
#pragma mark - GoogleServicesSettingsLocalCommands #pragma mark - GoogleServicesSettingsLocalCommands
- (void)restartAuthenticationFlow {
// TODO(crbug.com/849754): Restart the authentication flow.
}
- (void)openReauthDialogAsSyncIsInAuthError {
// Sync enters in a permanent auth error state when fetching an access token
// fails with invalid credentials. This corresponds to Gaia responding with an
// "invalid grant" error. The current implementation of the iOS SSOAuth
// library user by Chrome removes the identity from the device when receiving
// an "invalid grant" response, which leads to the account being also signed
// out of Chrome. So the sync permanent auth error is a transient state on
// iOS. The decision was to avoid handling this error in the UI, which means
// that the reauth dialog is not actually presented on iOS.
}
- (void)openPassphraseDialog {
// TODO(crbug.com/849754): open the passphrase dialog.
}
- (void)openGoogleActivityControlsDialog { - (void)openGoogleActivityControlsDialog {
base::RecordAction(base::UserMetricsAction( base::RecordAction(base::UserMetricsAction(
"Signin_AccountSettings_GoogleActivityControlsClicked")); "Signin_AccountSettings_GoogleActivityControlsClicked"));
......
...@@ -8,11 +8,22 @@ ...@@ -8,11 +8,22 @@
// Protocol to communicate GoogleServicesSettingsVC actions to its coordinator. // Protocol to communicate GoogleServicesSettingsVC actions to its coordinator.
@protocol GoogleServicesSettingsLocalCommands<NSObject> @protocol GoogleServicesSettingsLocalCommands<NSObject>
// Called when the "Google Activity Controls" dialog should be opened. // Restarts the authentication flow.
- (void)restartAuthenticationFlow;
// Opens the reauth sync dialog.
- (void)openReauthDialogAsSyncIsInAuthError;
// Opens the passphrase dialog.
- (void)openPassphraseDialog;
// Opens the "Google Activity Controls" dialog.
- (void)openGoogleActivityControlsDialog; - (void)openGoogleActivityControlsDialog;
// Called when the "Encryption" dialog should be opened.
// Opens the "Encryption" dialog.
- (void)openEncryptionDialog; - (void)openEncryptionDialog;
// Called when the "Manage Synced Data" web page should be opened.
// Opens the "Manage Synced Data" web page.
- (void)openManageSyncedDataWebPage; - (void)openManageSyncedDataWebPage;
@end @end
......
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
#import "ios/chrome/browser/ui/settings/cells/settings_collapsible_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_collapsible_item.h"
#import "ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h"
#import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h"
#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h"
#import "ios/chrome/browser/ui/settings/utils/observable_boolean.h" #import "ios/chrome/browser/ui/settings/utils/observable_boolean.h"
#import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h" #import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h"
#include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_chromium_strings.h"
...@@ -43,7 +45,8 @@ namespace { ...@@ -43,7 +45,8 @@ namespace {
// List of sections. // List of sections.
typedef NS_ENUM(NSInteger, SectionIdentifier) { typedef NS_ENUM(NSInteger, SectionIdentifier) {
SyncEverythingSectionIdentifier = kSectionIdentifierEnumZero, SyncFeedbackSectionIdentifier = kSectionIdentifierEnumZero,
SyncEverythingSectionIdentifier,
PersonalizedSectionIdentifier, PersonalizedSectionIdentifier,
NonPersonalizedSectionIdentifier, NonPersonalizedSectionIdentifier,
}; };
...@@ -56,8 +59,10 @@ NSString* const kGoogleServicesSettingsNonPersonalizedSectionKey = ...@@ -56,8 +59,10 @@ NSString* const kGoogleServicesSettingsNonPersonalizedSectionKey =
// List of items. // List of items.
typedef NS_ENUM(NSInteger, ItemType) { typedef NS_ENUM(NSInteger, ItemType) {
// SyncErrorSectionIdentifier,
SyncErrorItemType = kItemTypeEnumZero,
// SyncEverythingSectionIdentifier section. // SyncEverythingSectionIdentifier section.
SyncEverythingItemType = kItemTypeEnumZero, SyncEverythingItemType,
// PersonalizedSectionIdentifier section. // PersonalizedSectionIdentifier section.
SyncPersonalizationItemType, SyncPersonalizationItemType,
SyncBookmarksItemType, SyncBookmarksItemType,
...@@ -129,10 +134,12 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -129,10 +134,12 @@ typedef NS_ENUM(NSInteger, ItemType) {
// YES if the switch for |syncEverythingItem| is currently animating from one // YES if the switch for |syncEverythingItem| is currently animating from one
// state to another. // state to another.
@property(nonatomic, assign, readwrite) BOOL syncEverythingSwitchBeingAnimated; @property(nonatomic, assign) BOOL syncEverythingSwitchBeingAnimated;
// YES if at least one switch in the personalized section is currently animating // YES if at least one switch in the personalized section is currently animating
// from one state to another. // from one state to another.
@property(nonatomic, assign, readwrite) BOOL personalizedSectionBeingAnimated; @property(nonatomic, assign) BOOL personalizedSectionBeingAnimated;
// Item to display the sync error.
@property(nonatomic, strong) SettingsImageDetailTextItem* syncErrorItem;
// Item for "Sync Everything" section. // Item for "Sync Everything" section.
@property(nonatomic, strong, readonly) SyncSwitchItem* syncEverythingItem; @property(nonatomic, strong, readonly) SyncSwitchItem* syncEverythingItem;
// Collapsible item for the personalized section. // Collapsible item for the personalized section.
...@@ -168,6 +175,7 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -168,6 +175,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
_syncEverythingSwitchBeingAnimated; _syncEverythingSwitchBeingAnimated;
@synthesize personalizedSectionBeingAnimated = @synthesize personalizedSectionBeingAnimated =
_personalizedSectionBeingAnimated; _personalizedSectionBeingAnimated;
@synthesize syncErrorItem = _syncErrorItem;
@synthesize syncEverythingItem = _syncEverythingItem; @synthesize syncEverythingItem = _syncEverythingItem;
@synthesize syncPersonalizationItem = _syncPersonalizationItem; @synthesize syncPersonalizationItem = _syncPersonalizationItem;
@synthesize personalizedItems = _personalizedItems; @synthesize personalizedItems = _personalizedItems;
...@@ -287,6 +295,23 @@ initWithUserPrefService:(PrefService*)userPrefService ...@@ -287,6 +295,23 @@ initWithUserPrefService:(PrefService*)userPrefService
return self.unifiedConsentService->IsUnifiedConsentGiven(); return self.unifiedConsentService->IsUnifiedConsentGiven();
} }
- (SettingsImageDetailTextItem*)syncErrorItem {
if (!_syncErrorItem) {
_syncErrorItem =
[[SettingsImageDetailTextItem alloc] initWithType:SyncErrorItemType];
{
// TODO(crbug.com/889470): Needs asset for the sync error.
CGSize size = CGSizeMake(40, 40);
UIGraphicsBeginImageContextWithOptions(size, YES, 0);
[[UIColor grayColor] setFill];
UIRectFill(CGRectMake(0, 0, size.width, size.height));
_syncErrorItem.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
}
return _syncErrorItem;
}
- (CollectionViewItem*)syncEverythingItem { - (CollectionViewItem*)syncEverythingItem {
if (!_syncEverythingItem) { if (!_syncEverythingItem) {
_syncEverythingItem = [self _syncEverythingItem = [self
...@@ -518,6 +543,69 @@ textItemWithItemType:(NSInteger)itemType ...@@ -518,6 +543,69 @@ textItemWithItemType:(NSInteger)itemType
return textItem; return textItem;
} }
// Reloads the sync feedback section. If |notifyConsummer| is YES, the consomer
// is notified to add or remove the sync error section.
- (void)updateSyncErrorSectionAndNotifyConsumer:(BOOL)notifyConsummer {
CollectionViewModel* model = self.consumer.collectionViewModel;
GoogleServicesSettingsCommandID commandID =
GoogleServicesSettingsCommandIDNoOp;
if (self.isAuthenticated) {
switch (self.syncSetupService->GetSyncServiceState()) {
case SyncSetupService::kSyncServiceUnrecoverableError:
commandID = GoogleServicesSettingsCommandIDRestartAuthenticationFlow;
break;
case SyncSetupService::kSyncServiceSignInNeedsUpdate:
commandID = GoogleServicesSettingsReauthDialogAsSyncIsInAuthError;
break;
case SyncSetupService::kSyncServiceNeedsPassphrase:
commandID = GoogleServicesSettingsCommandIDShowPassphraseDialog;
break;
case SyncSetupService::kNoSyncServiceError:
case SyncSetupService::kSyncServiceCouldNotConnect:
case SyncSetupService::kSyncServiceServiceUnavailable:
break;
}
}
if (commandID == GoogleServicesSettingsCommandIDNoOp) {
// No action to do, therefore the sync error section should not be visibled.
if ([model hasSectionForSectionIdentifier:SyncFeedbackSectionIdentifier]) {
// Remove the sync error item if it exists.
NSUInteger sectionIndex =
[model sectionForSectionIdentifier:SyncFeedbackSectionIdentifier];
[model removeSectionWithIdentifier:SyncFeedbackSectionIdentifier];
if (notifyConsummer) {
NSIndexSet* indexSet = [NSIndexSet indexSetWithIndex:sectionIndex];
[self.consumer deleteSections:indexSet];
}
}
return;
}
// Add the sync error item and its section (if it doesn't already exist) and
// reload them.
BOOL sectionAdded = NO;
if (![model hasSectionForSectionIdentifier:SyncFeedbackSectionIdentifier]) {
// Adding the sync error item and its section.
[model insertSectionWithIdentifier:SyncFeedbackSectionIdentifier atIndex:0];
[model addItem:self.syncErrorItem
toSectionWithIdentifier:SyncFeedbackSectionIdentifier];
sectionAdded = YES;
}
NSUInteger sectionIndex =
[model sectionForSectionIdentifier:SyncFeedbackSectionIdentifier];
self.syncErrorItem.text = l10n_util::GetNSString(IDS_IOS_SYNC_ERROR_TITLE);
self.syncErrorItem.detailText =
GetSyncErrorDescriptionForSyncSetupService(self.syncSetupService);
self.syncErrorItem.commandID = commandID;
if (notifyConsummer) {
if (sectionAdded) {
NSIndexSet* indexSet = [NSIndexSet indexSetWithIndex:sectionIndex];
[self.consumer insertSections:indexSet];
} else {
[self.consumer reloadItem:self.syncErrorItem];
}
}
}
// Updates the personalized section according to the user consent. // Updates the personalized section according to the user consent.
- (void)updatePersonalizedSection { - (void)updatePersonalizedSection {
BOOL enabled = self.isAuthenticated && !self.isConsentGiven; BOOL enabled = self.isAuthenticated && !self.isConsentGiven;
...@@ -606,6 +694,7 @@ textItemWithItemType:(NSInteger)itemType ...@@ -606,6 +694,7 @@ textItemWithItemType:(NSInteger)itemType
[self loadSyncEverythingSection]; [self loadSyncEverythingSection];
[self loadPersonalizedSection]; [self loadPersonalizedSection];
[self loadNonPersonalizedSection]; [self loadNonPersonalizedSection];
[self updateSyncErrorSectionAndNotifyConsumer:NO];
} }
#pragma mark - GoogleServicesSettingsServiceDelegate #pragma mark - GoogleServicesSettingsServiceDelegate
...@@ -705,6 +794,7 @@ textItemWithItemType:(NSInteger)itemType ...@@ -705,6 +794,7 @@ textItemWithItemType:(NSInteger)itemType
// personalized section), if the autofill feature changed state. // personalized section), if the autofill feature changed state.
[self.consumer reloadItem:self.autocompleteWalletItem]; [self.consumer reloadItem:self.autocompleteWalletItem];
} }
[self updateSyncErrorSectionAndNotifyConsumer:YES];
} }
#pragma mark - BooleanObserver #pragma mark - BooleanObserver
......
...@@ -9,6 +9,17 @@ ...@@ -9,6 +9,17 @@
typedef NS_ENUM(NSInteger, GoogleServicesSettingsCommandID) { typedef NS_ENUM(NSInteger, GoogleServicesSettingsCommandID) {
// Does nothing. // Does nothing.
GoogleServicesSettingsCommandIDNoOp, GoogleServicesSettingsCommandIDNoOp,
// Restarts the sign-in authentication flow. Related to error:
// SyncSetupService::kSyncServiceUnrecoverableError.
GoogleServicesSettingsCommandIDRestartAuthenticationFlow,
// Opens the reauth sync dialog. Related to error:
// SyncSetupService::kSyncServiceNeedsPassphrase.
GoogleServicesSettingsReauthDialogAsSyncIsInAuthError,
// Opens the passphrase dialog. Related to error:
// SyncSetupService::kSyncServiceNeedsPassphrase.
GoogleServicesSettingsCommandIDShowPassphraseDialog,
// Enabble/disable all the Google services. // Enabble/disable all the Google services.
GoogleServicesSettingsCommandIDToggleSyncEverything, GoogleServicesSettingsCommandIDToggleSyncEverything,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
#import "ios/chrome/browser/ui/settings/cells/settings_collapsible_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_collapsible_item.h"
#import "ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h"
#import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h" #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_local_commands.h" #import "ios/chrome/browser/ui/settings/google_services_settings_local_commands.h"
#import "ios/chrome/browser/ui/settings/google_services_settings_service_delegate.h" #import "ios/chrome/browser/ui/settings/google_services_settings_service_delegate.h"
...@@ -125,10 +126,14 @@ constexpr NSInteger kSectionOffset = 1000; ...@@ -125,10 +126,14 @@ constexpr NSInteger kSectionOffset = 1000;
case GoogleServicesSettingsCommandIDToggleBetterSearchAndBrowsingService: case GoogleServicesSettingsCommandIDToggleBetterSearchAndBrowsingService:
[self.serviceDelegate toggleBetterSearchAndBrowsingServiceWithValue:isOn]; [self.serviceDelegate toggleBetterSearchAndBrowsingServiceWithValue:isOn];
break; break;
case GoogleServicesSettingsCommandIDRestartAuthenticationFlow:
case GoogleServicesSettingsReauthDialogAsSyncIsInAuthError:
case GoogleServicesSettingsCommandIDShowPassphraseDialog:
case GoogleServicesSettingsCommandIDNoOp: case GoogleServicesSettingsCommandIDNoOp:
case GoogleServicesSettingsCommandIDOpenGoogleActivityControlsDialog: case GoogleServicesSettingsCommandIDOpenGoogleActivityControlsDialog:
case GoogleServicesSettingsCommandIDOpenEncryptionDialog: case GoogleServicesSettingsCommandIDOpenEncryptionDialog:
case GoogleServicesSettingsCommandIDOpenManageSyncedDataWebPage: case GoogleServicesSettingsCommandIDOpenManageSyncedDataWebPage:
// Command ID not related with switch action.
NOTREACHED(); NOTREACHED();
break; break;
} }
...@@ -151,6 +156,24 @@ constexpr NSInteger kSectionOffset = 1000; ...@@ -151,6 +156,24 @@ constexpr NSInteger kSectionOffset = 1000;
return cell; return cell;
} }
#pragma mark - GoogleServicesSettingsConsumer
- (void)insertSections:(NSIndexSet*)sections {
if (!self.collectionViewModel) {
// No need to reload since the model has not been loaded yet.
return;
}
[self.collectionView insertSections:sections];
}
- (void)deleteSections:(NSIndexSet*)sections {
if (!self.collectionViewModel) {
// No need to reload since the model has not been loaded yet.
return;
}
[self.collectionView deleteSections:sections];
}
- (void)reloadSections:(NSIndexSet*)sections { - (void)reloadSections:(NSIndexSet*)sections {
if (!self.collectionViewModel) { if (!self.collectionViewModel) {
// No need to reload since the model has not been loaded yet. // No need to reload since the model has not been loaded yet.
...@@ -214,13 +237,19 @@ constexpr NSInteger kSectionOffset = 1000; ...@@ -214,13 +237,19 @@ constexpr NSInteger kSectionOffset = 1000;
[self.collectionViewModel itemAtIndexPath:indexPath]; [self.collectionViewModel itemAtIndexPath:indexPath];
if ([item isKindOfClass:[SyncSwitchItem class]]) { if ([item isKindOfClass:[SyncSwitchItem class]]) {
return NO; return NO;
} else if ([item isKindOfClass:[SettingsCollapsibleItem class]]) { } else if ([item isKindOfClass:[SettingsCollapsibleItem class]] ||
[item isKindOfClass:[SettingsImageDetailTextItem class]]) {
return YES; return YES;
} 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);
return textItem.enabled; return textItem.enabled;
} }
// The highlight of an item should be explicitly defined. If the item can be
// highlighted, then a command ID should be defined in
// -[GoogleServicesSettingsViewController collectionView:
// didSelectItemAtIndexPath:].
NOTREACHED();
return NO; return NO;
} }
...@@ -233,12 +262,32 @@ constexpr NSInteger kSectionOffset = 1000; ...@@ -233,12 +262,32 @@ constexpr NSInteger kSectionOffset = 1000;
[self toggleSectionWithIndexPath:indexPath]; [self toggleSectionWithIndexPath:indexPath];
return; return;
} }
CollectionViewTextItem* textItem =
base::mac::ObjCCastStrict<CollectionViewTextItem>(
[self.collectionViewModel itemAtIndexPath:indexPath]);
GoogleServicesSettingsCommandID commandID = GoogleServicesSettingsCommandID commandID =
static_cast<GoogleServicesSettingsCommandID>(textItem.commandID); GoogleServicesSettingsCommandIDNoOp;
if ([item isKindOfClass:[CollectionViewTextItem class]]) {
CollectionViewTextItem* textItem =
base::mac::ObjCCast<CollectionViewTextItem>(item);
commandID =
static_cast<GoogleServicesSettingsCommandID>(textItem.commandID);
} else if ([item isKindOfClass:[SettingsImageDetailTextItem class]]) {
SettingsImageDetailTextItem* imageDetailTextItem =
base::mac::ObjCCast<SettingsImageDetailTextItem>(item);
commandID = static_cast<GoogleServicesSettingsCommandID>(
imageDetailTextItem.commandID);
} else {
// A command ID should be defined when the cell is selected.
NOTREACHED();
}
switch (commandID) { switch (commandID) {
case GoogleServicesSettingsCommandIDRestartAuthenticationFlow:
[self.localDispatcher restartAuthenticationFlow];
break;
case GoogleServicesSettingsReauthDialogAsSyncIsInAuthError:
[self.localDispatcher openReauthDialogAsSyncIsInAuthError];
break;
case GoogleServicesSettingsCommandIDShowPassphraseDialog:
[self.localDispatcher openPassphraseDialog];
break;
case GoogleServicesSettingsCommandIDOpenGoogleActivityControlsDialog: case GoogleServicesSettingsCommandIDOpenGoogleActivityControlsDialog:
[self.localDispatcher openGoogleActivityControlsDialog]; [self.localDispatcher openGoogleActivityControlsDialog];
break; break;
...@@ -256,6 +305,7 @@ constexpr NSInteger kSectionOffset = 1000; ...@@ -256,6 +305,7 @@ constexpr NSInteger kSectionOffset = 1000;
case GoogleServicesSettingsCommandIDTogglePreloadPagesService: case GoogleServicesSettingsCommandIDTogglePreloadPagesService:
case GoogleServicesSettingsCommandIDToggleImproveChromeService: case GoogleServicesSettingsCommandIDToggleImproveChromeService:
case GoogleServicesSettingsCommandIDToggleBetterSearchAndBrowsingService: case GoogleServicesSettingsCommandIDToggleBetterSearchAndBrowsingService:
// Command ID not related with cell selection.
NOTREACHED(); NOTREACHED();
break; break;
} }
......
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