diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift index 164ea6f55..ea4a33bc2 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift @@ -1,4 +1,5 @@ - +import UIKit +import Gridicons // MARK: - WordPress Authenticator Styles // @@ -41,9 +42,17 @@ public struct WordPressAuthenticatorStyle { /// public let subheadlineColor: UIColor + /// Style: Login screen background colors + /// + public let viewControllerBackgroundColor: UIColor + + /// Style: nav bar logo + /// + public let navBarImage: UIImage + /// 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) { + 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) { self.primaryNormalBackgroundColor = primaryNormalBackgroundColor self.primaryNormalBorderColor = primaryNormalBorderColor self.primaryHighlightBackgroundColor = primaryHighlightBackgroundColor @@ -58,6 +67,8 @@ public struct WordPressAuthenticatorStyle { self.secondaryTitleColor = secondaryTitleColor self.disabledTitleColor = disabledTitleColor self.subheadlineColor = subheadlineColor + self.viewControllerBackgroundColor = viewControllerBackgroundColor + self.navBarImage = navBarImage } } @@ -76,6 +87,9 @@ public extension WordPressAuthenticatorStyle { primaryTitleColor: UIColor.white, secondaryTitleColor: WPStyleGuide.darkGrey(), disabledTitleColor: WPStyleGuide.greyLighten30(), - subheadlineColor: WPStyleGuide.wordPressBlue()) + subheadlineColor: WPStyleGuide.wordPressBlue(), + viewControllerBackgroundColor: WPStyleGuide.lightGrey(), + navBarImage: Gridicon.iconOfType(.mySites) + ) } } diff --git a/WordPressAuthenticator/NUX/NUXViewControllerBase.swift b/WordPressAuthenticator/NUX/NUXViewControllerBase.swift index 6c08d8311..256a3a7c0 100644 --- a/WordPressAuthenticator/NUX/NUXViewControllerBase.swift +++ b/WordPressAuthenticator/NUX/NUXViewControllerBase.swift @@ -144,7 +144,7 @@ extension NUXViewControllerBase where Self: UIViewController, Self: UIViewContro /// Adds the WP logo to the nav controller /// public func addWordPressLogoToNavController() { - let image = Gridicon.iconOfType(.mySites) + let image = WordPressAuthenticator.shared.style.navBarImage let imageView = UIImageView(image: image.imageWithTintColor(UIColor.white)) navigationItem.titleView = imageView } diff --git a/WordPressAuthenticator/Signin/Login.storyboard b/WordPressAuthenticator/Signin/Login.storyboard index cb0152b34..06b96f995 100644 --- a/WordPressAuthenticator/Signin/Login.storyboard +++ b/WordPressAuthenticator/Signin/Login.storyboard @@ -107,7 +107,6 @@ - @@ -320,7 +319,6 @@ - @@ -547,7 +545,6 @@ - @@ -721,7 +718,6 @@ - @@ -885,7 +881,6 @@ - @@ -983,7 +978,6 @@ - @@ -1133,7 +1127,6 @@ - @@ -1182,10 +1175,10 @@ - - - - - + + + + + diff --git a/WordPressAuthenticator/Signin/LoginViewController.swift b/WordPressAuthenticator/Signin/LoginViewController.swift index 80b501c33..8d963e980 100644 --- a/WordPressAuthenticator/Signin/LoginViewController.swift +++ b/WordPressAuthenticator/Signin/LoginViewController.swift @@ -38,6 +38,7 @@ open class LoginViewController: NUXViewController, LoginFacadeDelegate { super.viewDidLoad() displayError(message: "") setupNavBarIcon() + styleBackground() styleInstructions() if let error = errorToPresent { @@ -57,6 +58,12 @@ open class LoginViewController: NUXViewController, LoginFacadeDelegate { addWordPressLogoToNavController() } + /// Styles the view's background color. Defaults to WPStyleGuide.lightGrey() + /// + @objc func styleBackground() { + view.backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor + } + /// Configures instruction label font /// func styleInstructions() {