Commit 59923b85 authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Commit Bot

[iOS] Refactor method to display first-run sign-in view controller.

As a part of the sign-in architecture migration clarify the difference
between presenting the sign-in flow for first-run using a navigation
controller and presenting the sign-in flow for upgrade and normal
sign-in using a view controller.

This is a follow-up to patch 2107866.

Bug: 971989
Change-Id: Ia31a47b86956e9db701b8cc1ce6679e71c293278
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095069Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Auto-Submit: Nohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752023}
parent ea1fe589
...@@ -131,20 +131,7 @@ const CGFloat kFadeOutAnimationDuration = 0.16f; ...@@ -131,20 +131,7 @@ const CGFloat kFadeOutAnimationDuration = 0.16f;
self.viewController.unifiedConsentViewController = self.viewController.unifiedConsentViewController =
self.unifiedConsentCoordinator.viewController; self.unifiedConsentCoordinator.viewController;
switch (self.signinIntent) { [self presentUserSigninViewController];
case UserSigninIntentFirstRun: {
[self presentFirstRun];
break;
}
case UserSigninIntentSignin:
case UserSigninIntentUpgrade: {
[self.baseViewController presentViewController:self.viewController
animated:YES
completion:nil];
break;
}
}
[self.logger logSigninStarted]; [self.logger logSigninStarted];
} }
...@@ -360,19 +347,33 @@ const CGFloat kFadeOutAnimationDuration = 0.16f; ...@@ -360,19 +347,33 @@ const CGFloat kFadeOutAnimationDuration = 0.16f;
[self.advancedSettingsSigninCoordinator start]; [self.advancedSettingsSigninCoordinator start];
} }
// Displays the sign-in screen with transitions specific to first-run. // Displays the user sign-in view controller using the available base
- (void)presentFirstRun { // controller. First run requires an additional transitional fade animation when
DCHECK(self.viewController); // presenting this view.
UINavigationController* navigationController = - (void)presentUserSigninViewController {
base::mac::ObjCCastStrict<UINavigationController>( switch (self.signinIntent) {
self.baseViewController); case UserSigninIntentFirstRun: {
// Displays the sign-in screen with transitions specific to first-run.
CATransition* transition = [CATransition animation]; DCHECK(self.baseNavigationController);
transition.duration = kFadeOutAnimationDuration;
transition.type = kCATransitionFade; CATransition* transition = [CATransition animation];
[navigationController.view.layer addAnimation:transition transition.duration = kFadeOutAnimationDuration;
forKey:kCATransition]; transition.type = kCATransitionFade;
[navigationController pushViewController:self.viewController animated:NO]; [self.baseNavigationController.view.layer addAnimation:transition
forKey:kCATransition];
[self.baseNavigationController pushViewController:self.viewController
animated:NO];
break;
}
case UserSigninIntentUpgrade:
case UserSigninIntentSignin: {
DCHECK(self.baseViewController);
[self.baseViewController presentViewController:self.viewController
animated:YES
completion:nil];
break;
}
}
} }
// Interrupts the sign-in when |self.viewController| is presented, by dismissing // Interrupts the sign-in when |self.viewController| is presented, by dismissing
......
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