Commit 5ba833f0 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][DarkMode] Update colors in Sync Screen

Bug: 976640
Change-Id: I973711f79529998b33626b0af9e146271e8b1a80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1695411
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarJavier Ernesto Flores Robles <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676008}
parent c5bcdc96
...@@ -63,6 +63,7 @@ source_set("authentication") { ...@@ -63,6 +63,7 @@ source_set("authentication") {
"//ios/chrome/browser/ui/util", "//ios/chrome/browser/ui/util",
"//ios/chrome/browser/unified_consent", "//ios/chrome/browser/unified_consent",
"//ios/chrome/common", "//ios/chrome/common",
"//ios/chrome/common/colors",
"//ios/chrome/common/ui_util", "//ios/chrome/common/ui_util",
"//ios/public/provider/chrome/browser", "//ios/public/provider/chrome/browser",
"//ios/public/provider/chrome/browser/images", "//ios/public/provider/chrome/browser/images",
......
...@@ -19,19 +19,11 @@ extern const CGFloat kAuthenticationHorizontalMargin; ...@@ -19,19 +19,11 @@ extern const CGFloat kAuthenticationHorizontalMargin;
// Vertical margin between the header image and the main title. // Vertical margin between the header image and the main title.
extern const CGFloat kAuthenticationHeaderTitleMargin; extern const CGFloat kAuthenticationHeaderTitleMargin;
// Alpha for the title color.
extern const CGFloat kAuthenticationTitleColorAlpha;
// Alpha for the text color.
extern const CGFloat kAuthenticationTextColorAlpha;
// Alpha for the separator color. // Alpha for the separator color.
extern const CGFloat kAuthenticationSeparatorColorAlpha; extern const CGFloat kAuthenticationSeparatorColorAlpha;
// Height of the separator. // Height of the separator.
extern const CGFloat kAuthenticationSeparatorHeight; extern const CGFloat kAuthenticationSeparatorHeight;
// Color of the checkmark.
extern const int kAuthenticationCheckmarkColor;
// Header image name. // Header image name.
extern NSString* const kAuthenticationHeaderImageName; extern NSString* const kAuthenticationHeaderImageName;
......
...@@ -16,12 +16,7 @@ const UIFontTextStyle kAuthenticationTextFontStyle = UIFontTextStyleSubheadline; ...@@ -16,12 +16,7 @@ const UIFontTextStyle kAuthenticationTextFontStyle = UIFontTextStyleSubheadline;
const CGFloat kAuthenticationHorizontalMargin = 16.; const CGFloat kAuthenticationHorizontalMargin = 16.;
const CGFloat kAuthenticationHeaderTitleMargin = 19.; const CGFloat kAuthenticationHeaderTitleMargin = 19.;
const CGFloat kAuthenticationTitleColorAlpha = 0.87;
const CGFloat kAuthenticationTextColorAlpha = 0.54;
const CGFloat kAuthenticationSeparatorColorAlpha = 0.12; const CGFloat kAuthenticationSeparatorColorAlpha = 0.12;
const CGFloat kAuthenticationSeparatorHeight = 1; const CGFloat kAuthenticationSeparatorHeight = 1;
const int kAuthenticationCheckmarkColor = 0x1A73E8;
NSString* const kAuthenticationHeaderImageName = @"unified_consent_header"; NSString* const kAuthenticationHeaderImageName = @"unified_consent_header";
...@@ -102,8 +102,6 @@ using TimerGeneratorBlock = std::unique_ptr<base::OneShotTimer> (^)(); ...@@ -102,8 +102,6 @@ using TimerGeneratorBlock = std::unique_ptr<base::OneShotTimer> (^)();
@property(nonatomic, readonly) ios::ChromeBrowserState* browserState; @property(nonatomic, readonly) ios::ChromeBrowserState* browserState;
@property(nonatomic, readonly) UIColor* backgroundColor;
// Vertical padding used underneath buttons. Default value is 18. // Vertical padding used underneath buttons. Default value is 18.
@property(nonatomic, assign) CGFloat buttonVerticalPadding; @property(nonatomic, assign) CGFloat buttonVerticalPadding;
......
...@@ -39,13 +39,14 @@ ...@@ -39,13 +39,14 @@
#include "ios/chrome/browser/ui/authentication/signin_account_selector_view_controller.h" #include "ios/chrome/browser/ui/authentication/signin_account_selector_view_controller.h"
#include "ios/chrome/browser/ui/authentication/signin_confirmation_view_controller.h" #include "ios/chrome/browser/ui/authentication/signin_confirmation_view_controller.h"
#include "ios/chrome/browser/ui/authentication/unified_consent/unified_consent_coordinator.h" #include "ios/chrome/browser/ui/authentication/unified_consent/unified_consent_coordinator.h"
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/util/label_link_controller.h" #import "ios/chrome/browser/ui/util/label_link_controller.h"
#import "ios/chrome/browser/ui/util/rtl_geometry.h" #import "ios/chrome/browser/ui/util/rtl_geometry.h"
#import "ios/chrome/browser/ui/util/ui_util.h" #import "ios/chrome/browser/ui/util/ui_util.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#include "ios/chrome/browser/unified_consent/unified_consent_service_factory.h" #include "ios/chrome/browser/unified_consent/unified_consent_service_factory.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#include "ios/chrome/common/string_util.h" #include "ios/chrome/common/string_util.h"
#include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_chromium_strings.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
...@@ -144,7 +145,6 @@ enum AuthenticationState { ...@@ -144,7 +145,6 @@ enum AuthenticationState {
SigninAccountSelectorViewControllerDelegate, SigninAccountSelectorViewControllerDelegate,
UnifiedConsentCoordinatorDelegate> UnifiedConsentCoordinatorDelegate>
@property(nonatomic, strong) ChromeIdentity* selectedIdentity; @property(nonatomic, strong) ChromeIdentity* selectedIdentity;
@end @end
@implementation ChromeSigninViewController { @implementation ChromeSigninViewController {
...@@ -340,20 +340,21 @@ enum AuthenticationState { ...@@ -340,20 +340,21 @@ enum AuthenticationState {
} }
- (void)setPrimaryButtonStyling:(MDCButton*)button { - (void)setPrimaryButtonStyling:(MDCButton*)button {
[button setBackgroundColor:[[MDCPalette cr_bluePalette] tint500] [button setBackgroundColor:[UIColor colorNamed:kTintColor]
forState:UIControlStateNormal]; forState:UIControlStateNormal];
[button setImage:nil forState:UIControlStateNormal]; [button setImage:nil forState:UIControlStateNormal];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [button setTitleColor:[UIColor colorNamed:kSolidButtonTextColor]
[button setUnderlyingColorHint:[UIColor blackColor]]; forState:UIControlStateNormal];
[button setUnderlyingColorHint:UIColor.cr_systemBackgroundColor];
[button setInkColor:[UIColor colorWithWhite:1 alpha:0.2f]]; [button setInkColor:[UIColor colorWithWhite:1 alpha:0.2f]];
} }
- (void)setSecondaryButtonStyling:(MDCButton*)button { - (void)setSecondaryButtonStyling:(MDCButton*)button {
[button setBackgroundColor:self.backgroundColor [button setBackgroundColor:UIColor.cr_systemBackgroundColor
forState:UIControlStateNormal]; forState:UIControlStateNormal];
[button setTitleColor:[[MDCPalette cr_bluePalette] tint500] [button setTitleColor:[UIColor colorNamed:kTintColor]
forState:UIControlStateNormal]; forState:UIControlStateNormal];
[button setUnderlyingColorHint:[UIColor whiteColor]]; [button setUnderlyingColorHint:UIColor.cr_systemBackgroundColor];
[button setInkColor:[UIColor colorWithWhite:0 alpha:0.06f]]; [button setInkColor:[UIColor colorWithWhite:0 alpha:0.06f]];
} }
...@@ -461,6 +462,13 @@ enum AuthenticationState { ...@@ -461,6 +462,13 @@ enum AuthenticationState {
setCenter:CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds))]; setCenter:CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds))];
} }
- (void)updateGradientColors {
_gradientLayer.colors = @[
(id)[UIColor.cr_systemBackgroundColor colorWithAlphaComponent:0].CGColor,
(id)UIColor.cr_systemBackgroundColor.CGColor
];
}
#pragma mark - Accessibility #pragma mark - Accessibility
- (BOOL)accessibilityPerformEscape { - (BOOL)accessibilityPerformEscape {
...@@ -479,11 +487,6 @@ enum AuthenticationState { ...@@ -479,11 +487,6 @@ enum AuthenticationState {
return _delegate; return _delegate;
} }
- (UIColor*)backgroundColor {
return _unifiedConsentEnabled ? [UIColor whiteColor]
: [[MDCPalette greyPalette] tint50];
}
- (NSString*)identityPickerTitle { - (NSString*)identityPickerTitle {
return l10n_util::GetNSString(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_TITLE); return l10n_util::GetNSString(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_TITLE);
} }
...@@ -923,7 +926,7 @@ enum AuthenticationState { ...@@ -923,7 +926,7 @@ enum AuthenticationState {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = self.backgroundColor; self.view.backgroundColor = UIColor.cr_systemBackgroundColor;
_primaryButton = [[MDCFlatButton alloc] init]; _primaryButton = [[MDCFlatButton alloc] init];
[self setPrimaryButtonStyling:_primaryButton]; [self setPrimaryButtonStyling:_primaryButton];
...@@ -947,17 +950,14 @@ enum AuthenticationState { ...@@ -947,17 +950,14 @@ enum AuthenticationState {
[[MDCActivityIndicator alloc] initWithFrame:CGRectZero]; [[MDCActivityIndicator alloc] initWithFrame:CGRectZero];
[_activityIndicator setDelegate:self]; [_activityIndicator setDelegate:self];
[_activityIndicator setStrokeWidth:3]; [_activityIndicator setStrokeWidth:3];
[_activityIndicator [_activityIndicator setCycleColors:@[ [UIColor colorNamed:kTintColor] ]];
setCycleColors:@[ [[MDCPalette cr_bluePalette] tint500] ]];
[self.view addSubview:_activityIndicator]; [self.view addSubview:_activityIndicator];
} }
_gradientView = [[UIView alloc] initWithFrame:CGRectZero]; _gradientView = [[UIView alloc] initWithFrame:CGRectZero];
_gradientLayer = [CAGradientLayer layer]; _gradientLayer = [CAGradientLayer layer];
[_gradientView setUserInteractionEnabled:NO]; [_gradientView setUserInteractionEnabled:NO];
_gradientLayer.colors = [NSArray [self updateGradientColors];
arrayWithObjects:(id)[[UIColor colorWithWhite:1 alpha:0] CGColor],
(id)[self.backgroundColor CGColor], nil];
[[_gradientView layer] insertSublayer:_gradientLayer atIndex:0]; [[_gradientView layer] insertSublayer:_gradientLayer atIndex:0];
[self.view addSubview:_gradientView]; [self.view addSubview:_gradientView];
} }
...@@ -980,6 +980,23 @@ enum AuthenticationState { ...@@ -980,6 +980,23 @@ enum AuthenticationState {
[self updateLayout]; [self updateLayout];
} }
- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0)
if (@available(iOS 13, *)) {
if ([self.traitCollection
hasDifferentColorAppearanceComparedToTraitCollection:
previousTraitCollection]) {
[self updateGradientColors];
// As of iOS 13 Beta 3, MDCFlatButton doesn't update it's colors
// automatically. These lines do it instead.
[self updatePrimaryButtonForIdentityPickerState];
[self setSecondaryButtonStyling:_secondaryButton];
}
}
#endif
}
#pragma mark - Events #pragma mark - Events
- (void)onPrimaryButtonPressed:(id)sender { - (void)onPrimaryButtonPressed:(id)sender {
......
...@@ -42,7 +42,6 @@ source_set("unified_consent_ui") { ...@@ -42,7 +42,6 @@ source_set("unified_consent_ui") {
"//ios/chrome/browser/ui/authentication/unified_consent/identity_chooser:identity_chooser_ui", "//ios/chrome/browser/ui/authentication/unified_consent/identity_chooser:identity_chooser_ui",
"//ios/chrome/browser/ui/colors", "//ios/chrome/browser/ui/colors",
"//ios/chrome/browser/ui/util", "//ios/chrome/browser/ui/util",
"//ios/chrome/browser/ui/util",
"//ios/chrome/common", "//ios/chrome/common",
"//ios/chrome/common/colors", "//ios/chrome/common/colors",
"//ios/chrome/common/ui_util", "//ios/chrome/common/ui_util",
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#import "ios/chrome/browser/ui/util/label_link_controller.h" #import "ios/chrome/browser/ui/util/label_link_controller.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#include "ios/chrome/common/string_util.h" #include "ios/chrome/common/string_util.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h" #import "ios/chrome/common/ui_util/constraints_ui_util.h"
#include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_chromium_strings.h"
...@@ -168,7 +169,7 @@ const char* const kSettingsSyncURL = "internal://settings-sync"; ...@@ -168,7 +169,7 @@ const char* const kSettingsSyncURL = "internal://settings-sync";
UILabel* title = UILabel* title =
[self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE [self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_TITLE
fontStyle:kAuthenticationTitleFontStyle fontStyle:kAuthenticationTitleFontStyle
textColorAlpha:kAuthenticationTitleColorAlpha textColor:UIColor.cr_labelColor
parentView:container]; parentView:container];
// Identity picker view. // Identity picker view.
...@@ -184,20 +185,19 @@ const char* const kSettingsSyncURL = "internal://settings-sync"; ...@@ -184,20 +185,19 @@ const char* const kSettingsSyncURL = "internal://settings-sync";
UILabel* syncTitleLabel = UILabel* syncTitleLabel =
[self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_TITLE [self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_TITLE
fontStyle:kAuthenticationTextFontStyle fontStyle:kAuthenticationTextFontStyle
textColorAlpha:kAuthenticationTitleColorAlpha textColor:UIColor.cr_labelColor
parentView:container]; parentView:container];
UILabel* syncSubtitleLabel = UILabel* syncSubtitleLabel =
[self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE [self addLabelWithStringId:IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE
fontStyle:kAuthenticationTextFontStyle fontStyle:kAuthenticationTextFontStyle
textColorAlpha:kAuthenticationTextColorAlpha textColor:UIColor.cr_secondaryLabelColor
parentView:container]; parentView:container];
// Separator. // Separator.
UIView* separator = [[UIView alloc] initWithFrame:CGRectZero]; UIView* separator = [[UIView alloc] initWithFrame:CGRectZero];
separator.translatesAutoresizingMaskIntoConstraints = NO; separator.translatesAutoresizingMaskIntoConstraints = NO;
separator.backgroundColor = separator.backgroundColor = UIColor.cr_secondarySystemBackgroundColor;
[UIColor colorWithWhite:0 alpha:kAuthenticationSeparatorColorAlpha];
[container addSubview:separator]; [container addSubview:separator];
// Customize label. // Customize label.
...@@ -205,7 +205,7 @@ const char* const kSettingsSyncURL = "internal://settings-sync"; ...@@ -205,7 +205,7 @@ const char* const kSettingsSyncURL = "internal://settings-sync";
self.customizeSyncLabel = self.customizeSyncLabel =
[self addLabelWithStringId:self.openSettingsStringId [self addLabelWithStringId:self.openSettingsStringId
fontStyle:kAuthenticationTextFontStyle fontStyle:kAuthenticationTextFontStyle
textColorAlpha:kAuthenticationTextColorAlpha textColor:UIColor.cr_secondaryLabelColor
parentView:container]; parentView:container];
// Layouts // Layouts
...@@ -356,14 +356,14 @@ const char* const kSettingsSyncURL = "internal://settings-sync"; ...@@ -356,14 +356,14 @@ const char* const kSettingsSyncURL = "internal://settings-sync";
// Adds label with title |stringId| into |parentView|. // Adds label with title |stringId| into |parentView|.
- (UILabel*)addLabelWithStringId:(int)stringId - (UILabel*)addLabelWithStringId:(int)stringId
fontStyle:(UIFontTextStyle)fontStyle fontStyle:(UIFontTextStyle)fontStyle
textColorAlpha:(CGFloat)textColorAlpha textColor:(UIColor*)textColor
parentView:(UIView*)parentView { parentView:(UIView*)parentView {
DCHECK(stringId); DCHECK(stringId);
DCHECK(parentView); DCHECK(parentView);
UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero]; UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero];
label.translatesAutoresizingMaskIntoConstraints = NO; label.translatesAutoresizingMaskIntoConstraints = NO;
label.font = [UIFont preferredFontForTextStyle:fontStyle]; label.font = [UIFont preferredFontForTextStyle:fontStyle];
label.textColor = [UIColor colorWithWhite:0 alpha:textColorAlpha]; label.textColor = textColor;
label.text = l10n_util::GetNSString(stringId); label.text = l10n_util::GetNSString(stringId);
_consentStringIds.push_back(stringId); _consentStringIds.push_back(stringId);
label.numberOfLines = 0; label.numberOfLines = 0;
......
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