Commit 0a758ceb authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS][Unity] Fixing DCHECK failure when canceling sign-in

When the user refuse to sign-in with a managed account the current
UnifiedConsentCoordinator should be reused instead of creating a new
UnifiedConsentCoordinator instance.

Bug: 872288
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: Ib851ba3337fa95a39608397f82e336b65000f579
Reviewed-on: https://chromium-review.googlesource.com/c/1288435Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601101}
parent ff621269
...@@ -654,13 +654,20 @@ enum AuthenticationState { ...@@ -654,13 +654,20 @@ enum AuthenticationState {
- (void)enterIdentityPickerState { - (void)enterIdentityPickerState {
// Add the account selector view controller. // Add the account selector view controller.
if (_unifiedConsentEnabled) { if (_unifiedConsentEnabled) {
_unifiedConsentCoordinator = [[UnifiedConsentCoordinator alloc] init]; if (!_unifiedConsentCoordinator) {
_unifiedConsentCoordinator.interactable = YES; // The user can refuse to sign-in into a managed account, so the state
_unifiedConsentCoordinator.delegate = self; // returns to "IdentityPicker". In that case, there is no need to create a
if (_selectedIdentity) // new UnifiedConsentCoordinator. The current one should be used.
_unifiedConsentCoordinator.selectedIdentity = _selectedIdentity; _unifiedConsentCoordinator = [[UnifiedConsentCoordinator alloc] init];
[_unifiedConsentCoordinator start]; _unifiedConsentCoordinator.interactable = YES;
[self showEmbeddedViewController:_unifiedConsentCoordinator.viewController]; _unifiedConsentCoordinator.delegate = self;
if (_selectedIdentity)
_unifiedConsentCoordinator.selectedIdentity = _selectedIdentity;
[_unifiedConsentCoordinator start];
[self
showEmbeddedViewController:_unifiedConsentCoordinator.viewController];
}
DCHECK_EQ(_embeddedView, _unifiedConsentCoordinator.viewController.view);
} else { } else {
// Reset the selected identity. // Reset the selected identity.
[self setSelectedIdentity:nil]; [self setSelectedIdentity:nil];
......
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