From e9abbcf3321a71974ce91e812ec72ae3785bc66b Mon Sep 17 00:00:00 2001 From: Jeremy Massel Date: Mon, 1 Jul 2019 16:14:29 -0600 Subject: [PATCH 1/8] Cut 1.6.0 --- WordPressAuthenticator.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 4348aa55b..05cec2718 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" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC From f376b1ba8d5024b041ab2a652d325a4a297612f1 Mon Sep 17 00:00:00 2001 From: Nate Heagy Date: Tue, 16 Jul 2019 12:05:10 -0600 Subject: [PATCH 2/8] Fix forced cast to Any --- WordPressAuthenticator/UI/LoginTextField.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WordPressAuthenticator/UI/LoginTextField.swift b/WordPressAuthenticator/UI/LoginTextField.swift index 3bbfe3c6a..33844cda7 100644 --- a/WordPressAuthenticator/UI/LoginTextField.swift +++ b/WordPressAuthenticator/UI/LoginTextField.swift @@ -23,7 +23,8 @@ open class LoginTextField: WPWalkthroughTextField { } override open func setupPlaceholder() { - guard let placeholder = placeholder else { + guard let placeholder = placeholder, + let font = font else { return } let attributes: [NSAttributedString.Key: Any] = [ From 2700032ebf77fc068484ad36948360e80f80e2e3 Mon Sep 17 00:00:00 2001 From: Nate Heagy Date: Tue, 16 Jul 2019 13:44:04 -0600 Subject: [PATCH 3/8] Fix some background colors in the prologue --- .../Signin/LoginPrologueSignupMethodViewController.swift | 2 +- WordPressAuthenticator/Signin/LoginPrologueViewController.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift index 185b6aa63..415809998 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift @@ -68,7 +68,7 @@ class LoginPrologueSignupMethodViewController: NUXViewController { self?.present(safariViewController, animated: true, completion: nil) } buttonViewController.stackView?.insertArrangedSubview(termsButton, at: 0) - buttonViewController.backgroundColor = WPStyleGuide.lightGrey() + buttonViewController.backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor } @IBAction func dismissTapped() { diff --git a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift index 2ab4d8cd0..01d092d6a 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift @@ -75,7 +75,7 @@ class LoginPrologueViewController: LoginViewController { self?.dismiss(animated: true, completion: nil) } } - buttonViewController.backgroundColor = WPStyleGuide.lightGrey() + buttonViewController.backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor } // MARK: - Actions From 50e512a8657e1a8110067b2c3d62c336859f1a87 Mon Sep 17 00:00:00 2001 From: Nate Heagy Date: Tue, 16 Jul 2019 16:15:19 -0600 Subject: [PATCH 4/8] Fixing some colors for signup epilogue --- WordPressAuthenticator/Signin/LoginSocialErrorCell.swift | 2 +- WordPressAuthenticator/UI/SearchTableViewCell.swift | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/WordPressAuthenticator/Signin/LoginSocialErrorCell.swift b/WordPressAuthenticator/Signin/LoginSocialErrorCell.swift index 094d946e0..26a414a5d 100644 --- a/WordPressAuthenticator/Signin/LoginSocialErrorCell.swift +++ b/WordPressAuthenticator/Signin/LoginSocialErrorCell.swift @@ -81,6 +81,6 @@ open class LoginSocialErrorCell: UITableViewCell { descriptionLabel.text = errorDescription } - backgroundColor = WPStyleGuide.greyLighten30() + backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor } } diff --git a/WordPressAuthenticator/UI/SearchTableViewCell.swift b/WordPressAuthenticator/UI/SearchTableViewCell.swift index b900dbb50..2d48bd542 100644 --- a/WordPressAuthenticator/UI/SearchTableViewCell.swift +++ b/WordPressAuthenticator/UI/SearchTableViewCell.swift @@ -47,7 +47,9 @@ open class SearchTableViewCell: UITableViewCell { textField.returnKeyType = .search textField.contentInsets = Constants.textInsetsWithIcon textField.accessibilityIdentifier = "Search field" - textField.leftViewImage = textField?.leftViewImage?.imageWithTintColor(Constants.leftImageTintColor) + textField.leftViewImage = textField?.leftViewImage?.imageWithTintColor(WordPressAuthenticator.shared.style.placeholderColor) + + contentView.backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor } } @@ -57,7 +59,6 @@ open class SearchTableViewCell: UITableViewCell { private extension SearchTableViewCell { enum Constants { static let textInsetsWithIcon = WPStyleGuide.edgeInsetForLoginTextFields() - static let leftImageTintColor = WPStyleGuide.grey() } } From 5f2fd19065e7f5c9e49859ec0ab2dde5d583ed6b Mon Sep 17 00:00:00 2001 From: Nate Heagy Date: Wed, 17 Jul 2019 09:30:51 -0600 Subject: [PATCH 5/8] Update colors on the self-hosted login screen --- WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift | 2 +- .../Signin/LoginSelfHostedViewController.swift | 2 +- .../Signin/LoginSocialErrorViewController.swift | 4 ++-- WordPressAuthenticator/UI/SiteInfoHeaderView.swift | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift index a9aea8be2..5068e604e 100644 --- a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift +++ b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift @@ -211,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/Signin/LoginSelfHostedViewController.swift b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift index 2791ec920..292c0fbb4 100644 --- a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift @@ -186,7 +186,7 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder { siteHeaderView.subtitleIsHidden = true siteHeaderView.blavatarBorderIsHidden = true - siteHeaderView.blavatarImage = .linkFieldImage + siteHeaderView.blavatarImage = UIImage.linkFieldImage.imageWithTintColor(WordPressAuthenticator.shared.style.placeholderColor) } diff --git a/WordPressAuthenticator/Signin/LoginSocialErrorViewController.swift b/WordPressAuthenticator/Signin/LoginSocialErrorViewController.swift index 332b06126..aa0d32917 100644 --- a/WordPressAuthenticator/Signin/LoginSocialErrorViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSocialErrorViewController.swift @@ -57,7 +57,7 @@ class LoginSocialErrorViewController: NUXTableViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = WPStyleGuide.greyLighten30() + view.backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor addWordPressLogoToNavController() } @@ -140,7 +140,7 @@ extension LoginSocialErrorViewController { override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { let footer = UIView() - footer.backgroundColor = WPStyleGuide.greyLighten20() + footer.backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor return footer } diff --git a/WordPressAuthenticator/UI/SiteInfoHeaderView.swift b/WordPressAuthenticator/UI/SiteInfoHeaderView.swift index 3ebf725a5..7070d5a75 100644 --- a/WordPressAuthenticator/UI/SiteInfoHeaderView.swift +++ b/WordPressAuthenticator/UI/SiteInfoHeaderView.swift @@ -113,9 +113,9 @@ private extension SiteInfoHeaderView { blavatarImageView.layer.borderWidth = 0 blavatarImageView.tintColor = .clear } else { - blavatarImageView.layer.borderColor = WPStyleGuide.greyLighten20().cgColor + blavatarImageView.layer.borderColor = WordPressAuthenticator.shared.style.instructionColor.cgColor blavatarImageView.layer.borderWidth = 1 - blavatarImageView.tintColor = WPStyleGuide.greyLighten10() + blavatarImageView.tintColor = WordPressAuthenticator.shared.style.instructionColor } } } From 2f9a4527a611a4abb322c84e3b5d7024b0e33b66 Mon Sep 17 00:00:00 2001 From: Nate Heagy Date: Wed, 17 Jul 2019 10:45:56 -0600 Subject: [PATCH 6/8] Simplify LoginTextField's placeholder code - also makes it more reliable, previously it was only colored once and if changed it reverted to iOS default (which was happening for unknown reasons) --- .../NUX/WPWalkthroughTextField.h | 2 -- .../NUX/WPWalkthroughTextField.m | 8 ++--- .../Signin/Login.storyboard | 1 + .../UI/LoginTextField.swift | 29 ++++++++----------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/WordPressAuthenticator/NUX/WPWalkthroughTextField.h b/WordPressAuthenticator/NUX/WPWalkthroughTextField.h index 5dc506ae9..22862f3db 100644 --- a/WordPressAuthenticator/NUX/WPWalkthroughTextField.h +++ b/WordPressAuthenticator/NUX/WPWalkthroughTextField.h @@ -6,7 +6,6 @@ IB_DESIGNABLE @property (nonatomic) IBInspectable BOOL showTopLineSeparator; @property (nonatomic) IBInspectable BOOL showSecureTextEntryToggle; @property (nonatomic) IBInspectable UIImage *leftViewImage; -@property (nonatomic, strong) UIButton *secureTextEntryToggle; /// Width for the left view. Set to 0 to use the given frame in the view. /// Default is: 30 @@ -39,6 +38,5 @@ IB_DESIGNABLE @property (nonatomic) UIEdgeInsets contentInsets; - (instancetype)initWithLeftViewImage:(UIImage *)image; -- (void)setupPlaceholder; @end diff --git a/WordPressAuthenticator/NUX/WPWalkthroughTextField.m b/WordPressAuthenticator/NUX/WPWalkthroughTextField.m index 89a78f4aa..b84662bca 100644 --- a/WordPressAuthenticator/NUX/WPWalkthroughTextField.m +++ b/WordPressAuthenticator/NUX/WPWalkthroughTextField.m @@ -8,6 +8,7 @@ @import Gridicons; @interface WPWalkthroughTextField () +@property (nonatomic, strong) UIButton *secureTextEntryToggle; @property (nonatomic, strong) UIImage *secureTextEntryImageVisible; @property (nonatomic, strong) UIImage *secureTextEntryImageHidden; @end @@ -85,13 +86,9 @@ - (void)commonInit self.showTopLineSeparator = NO; self.showSecureTextEntryToggle = NO; - [self setupPlaceholder]; -} - -- (void)setupPlaceholder -{ // 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, @@ -114,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]; diff --git a/WordPressAuthenticator/Signin/Login.storyboard b/WordPressAuthenticator/Signin/Login.storyboard index d0ee346d8..70a18c153 100644 --- a/WordPressAuthenticator/Signin/Login.storyboard +++ b/WordPressAuthenticator/Signin/Login.storyboard @@ -470,6 +470,7 @@ + diff --git a/WordPressAuthenticator/UI/LoginTextField.swift b/WordPressAuthenticator/UI/LoginTextField.swift index 33844cda7..6330fce0b 100644 --- a/WordPressAuthenticator/UI/LoginTextField.swift +++ b/WordPressAuthenticator/UI/LoginTextField.swift @@ -3,14 +3,6 @@ import WordPressShared open class LoginTextField: WPWalkthroughTextField { - override open func awakeFromNib() { - super.awakeFromNib() - guard let secureTextEntryToggle = secureTextEntryToggle else { - return - } - secureTextEntryToggle.tintColor = WordPressAuthenticator.shared.style.placeholderColor - } - override open func draw(_ rect: CGRect) { if showTopLineSeparator { guard let context = UIGraphicsGetCurrentContext() else { @@ -22,16 +14,19 @@ open class LoginTextField: WPWalkthroughTextField { } } - override open func setupPlaceholder() { - guard let placeholder = placeholder, - let font = font else { - return + override open var placeholder: String? { + didSet { + guard let placeholder = placeholder, + let font = font else { + return + } + + let attributes: [NSAttributedString.Key : Any] = [ + .foregroundColor: WordPressAuthenticator.shared.style.placeholderColor, + .font: font + ] + attributedPlaceholder = NSAttributedString(string: placeholder, attributes: attributes) } - let attributes: [NSAttributedString.Key: Any] = [ - .foregroundColor: WordPressAuthenticator.shared.style.placeholderColor, - .font: font - ] - self.attributedPlaceholder = NSAttributedString(string: placeholder, attributes: attributes) } override open var leftViewImage: UIImage! { From 1ee14cdffb5cfcc2d1285b46b2949c984198d2f8 Mon Sep 17 00:00:00 2001 From: Nate Heagy Date: Wed, 17 Jul 2019 13:19:13 -0600 Subject: [PATCH 7/8] Improve some style names --- .../Authenticator/WordPressAuthenticatorStyles.swift | 10 +++++----- .../Extensions/WPStyleGuide+Login.swift | 12 ++++++------ WordPressAuthenticator/UI/SiteInfoHeaderView.swift | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift index 0c9904329..21c81ceab 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorStyles.swift @@ -41,9 +41,9 @@ public struct WordPressAuthenticatorStyle { /// Style: Text Buttons /// - public let textButton: UIColor + public let textButtonColor: UIColor - public let textButtonHighlight: UIColor + public let textButtonHighlightColor: UIColor /// Style: Labels /// @@ -71,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, textButton: UIColor, textButtonHighlight: UIColor, instructionColor: UIColor, subheadlineColor: UIColor, placeholderColor: 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 @@ -85,8 +85,8 @@ public struct WordPressAuthenticatorStyle { self.primaryTitleColor = primaryTitleColor self.secondaryTitleColor = secondaryTitleColor self.disabledTitleColor = disabledTitleColor - self.textButton = textButton - self.textButtonHighlight = textButtonHighlight + self.textButtonColor = textButtonColor + self.textButtonHighlightColor = textButtonHighlightColor self.instructionColor = instructionColor self.subheadlineColor = subheadlineColor self.placeholderColor = placeholderColor diff --git a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift index 5068e604e..402fdb07d 100644 --- a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift +++ b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift @@ -7,8 +7,8 @@ final class SubheadlineButton: UIButton { super.traitCollectionDidChange(previousTraitCollection) if previousTraitCollection?.preferredContentSizeCategory != traitCollection.preferredContentSizeCategory { titleLabel?.font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline) - setTitleColor(WordPressAuthenticator.shared.style.textButton, for: .normal) - setTitleColor(WordPressAuthenticator.shared.style.textButtonHighlight, for: .highlighted) + setTitleColor(WordPressAuthenticator.shared.style.textButtonColor, for: .normal) + setTitleColor(WordPressAuthenticator.shared.style.textButtonHighlightColor, for: .highlighted) } } } @@ -104,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.textButton) - let attrStrHighlight = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlight) + let attrStrNormal = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonColor) + let attrStrHighlight = googleButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlightColor) let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline) @@ -119,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.textButton) - let attrStrHighlight = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlight) + let attrStrNormal = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonColor) + let attrStrHighlight = selfHostedButtonString(baseString, linkColor: WordPressAuthenticator.shared.style.textButtonHighlightColor) let font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline) diff --git a/WordPressAuthenticator/UI/SiteInfoHeaderView.swift b/WordPressAuthenticator/UI/SiteInfoHeaderView.swift index 7070d5a75..9b2a0423f 100644 --- a/WordPressAuthenticator/UI/SiteInfoHeaderView.swift +++ b/WordPressAuthenticator/UI/SiteInfoHeaderView.swift @@ -115,7 +115,7 @@ private extension SiteInfoHeaderView { } else { blavatarImageView.layer.borderColor = WordPressAuthenticator.shared.style.instructionColor.cgColor blavatarImageView.layer.borderWidth = 1 - blavatarImageView.tintColor = WordPressAuthenticator.shared.style.instructionColor + blavatarImageView.tintColor = WordPressAuthenticator.shared.style.placeholderColor } } } From af0d76015d84720c7b22723dbec686cbf88ce347 Mon Sep 17 00:00:00 2001 From: Nate Heagy Date: Wed, 17 Jul 2019 13:53:06 -0600 Subject: [PATCH 8/8] Bump version to 1.7.0-beta.1 --- WordPressAuthenticator.podspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index bd6221ae7..38d7efb0e 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,7 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.6.0" - s.version = "1.6.1-beta.1" + s.version = "1.7.0-beta.1" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC