diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 4348aa55b..53e1dcf03 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.6.0-beta.1" + s.version = "1.6.0-beta.2" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift index c1b503b50..1ddb44ddb 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift @@ -70,7 +70,7 @@ import WordPressUI /// Initializes the WordPressAuthenticator with the specified Configuration. /// public static func initialize(configuration: WordPressAuthenticatorConfiguration, - style: WordPressAuthenticatorStyle = .defaultStyle, + style: WordPressAuthenticatorStyle, displayStrings: WordPressAuthenticatorDisplayStrings = .defaultStrings) { guard privateInstance == nil else { fatalError("WordPressAuthenticator is already initialized") diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift index ca46099d3..21c81ceab 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift @@ -39,10 +39,20 @@ public struct WordPressAuthenticatorStyle { public let disabledTitleColor: UIColor - /// Style: Subheadline + /// Style: Text Buttons /// + public let textButtonColor: UIColor + + public let textButtonHighlightColor: UIColor + + /// Style: Labels + /// + public let instructionColor: UIColor + public let subheadlineColor: UIColor + public let placeholderColor: UIColor + /// Style: Login screen background colors /// public let viewControllerBackgroundColor: UIColor @@ -61,7 +71,7 @@ public struct WordPressAuthenticatorStyle { /// Designated initializer /// - public init(primaryNormalBackgroundColor: UIColor, primaryNormalBorderColor: UIColor, primaryHighlightBackgroundColor: UIColor, primaryHighlightBorderColor: UIColor, secondaryNormalBackgroundColor: UIColor, secondaryNormalBorderColor: UIColor, secondaryHighlightBackgroundColor: UIColor, secondaryHighlightBorderColor: UIColor, disabledBackgroundColor: UIColor, disabledBorderColor: UIColor, primaryTitleColor: UIColor, secondaryTitleColor: UIColor, disabledTitleColor: UIColor, subheadlineColor: UIColor, viewControllerBackgroundColor: UIColor, navBarImage: UIImage, prologueBackgroundColor: UIColor = WPStyleGuide.wordPressBlue(), prologueTitleColor: UIColor = .white) { + public init(primaryNormalBackgroundColor: UIColor, primaryNormalBorderColor: UIColor, primaryHighlightBackgroundColor: UIColor, primaryHighlightBorderColor: UIColor, secondaryNormalBackgroundColor: UIColor, secondaryNormalBorderColor: UIColor, secondaryHighlightBackgroundColor: UIColor, secondaryHighlightBorderColor: UIColor, disabledBackgroundColor: UIColor, disabledBorderColor: UIColor, primaryTitleColor: UIColor, secondaryTitleColor: UIColor, disabledTitleColor: UIColor, textButtonColor: UIColor, textButtonHighlightColor: UIColor, instructionColor: UIColor, subheadlineColor: UIColor, placeholderColor: UIColor, viewControllerBackgroundColor: UIColor, navBarImage: UIImage, prologueBackgroundColor: UIColor = WPStyleGuide.wordPressBlue(), prologueTitleColor: UIColor = .white) { self.primaryNormalBackgroundColor = primaryNormalBackgroundColor self.primaryNormalBorderColor = primaryNormalBorderColor self.primaryHighlightBackgroundColor = primaryHighlightBackgroundColor @@ -75,32 +85,14 @@ public struct WordPressAuthenticatorStyle { self.primaryTitleColor = primaryTitleColor self.secondaryTitleColor = secondaryTitleColor self.disabledTitleColor = disabledTitleColor + self.textButtonColor = textButtonColor + self.textButtonHighlightColor = textButtonHighlightColor + self.instructionColor = instructionColor self.subheadlineColor = subheadlineColor + self.placeholderColor = placeholderColor self.viewControllerBackgroundColor = viewControllerBackgroundColor self.navBarImage = navBarImage self.prologueBackgroundColor = prologueBackgroundColor self.prologueTitleColor = prologueTitleColor } } - -public extension WordPressAuthenticatorStyle { - static var defaultStyle: WordPressAuthenticatorStyle { - return WordPressAuthenticatorStyle(primaryNormalBackgroundColor: WPStyleGuide.mediumBlue(), - primaryNormalBorderColor: WPStyleGuide.wordPressBlue(), - primaryHighlightBackgroundColor: WPStyleGuide.wordPressBlue(), - primaryHighlightBorderColor: WPStyleGuide.wordPressBlue(), - secondaryNormalBackgroundColor: UIColor.white, - secondaryNormalBorderColor: WPStyleGuide.greyLighten20(), - secondaryHighlightBackgroundColor: WPStyleGuide.greyLighten20(), - secondaryHighlightBorderColor: WPStyleGuide.greyLighten20(), - disabledBackgroundColor: UIColor.white, - disabledBorderColor: WPStyleGuide.greyLighten30(), - primaryTitleColor: UIColor.white, - secondaryTitleColor: WPStyleGuide.darkGrey(), - disabledTitleColor: WPStyleGuide.greyLighten30(), - subheadlineColor: WPStyleGuide.wordPressBlue(), - viewControllerBackgroundColor: WPStyleGuide.lightGrey(), - navBarImage: Gridicon.iconOfType(.mySites) - ) - } -} diff --git a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift index 0cb7166b9..402fdb07d 100644 --- a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift +++ b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift @@ -7,7 +7,8 @@ final class SubheadlineButton: UIButton { super.traitCollectionDidChange(previousTraitCollection) if previousTraitCollection?.preferredContentSizeCategory != traitCollection.preferredContentSizeCategory { titleLabel?.font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline) - setTitleColor(WordPressAuthenticator.shared.style.subheadlineColor, for: .normal) + setTitleColor(WordPressAuthenticator.shared.style.textButtonColor, for: .normal) + setTitleColor(WordPressAuthenticator.shared.style.textButtonHighlightColor, for: .highlighted) } } } @@ -103,8 +104,8 @@ extension WPStyleGuide { class func googleLoginButton() -> UIButton { let baseString = NSLocalizedString("{G} Log in with Google.", comment: "Label for button to log in using Google. The {G} will be replaced with the Google logo.") - let attrStrNormal = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryNormalBorderColor) - let attrStrHighlight = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryHighlightBorderColor) + let attrStrNormal = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonColor) + let attrStrHighlight = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlightColor) let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline) @@ -118,8 +119,8 @@ extension WPStyleGuide { class func selfHostedLoginButton() -> UIButton { let baseString = NSLocalizedString("Log in by entering your site address.", comment: "Label for button to log in using your site address.") - let attrStrNormal = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryNormalBorderColor) - let attrStrHighlight = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.primaryHighlightBorderColor) + let attrStrNormal = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonColor) + let attrStrHighlight = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlightColor) let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline) @@ -210,7 +211,7 @@ extension WPStyleGuide { let labelString = NSMutableAttributedString(string: "") - if let originalDomainsIcon = Gridicon.iconOfType(.domains).imageWithTintColor(WPStyleGuide.greyLighten10()) { + if let originalDomainsIcon = Gridicon.iconOfType(.domains).imageWithTintColor(WordPressAuthenticator.shared.style.placeholderColor) { var domainsIcon = originalDomainsIcon.cropping(to: CGRect(x: Constants.domainsIconPaddingToRemove, y: Constants.domainsIconPaddingToRemove, width: originalDomainsIcon.size.width - Constants.domainsIconPaddingToRemove * 2, diff --git a/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift b/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift index 54566a7b5..d03170764 100644 --- a/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift +++ b/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift @@ -73,6 +73,7 @@ class NUXLinkMailViewController: LoginViewController { return NSLocalizedString("We sent you a magic signup link! Check your email on this device, and tap the link in the email to finish signing up.", comment: "Instructional text on how to open the email containing a magic link.") } }() + label?.textColor = WordPressAuthenticator.shared.style.instructionColor } // MARK: - Dynamic type diff --git a/WordPressAuthenticator/NUX/WPWalkthroughTextField.m b/WordPressAuthenticator/NUX/WPWalkthroughTextField.m index 4ad6a261a..b84662bca 100644 --- a/WordPressAuthenticator/NUX/WPWalkthroughTextField.m +++ b/WordPressAuthenticator/NUX/WPWalkthroughTextField.m @@ -88,6 +88,7 @@ - (void)commonInit // Apply styles to the placeholder if one was set in IB. if (self.placeholder) { + // colors here are overridden in LoginTextField NSDictionary *attributes = @{ NSForegroundColorAttributeName : WPStyleGuide.greyLighten10, NSFontAttributeName : self.font, @@ -110,6 +111,7 @@ - (void)configureSecureTextEntryToggle { self.secureTextEntryToggle = [UIButton buttonWithType:UIButtonTypeCustom]; self.secureTextEntryToggle.clipsToBounds = true; + // colors here are overridden in LoginTextField self.secureTextEntryToggle.tintColor = [WPStyleGuide greyLighten10]; [self.secureTextEntryToggle addTarget:self action:@selector(secureTextEntryToggleAction:) forControlEvents:UIControlEventTouchUpInside]; @@ -146,7 +148,6 @@ - (void)drawRect:(CGRect)rect CGContextAddPath(context, path.CGPath); CGContextSetStrokeColorWithColor(context, [UIColor colorWithWhite:0.87 alpha:1.0].CGColor); CGContextStrokePath(context); - } diff --git a/WordPressAuthenticator/Signin/Login.storyboard b/WordPressAuthenticator/Signin/Login.storyboard index ac62ab9f3..70a18c153 100644 --- a/WordPressAuthenticator/Signin/Login.storyboard +++ b/WordPressAuthenticator/Signin/Login.storyboard @@ -194,7 +194,7 @@ - + @@ -279,7 +279,7 @@ - - - - - -