Commit 9ff4415c authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Commit Bot

[iOS] Add the activity indicator animations to sign-in migration.

Show an activity indicator animation when the sign-in operation
is in progress and remove it if the user cancels the operation
while it has not yet been completed.

Bug: 971989
Change-Id: I0578f79318e7b0476c4d159ee163d00bbabb461d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079111Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746343}
parent 22efaceb
...@@ -105,6 +105,19 @@ enum AuthenticationButtonType { ...@@ -105,6 +105,19 @@ enum AuthenticationButtonType {
forControlEvents:UIControlEventTouchUpInside]; forControlEvents:UIControlEventTouchUpInside];
} }
#pragma mark - MDCActivityIndicator
- (void)startAnimatingActivityIndicator {
[self addActivityIndicatorToView];
[self.activityIndicator startAnimating];
}
- (void)stopAnimatingActivityIndicator {
[self.activityIndicator stopAnimating];
[self.activityIndicator removeFromSuperview];
self.activityIndicator = nil;
}
#pragma mark - UIViewController #pragma mark - UIViewController
- (void)viewDidLoad { - (void)viewDidLoad {
...@@ -113,7 +126,6 @@ enum AuthenticationButtonType { ...@@ -113,7 +126,6 @@ enum AuthenticationButtonType {
[self addConfirmationButtonToView]; [self addConfirmationButtonToView];
[self embedUserConsentView]; [self embedUserConsentView];
[self addActivityIndicatorToView];
[self addSkipSigninButtonToView]; [self addSkipSigninButtonToView];
// The layout constraints should be added at the end once all of the views // The layout constraints should be added at the end once all of the views
...@@ -126,7 +138,6 @@ enum AuthenticationButtonType { ...@@ -126,7 +138,6 @@ enum AuthenticationButtonType {
constants.ButtonBottomPadding + constants.ButtonBottomPadding +
constants.ButtonTopPadding, constants.ButtonTopPadding,
0)); 0));
AddSameCenterConstraints(self.view, self.activityIndicator);
AddSameConstraintsToSidesWithInsets( AddSameConstraintsToSidesWithInsets(
self.skipSigninButton, self.view, self.skipSigninButton, self.view,
LayoutSides::kBottom | LayoutSides::kLeading, LayoutSides::kBottom | LayoutSides::kLeading,
...@@ -179,9 +190,11 @@ enum AuthenticationButtonType { ...@@ -179,9 +190,11 @@ enum AuthenticationButtonType {
[[MDCActivityIndicator alloc] initWithFrame:CGRectZero]; [[MDCActivityIndicator alloc] initWithFrame:CGRectZero];
self.activityIndicator.strokeWidth = 3; self.activityIndicator.strokeWidth = 3;
self.activityIndicator.cycleColors = @[ [UIColor colorNamed:kBlueColor] ]; self.activityIndicator.cycleColors = @[ [UIColor colorNamed:kBlueColor] ];
self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.activityIndicator]; [self.view addSubview:self.activityIndicator];
self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
AddSameCenterConstraints(self.view, self.activityIndicator);
} }
// Embeds the user consent view in the root view. // Embeds the user consent view in the root view.
...@@ -261,11 +274,15 @@ enum AuthenticationButtonType { ...@@ -261,11 +274,15 @@ enum AuthenticationButtonType {
#pragma mark - Events #pragma mark - Events
- (void)onSkipSigninButtonPressed:(id)sender { - (void)onSkipSigninButtonPressed:(id)sender {
DCHECK_EQ(self.skipSigninButton, sender);
[self stopAnimatingActivityIndicator];
[self.delegate userSigninViewControllerDidTapOnSkipSignin]; [self.delegate userSigninViewControllerDidTapOnSkipSignin];
} }
- (void)onConfirmationButtonPressed:(id)sender { - (void)onConfirmationButtonPressed:(id)sender {
DCHECK_EQ(self.confirmationButton, sender); DCHECK_EQ(self.confirmationButton, sender);
switch (self.confirmationButton.tag) { switch (self.confirmationButton.tag) {
case AuthenticationButtonTypeMore: { case AuthenticationButtonTypeMore: {
[self.delegate userSigninViewControllerDidScrollOnUnifiedConsent]; [self.delegate userSigninViewControllerDidScrollOnUnifiedConsent];
...@@ -276,6 +293,7 @@ enum AuthenticationButtonType { ...@@ -276,6 +293,7 @@ enum AuthenticationButtonType {
break; break;
} }
case AuthenticationButtonTypeConfirmation: { case AuthenticationButtonTypeConfirmation: {
[self startAnimatingActivityIndicator];
[self.delegate userSigninViewControllerDidTapOnSignin]; [self.delegate userSigninViewControllerDidTapOnSignin];
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