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

Commit 8ab94d0

Browse files
authored
Color updates: update text button title color and configure alternative button in LoginEmailViewController (#164)
* Add `UIButton` extension to apply default styles to a plain text button. * Configure alternative label in `viewWillAppear` in `LoginEmailViewController`. * Bump pod version. * Move text button style configuration from `UIButton` extension to `WPStyleGuide+Login`. Update existing usage and configure the "Enter your password instead." text button in `LoginLinkRequestViewController`.
1 parent 2b2afa5 commit 8ab94d0

9 files changed

+33
-1
lines changed

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "WordPressAuthenticator"
3-
s.version = "1.10.4"
3+
s.version = "1.10.5-beta.1"
44
s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps."
55

66
s.description = <<-DESC

WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ extension WPStyleGuide {
7171
onePasswordButton.addTarget(target, action: selector, for: .touchUpInside)
7272
}
7373

74+
/// Configures a plain text button with default styles.
75+
///
76+
class func configureTextButton(_ button: UIButton) {
77+
button.setTitleColor(WordPressAuthenticator.shared.style.textButtonColor, for: .normal)
78+
button.setTitleColor(WordPressAuthenticator.shared.style.textButtonHighlightColor, for: .highlighted)
79+
}
80+
7481
///
7582
///
7683
class func colorForErrorView(_ opaque: Bool) -> UIColor {

WordPressAuthenticator/Signin/Login2FAViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class Login2FAViewController: LoginViewController, NUXKeyboardResponder, UITextF
7878
private func styleSendCodeButton() {
7979
sendCodeButton.titleLabel?.adjustsFontForContentSizeCategory = true
8080
sendCodeButton.titleLabel?.adjustsFontSizeToFitWidth = true
81+
WPStyleGuide.configureTextButton(sendCodeButton)
8182
}
8283

8384
// MARK: Configuration Methods

WordPressAuthenticator/Signin/LoginEmailViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder {
7171
loginFields.meta.userIsDotCom = true
7272

7373
configureEmailField()
74+
configureAlternativeLabel()
7475
configureSubmitButton()
7576
configureViewForEditingIfNeeded()
7677
configureForWPComOnlyIfNeeded()

WordPressAuthenticator/Signin/LoginLinkRequestViewController.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class LoginLinkRequestViewController: LoginViewController {
2525
super.viewDidLoad()
2626

2727
localizeControls()
28+
configureUsePasswordButton()
2829

2930
let email = loginFields.username
3031
if !email.isValidEmail() {
@@ -78,6 +79,13 @@ class LoginLinkRequestViewController: LoginViewController {
7879
sendLinkButton?.isEnabled = !animating
7980
}
8081

82+
private func configureUsePasswordButton() {
83+
guard let usePasswordButton = usePasswordButton else {
84+
return
85+
}
86+
WPStyleGuide.configureTextButton(usePasswordButton)
87+
}
88+
8189

8290
// MARK: - Instance Methods
8391

WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder {
113113
///
114114
@objc func configureForgotPasswordButton() {
115115
forgotPasswordButton.isEnabled = enableSubmit(animating: false)
116+
WPStyleGuide.configureTextButton(forgotPasswordButton)
116117
}
117118

118119

WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder
4747
loginFields.meta.userIsDotCom = false
4848

4949
configureTextFields()
50+
configureSiteAddressHelpButton()
5051
configureSubmitButton(animating: false)
5152
configureViewForEditingIfNeeded()
5253

@@ -132,6 +133,10 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder
132133
}
133134
}
134135

136+
private func configureSiteAddressHelpButton() {
137+
WPStyleGuide.configureTextButton(siteAddressHelpButton)
138+
}
139+
135140

136141
// MARK: - Instance Methods
137142

WordPressAuthenticator/Signin/LoginUsernamePasswordViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class LoginUsernamePasswordViewController: LoginViewController, NUXKeyboardRespo
113113
///
114114
@objc func configureForgotPasswordButton() {
115115
forgotPasswordButton.isEnabled = enableSubmit(animating: false)
116+
WPStyleGuide.configureTextButton(forgotPasswordButton)
116117
}
117118

118119

WordPressAuthenticator/Signin/LoginWPComViewController.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class LoginWPComViewController: LoginViewController, NUXKeyboardResponder {
4545

4646
configureTextFields()
4747
configureEmailIcon()
48+
configureForgotPasswordButton()
4849
configureSubmitButton(animating: false)
4950
configureViewForEditingIfNeeded()
5051
}
@@ -128,6 +129,13 @@ class LoginWPComViewController: LoginViewController, NUXKeyboardResponder {
128129
emailIcon?.image = image.imageWithTintColor(WordPressAuthenticator.shared.style.subheadlineColor)
129130
}
130131

132+
private func configureForgotPasswordButton() {
133+
guard let forgotPasswordButton = forgotPasswordButton else {
134+
return
135+
}
136+
WPStyleGuide.configureTextButton(forgotPasswordButton)
137+
}
138+
131139
@objc func localizeControls() {
132140

133141
instructionLabel?.text = {

0 commit comments

Comments
 (0)