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

[iOS] Enable Sync data switches in Settings during MICE sign-in.

Currently all switches are disabled because the Sync settings have not
been confirmed by this stage. This patch ignores Sync settings that are
not confirmed since the service will not handle any calls until it is
enabled.

Bug: 1125631
Change-Id: I8d3781153b5a0f32e70e6cf3965b42cc91e70bc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2470082
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817730}
parent d68cfee7
...@@ -90,7 +90,6 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -90,7 +90,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
ShowPassphraseDialogErrorItemType, ShowPassphraseDialogErrorItemType,
SyncNeedsTrustedVaultKeyErrorItemType, SyncNeedsTrustedVaultKeyErrorItemType,
SyncDisabledByAdministratorErrorItemType, SyncDisabledByAdministratorErrorItemType,
SyncSettingsNotCofirmedErrorItemType,
}; };
// Enterprise icon. // Enterprise icon.
...@@ -190,7 +189,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -190,7 +189,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
- (void)updateSyncEverythingItemNotifyConsumer:(BOOL)notifyConsumer { - (void)updateSyncEverythingItemNotifyConsumer:(BOOL)notifyConsumer {
BOOL shouldSyncEverythingBeEditable = BOOL shouldSyncEverythingBeEditable =
self.syncSetupService->IsSyncEnabled() && self.syncSetupService->IsSyncEnabled() &&
!self.disabledBecauseOfSyncError; (!self.disabledBecauseOfSyncError || self.syncSettingsNotConfirmed);
BOOL shouldSyncEverythingItemBeOn = BOOL shouldSyncEverythingItemBeOn =
self.syncSetupService->IsSyncEnabled() && self.syncSetupService->IsSyncEnabled() &&
self.syncSetupService->IsSyncingAllDataTypes(); self.syncSetupService->IsSyncingAllDataTypes();
...@@ -390,6 +389,12 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -390,6 +389,12 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
#pragma mark - Properties #pragma mark - Properties
- (BOOL)syncSettingsNotConfirmed {
SyncSetupService::SyncServiceState state =
self.syncSetupService->GetSyncServiceState();
return state == SyncSetupService::kSyncSettingsNotConfirmed;
}
- (BOOL)disabledBecauseOfSyncError { - (BOOL)disabledBecauseOfSyncError {
SyncSetupService::SyncServiceState state = SyncSetupService::SyncServiceState state =
self.syncSetupService->GetSyncServiceState(); self.syncSetupService->GetSyncServiceState();
...@@ -401,7 +406,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -401,7 +406,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
- (BOOL)shouldSyncDataItemEnabled { - (BOOL)shouldSyncDataItemEnabled {
return (!self.syncSetupService->IsSyncingAllDataTypes() && return (!self.syncSetupService->IsSyncingAllDataTypes() &&
self.syncSetupService->IsSyncEnabled() && self.syncSetupService->IsSyncEnabled() &&
!self.disabledBecauseOfSyncError); (!self.disabledBecauseOfSyncError || self.syncSettingsNotConfirmed));
} }
- (BOOL)shouldEncryptionItemBeEnabled { - (BOOL)shouldEncryptionItemBeEnabled {
...@@ -506,7 +511,6 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -506,7 +511,6 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
case ShowPassphraseDialogErrorItemType: case ShowPassphraseDialogErrorItemType:
case SyncNeedsTrustedVaultKeyErrorItemType: case SyncNeedsTrustedVaultKeyErrorItemType:
case SyncDisabledByAdministratorErrorItemType: case SyncDisabledByAdministratorErrorItemType:
case SyncSettingsNotCofirmedErrorItemType:
NOTREACHED(); NOTREACHED();
break; break;
} }
...@@ -554,7 +558,6 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -554,7 +558,6 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
case SettingsDataTypeItemType: case SettingsDataTypeItemType:
case AutocompleteWalletItemType: case AutocompleteWalletItemType:
case SyncDisabledByAdministratorErrorItemType: case SyncDisabledByAdministratorErrorItemType:
case SyncSettingsNotCofirmedErrorItemType:
// Nothing to do. // Nothing to do.
break; break;
} }
...@@ -566,22 +569,17 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -566,22 +569,17 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
// + ReauthDialogAsSyncIsInAuthErrorItemType // + ReauthDialogAsSyncIsInAuthErrorItemType
// + ShowPassphraseDialogErrorItemType // + ShowPassphraseDialogErrorItemType
// + SyncNeedsTrustedVaultKeyErrorItemType // + SyncNeedsTrustedVaultKeyErrorItemType
// + SyncSettingsNotCofirmedErrorItemType
- (TableViewItem*)createSyncErrorItemWithItemType:(NSInteger)itemType { - (TableViewItem*)createSyncErrorItemWithItemType:(NSInteger)itemType {
DCHECK(itemType == RestartAuthenticationFlowErrorItemType || DCHECK(itemType == RestartAuthenticationFlowErrorItemType ||
itemType == ReauthDialogAsSyncIsInAuthErrorItemType || itemType == ReauthDialogAsSyncIsInAuthErrorItemType ||
itemType == ShowPassphraseDialogErrorItemType || itemType == ShowPassphraseDialogErrorItemType ||
itemType == SyncNeedsTrustedVaultKeyErrorItemType || itemType == SyncNeedsTrustedVaultKeyErrorItemType);
itemType == SyncSettingsNotCofirmedErrorItemType);
SettingsImageDetailTextItem* syncErrorItem = SettingsImageDetailTextItem* syncErrorItem =
[[SettingsImageDetailTextItem alloc] initWithType:itemType]; [[SettingsImageDetailTextItem alloc] initWithType:itemType];
syncErrorItem.text = GetNSString(IDS_IOS_SYNC_ERROR_TITLE); syncErrorItem.text = GetNSString(IDS_IOS_SYNC_ERROR_TITLE);
syncErrorItem.detailText = syncErrorItem.detailText =
GetSyncErrorDescriptionForSyncSetupService(self.syncSetupService); GetSyncErrorDescriptionForSyncSetupService(self.syncSetupService);
if (itemType == SyncSettingsNotCofirmedErrorItemType) { if (itemType == ShowPassphraseDialogErrorItemType) {
// Special case for the sync error title.
syncErrorItem.text = GetNSString(IDS_IOS_SYNC_SETUP_NOT_CONFIRMED_TITLE);
} else if (itemType == ShowPassphraseDialogErrorItemType) {
// Special case only for the sync passphrase error message. The regular // Special case only for the sync passphrase error message. The regular
// error message should be still be displayed in the first settings screen. // error message should be still be displayed in the first settings screen.
syncErrorItem.detailText = GetNSString( syncErrorItem.detailText = GetNSString(
...@@ -653,9 +651,6 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -653,9 +651,6 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
hasError = YES; hasError = YES;
break; break;
case SyncSetupService::kSyncSettingsNotConfirmed: case SyncSetupService::kSyncSettingsNotConfirmed:
type = SyncSettingsNotCofirmedErrorItemType;
hasError = YES;
break;
case SyncSetupService::kNoSyncServiceError: case SyncSetupService::kNoSyncServiceError:
case SyncSetupService::kSyncServiceCouldNotConnect: case SyncSetupService::kSyncServiceCouldNotConnect:
case SyncSetupService::kSyncServiceServiceUnavailable: case SyncSetupService::kSyncServiceServiceUnavailable:
......
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