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;
self.viewController.unifiedConsentViewController =
self.unifiedConsentCoordinator.viewController;
switch (self.signinIntent) {
case UserSigninIntentFirstRun: {
[self presentFirstRun];
break;
}
case UserSigninIntentSignin:
case UserSigninIntentUpgrade: {
[self.baseViewController presentViewController:self.viewController
animated:YES
completion:nil];
break;
}
}
[self presentUserSigninViewController];
[self.logger logSigninStarted];
}
......@@ -360,19 +347,33 @@ const CGFloat kFadeOutAnimationDuration = 0.16f;
[self.advancedSettingsSigninCoordinator start];
}
// Displays the sign-in screen with transitions specific to first-run.
- (void)presentFirstRun {
DCHECK(self.viewController);
UINavigationController* navigationController =
base::mac::ObjCCastStrict<UINavigationController>(
self.baseViewController);
CATransition* transition = [CATransition animation];
transition.duration = kFadeOutAnimationDuration;
transition.type = kCATransitionFade;
[navigationController.view.layer addAnimation:transition
forKey:kCATransition];
[navigationController pushViewController:self.viewController animated:NO];
// Displays the user sign-in view controller using the available base
// controller. First run requires an additional transitional fade animation when
// presenting this view.
- (void)presentUserSigninViewController {
switch (self.signinIntent) {
case UserSigninIntentFirstRun: {
// Displays the sign-in screen with transitions specific to first-run.
DCHECK(self.baseNavigationController);
CATransition* transition = [CATransition animation];
transition.duration = kFadeOutAnimationDuration;
transition.type = kCATransitionFade;
[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
......
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