Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Conversation

@jaclync
Copy link
Contributor

@jaclync jaclync commented Dec 5, 2019

Changes

  • Created a UIButton extension to style a text button using WordPressAuthenticator.shared.style.textButtonColor for normal color and
    WordPressAuthenticator.shared.style.textButtonHighlightColor for highlighted color
    • The button title color was previously defined in xib
  • Applied the text button style to send 2FA code button, forgot password button, and site sign in helper button
  • In LoginEmailViewController, called configureAlternativeLabel in viewWillAppear along with configurations for other subviews

WCiOS PR

This is the WCiOS PR that requires the color updates in this PR: woocommerce/woocommerce-ios#1565

WPiOS changes

Example branch: issue/wcios-1555-color-updates

I noticed a slight color change in the text button, I'm not sure if the color from the xib is the one to be used for textButtonColor style parameter?

before after
Simulator Screen Shot - iPhone SE - 2019-12-05 at 17 34 51 Simulator Screen Shot - iPhone SE - 2019-12-05 at 17 40 12

Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating this! I checked out WPiOS, and I think the new color is correct – it looks like this was a case where we forgot to update things when we changed the color scheme :)

I added a couple of comments about code organisation – most of them are just the same comment but for different classes.


extension UIButton {
/// Applies default styles to a plain text button.
func applyTextButtonStyle() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method might be better suited added to WPStyleGuide instead of UIButton. You could add it to WPStyleGuide+Login.swift, which is where we have methods to configure other buttons like the 1Password button (you may also want to rename it to configureTextButton instead of applyStyle as that might be more consistent).

sendCodeButton.setTitle(NSLocalizedString("Text me a code instead", comment: "Button title"),
for: .normal)
sendCodeButton.titleLabel?.numberOfLines = 0
sendCodeButton.applyTextButtonStyle()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel like this call belongs in a method named localizeControls, which is all around localising and setting text. We could just create a new configureTextButton method to include this call?

forgotPasswordButton.setTitle(forgotPasswordTitle, for: .normal)
forgotPasswordButton.setTitle(forgotPasswordTitle, for: .highlighted)
forgotPasswordButton.titleLabel?.numberOfLines = 0
forgotPasswordButton.applyTextButtonStyle()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, I don't think this belongs in the localize method.

siteAddressHelpButton.setTitle(siteAddressHelpTitle, for: .normal)
siteAddressHelpButton.setTitle(siteAddressHelpTitle, for: .highlighted)
siteAddressHelpButton.titleLabel?.numberOfLines = 0
siteAddressHelpButton.applyTextButtonStyle()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above :)

forgotPasswordButton.setTitle(forgotPasswordTitle, for: .normal)
forgotPasswordButton.setTitle(forgotPasswordTitle, for: .highlighted)
forgotPasswordButton.titleLabel?.numberOfLines = 0
forgotPasswordButton.applyTextButtonStyle()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

forgotPasswordButton?.setTitle(forgotPasswordTitle, for: .normal)
forgotPasswordButton?.setTitle(forgotPasswordTitle, for: .highlighted)
forgotPasswordButton?.titleLabel?.numberOfLines = 0
forgotPasswordButton?.applyTextButtonStyle()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

…StyleGuide+Login`. Update existing usage and configure the "Enter your password instead." text button in `LoginLinkRequestViewController`.
@jaclync
Copy link
Contributor Author

jaclync commented Dec 5, 2019

@frosty thanks for checking the app and the fast review! updated the PR based on your feedback 😄

Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great! 🙂

@jaclync jaclync merged commit 8ab94d0 into develop Dec 6, 2019
@jaclync jaclync deleted the issue/wcios-1555-color-fixes branch December 6, 2019 01:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants