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

[iOS] Update text labels in "Turn on Sync?" to follow Apple guidelines.

In Accessibility label sizes buttons are shown in vertical stack view.
Button titles will overflow instead of ellipsized if too large for the
label.

Before: https://drive.google.com/file/d/1bEClgvRNnxqnC3GVybBrVh4WRTHzfrAD/view?usp=sharing
After: https://drive.google.com/file/d/1OMh3XiRUwV5YcPZBii0Dh6NmhIZ-O0mE/view?usp=sharing


Bug: 1110243
Change-Id: Id8c99a16c8fca790c73c090028db6e4f3509e68b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2391080Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804194}
parent 4e19e2ae
......@@ -86,9 +86,8 @@ enum AuthenticationButtonType {
// Button used to exit the sign-in operation without confirmation, e.g. "No
// Thanks", "Cancel".
@property(nonatomic, strong) UIButton* skipSigninButton;
// Stack view that displays the skip and continue buttons on a horizontal
// layout.
@property(nonatomic, strong) UIStackView* horizontalButtonsView;
// Stack view that displays the skip and continue buttons.
@property(nonatomic, strong) UIStackView* actionButtonsView;
// Property that denotes whether the unified consent screen reached bottom has
// triggered.
@property(nonatomic, assign) BOOL hasUnifiedConsentScreenReachedBottom;
......@@ -114,7 +113,7 @@ enum AuthenticationButtonType {
- (void)markUnifiedConsentScreenReachedBottom {
// This is the first time the unified consent screen has reached the bottom.
if (self.hasUnifiedConsentScreenReachedBottom == NO) {
if (!self.hasUnifiedConsentScreenReachedBottom) {
self.hasUnifiedConsentScreenReachedBottom = YES;
[self setConfirmationButtonProperties];
}
......@@ -210,14 +209,12 @@ enum AuthenticationButtonType {
[self maybeEnablePointerSupportWithButton:self.skipSigninButton];
self.skipSigninButton.translatesAutoresizingMaskIntoConstraints = NO;
self.horizontalButtonsView = [[UIStackView alloc] initWithArrangedSubviews:@[
self.actionButtonsView = [[UIStackView alloc] initWithArrangedSubviews:@[
self.skipSigninButton, self.confirmationButton
]];
self.horizontalButtonsView.distribution =
UIStackViewDistributionEqualCentering;
self.horizontalButtonsView.axis = UILayoutConstraintAxisHorizontal;
self.horizontalButtonsView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.horizontalButtonsView];
self.actionButtonsView.distribution = UIStackViewDistributionEqualCentering;
self.actionButtonsView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:self.actionButtonsView];
self.unifiedConsentViewController.view
.translatesAutoresizingMaskIntoConstraints = NO;
......@@ -268,13 +265,13 @@ enum AuthenticationButtonType {
NSMutableArray* constraints = [NSMutableArray array];
[constraints addObjectsFromArray:@[
[self.view.safeAreaLayoutGuide.trailingAnchor
constraintEqualToAnchor:self.horizontalButtonsView.trailingAnchor
constraintEqualToAnchor:self.actionButtonsView.trailingAnchor
constant:constants.ButtonHorizontalPadding],
[self.view.safeAreaLayoutGuide.leadingAnchor
constraintEqualToAnchor:self.horizontalButtonsView.leadingAnchor
constraintEqualToAnchor:self.actionButtonsView.leadingAnchor
constant:-constants.ButtonHorizontalPadding],
[self.view.safeAreaLayoutGuide.bottomAnchor
constraintEqualToAnchor:self.horizontalButtonsView.bottomAnchor
constraintEqualToAnchor:self.actionButtonsView.bottomAnchor
constant:constants.ButtonVerticalPadding]
]];
return constraints;
......@@ -289,10 +286,12 @@ enum AuthenticationButtonType {
[NSLayoutConstraint deactivateConstraints:self.compactSizeClassConstraints];
[NSLayoutConstraint activateConstraints:self.regularSizeClassConstraints];
fontStyle = UIFontTextStyleTitle2;
self.actionButtonsView.axis = UILayoutConstraintAxisHorizontal;
} else {
[NSLayoutConstraint deactivateConstraints:self.regularSizeClassConstraints];
[NSLayoutConstraint activateConstraints:self.compactSizeClassConstraints];
fontStyle = UIFontTextStyleSubheadline;
self.actionButtonsView.axis = UILayoutConstraintAxisVertical;
}
[self applyDefaultSizeWithButton:self.confirmationButton fontStyle:fontStyle];
[self applyDefaultSizeWithButton:self.skipSigninButton fontStyle:fontStyle];
......@@ -356,7 +355,7 @@ enum AuthenticationButtonType {
[self.unifiedConsentViewController.view.trailingAnchor
constraintEqualToAnchor:self.containerView.trailingAnchor],
// Constraint between the container view and the horizontal buttons.
[self.horizontalButtonsView.topAnchor
[self.actionButtonsView.topAnchor
constraintEqualToAnchor:self.containerView.bottomAnchor
constant:kCompactConstants.ButtonVerticalPadding],
]];
......@@ -388,7 +387,7 @@ enum AuthenticationButtonType {
[self.unifiedConsentViewController.view.centerYAnchor
constraintEqualToAnchor:self.containerView.centerYAnchor],
// Constraint between the container view and the horizontal buttons.
[self.horizontalButtonsView.topAnchor
[self.actionButtonsView.topAnchor
constraintEqualToAnchor:self.containerView.bottomAnchor
constant:kRegularConstants.ButtonVerticalPadding],
]];
......@@ -496,6 +495,7 @@ enum AuthenticationButtonType {
UIEdgeInsetsMake(verticalContentInset, horizontalContentInset,
verticalContentInset, horizontalContentInset);
button.titleLabel.font = [UIFont preferredFontForTextStyle:fontStyle];
button.titleLabel.numberOfLines = 0;
}
#pragma mark - Events
......
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