From dd1cc245ac0959c656e2862f60bbb42a0246c59b Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 12 Dec 2019 15:13:30 -0700 Subject: [PATCH 01/14] LoginSelfHosted: Add a11y label for URL field --- .../Signin/LoginSiteAddressViewController.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift index e51faf76b..28317c52b 100644 --- a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift @@ -37,6 +37,7 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder override func viewDidLoad() { super.viewDidLoad() localizeControls() + configureForAccessibility() } @@ -90,6 +91,10 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder siteAddressHelpButton.titleLabel?.numberOfLines = 0 } + private func configureForAccessibility() { + siteURLField.accessibilityLabel = + NSLocalizedString("Site address", comment: "Accessibility label of the site address field shown when adding a self-hosted site.") + } /// Configures the content of the text fields based on what is saved in `loginFields`. /// From f68cc1deeea4cdb6fd984fa240cb59400adb3cea Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 12 Dec 2019 15:39:07 -0700 Subject: [PATCH 02/14] LoginSiteAddressVC: Focus on error label if needed For errors shown on the error label and triggered by the Next button, this makes VoiceOver focus on the error label so that it will speak the contents. --- .../Signin/LoginSiteAddressViewController.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift index 28317c52b..80ae82ca8 100644 --- a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift @@ -180,10 +180,17 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder WordPressAuthenticator.track(.loginFailed, error: error) self.configureViewLoading(false) + let displayAndFocusOnErrorLabel: (String) -> () = { message in + if let errorLabel = self.errorLabel { + UIAccessibility.post(notification: .layoutChanged, argument: self.errorLabel) + } + self.displayError(message: message) + } + let err = self.originalErrorOrError(error: error as NSError) if let xmlrpcValidatorError = err as? WordPressOrgXMLRPCValidatorError { - self.displayError(message: xmlrpcValidatorError.localizedDescription) + displayAndFocusOnErrorLabel(xmlrpcValidatorError.localizedDescription) } else if (err.domain == NSURLErrorDomain && err.code == NSURLErrorCannotFindHost) || (err.domain == NSURLErrorDomain && err.code == NSURLErrorNetworkConnectionLost) { @@ -191,7 +198,7 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder let msg = NSLocalizedString( "The site at this address is not a WordPress site. For us to connect to it, the site must use WordPress.", comment: "Error message shown a URL does not point to an existing site.") - self.displayError(message: msg) + displayAndFocusOnErrorLabel(msg) } else { self.displayError(error as NSError, sourceTag: self.sourceTag) From 0c3a93ff5bf435f8b059fb4973dbf1d6ffc492d4 Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 12 Dec 2019 15:42:54 -0700 Subject: [PATCH 03/14] Login Self-hosted: Fix instructions --- .../Authenticator/WordPressAuthenticatorDisplayStrings.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayStrings.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayStrings.swift index 2224db768..0fa5e7b4e 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayStrings.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayStrings.swift @@ -25,6 +25,6 @@ public extension WordPressAuthenticatorDisplayStrings { static var defaultStrings: WordPressAuthenticatorDisplayStrings { return WordPressAuthenticatorDisplayStrings(emailLoginInstructions: NSLocalizedString("Log in to your WordPress.com account with your email address.", comment: "Instruction text on the login's email address screen."), jetpackLoginInstructions: NSLocalizedString("Log in to the WordPress.com account you used to connect Jetpack.", comment: "Instruction text on the login's email address screen."), - siteLoginInstructions: NSLocalizedString("Enter the address of your WordPress site you'd like to connect.", comment: "Instruction text on the login's site addresss screen.")) + siteLoginInstructions: NSLocalizedString("Enter the address of the WordPress site you'd like to connect.", comment: "Instruction text on the login's site addresss screen.")) } } From 34348290efebe8e602a6b0bd975b92a5e3eef44c Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 12 Dec 2019 16:10:48 -0700 Subject: [PATCH 04/14] Self-hosted: Add a11y labels for username and pass --- .../Signin/LoginSelfHostedViewController.swift | 11 +++++++++++ .../Signin/LoginSiteAddressViewController.swift | 2 ++ 2 files changed, 13 insertions(+) diff --git a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift index 8db550889..2dccebf68 100644 --- a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift @@ -36,6 +36,7 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder { localizeControls() setupOnePasswordButtonIfNeeded() displayLoginMessage("") + configureForAcessibility() } @@ -90,6 +91,16 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder { } + /// Sets up necessary accessibility labels and attributes for the all the UI elements in self. + /// + private func configureForAcessibility() { + usernameField.accessibilityLabel = + NSLocalizedString("Username", comment: "Accessibility label for the username text field in the self-hosted login page.") + passwordField.accessibilityLabel = + NSLocalizedString("Password", comment: "Accessibility label for the password text field in the self-hosted login page.") + } + + /// Sets up a 1Password button if 1Password is available. /// @objc func setupOnePasswordButtonIfNeeded() { diff --git a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift index 80ae82ca8..295f2fb99 100644 --- a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift @@ -91,6 +91,8 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder siteAddressHelpButton.titleLabel?.numberOfLines = 0 } + /// Sets up necessary accessibility labels and attributes for the all the UI elements in self. + /// private func configureForAccessibility() { siteURLField.accessibilityLabel = NSLocalizedString("Site address", comment: "Accessibility label of the site address field shown when adding a self-hosted site.") From 77a4ba428e9b993007ba0a3939636a87dc6ee041 Mon Sep 17 00:00:00 2001 From: Shiki Date: Fri, 13 Dec 2019 10:52:26 -0700 Subject: [PATCH 05/14] LoginSelfHostedVC: Remove placeholder for VO --- .../Signin/LoginSelfHostedViewController.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift index 2dccebf68..bc961f8a4 100644 --- a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift @@ -98,6 +98,14 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder { NSLocalizedString("Username", comment: "Accessibility label for the username text field in the self-hosted login page.") passwordField.accessibilityLabel = NSLocalizedString("Password", comment: "Accessibility label for the password text field in the self-hosted login page.") + + if UIAccessibility.isVoiceOverRunning { + // Remove the placeholder if VoiceOver is running. VoiceOver speaks the label and the + // placeholder together. In this case, both labels and placeholders are the same so it's + // like VoiceOver is reading the same thing twice. + usernameField.placeholder = nil + passwordField.placeholder = nil + } } From b42f7777938b9676063984023192c687ea9bd5ab Mon Sep 17 00:00:00 2001 From: Shiki Date: Fri, 13 Dec 2019 10:58:43 -0700 Subject: [PATCH 06/14] Add a11y label for 1Password button --- WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift index 29c086e88..7f4e3c031 100644 --- a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift +++ b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift @@ -47,6 +47,9 @@ extension WPStyleGuide { onePasswordButton.setImage(.onePasswordImage, for: .normal) onePasswordButton.sizeToFit() + onePasswordButton.accessibilityLabel = + NSLocalizedString("Fill with password manager", comment: "The password manager button in login pages. The button opens a dialog showing which password manager to use (e.g. 1Password, LastPass). ") + textField.rightView = onePasswordButton textField.rightViewMode = .always From 2dcd8ec19472e8dd7325bd89f53cd0c7bb109c6c Mon Sep 17 00:00:00 2001 From: Shiki Date: Fri, 13 Dec 2019 11:35:18 -0700 Subject: [PATCH 07/14] Add a11y label and value for Show Password button --- .../NUX/WPWalkthroughTextField.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/WordPressAuthenticator/NUX/WPWalkthroughTextField.m b/WordPressAuthenticator/NUX/WPWalkthroughTextField.m index 81c0c788c..e8896561c 100644 --- a/WordPressAuthenticator/NUX/WPWalkthroughTextField.m +++ b/WordPressAuthenticator/NUX/WPWalkthroughTextField.m @@ -120,6 +120,8 @@ - (void)configureSecureTextEntryToggle { [self.secureTextEntryToggle addTarget:self action:@selector(secureTextEntryToggleAction:) forControlEvents:UIControlEventTouchUpInside]; [self updateSecureTextEntryToggleImage]; + [self updateSecureTextEntryForAccessibility]; + self.rightView = self.secureTextEntryToggle; self.rightViewMode = UITextFieldViewModeAlways; } @@ -253,6 +255,7 @@ - (void)setSecureTextEntry:(BOOL)secureTextEntry [super setSecureTextEntry:secureTextEntry]; [self updateSecureTextEntryToggleImage]; + [self updateSecureTextEntryForAccessibility]; } - (void)secureTextEntryToggleAction:(id)sender @@ -272,4 +275,17 @@ - (void)updateSecureTextEntryToggleImage [self.secureTextEntryToggle sizeToFit]; } +- (void)updateSecureTextEntryForAccessibility +{ + self.secureTextEntryToggle.accessibilityLabel = NSLocalizedString(@"Show password", @"Accessibility label for the “Show password“ button in the login page's password field."); + + NSString *accessibilityValue; + if (self.isSecureTextEntry) { + accessibilityValue = NSLocalizedString(@"Hidden", "Accessibility value if login page's password field is hiding the password (i.e. with asterisks)."); + } else { + accessibilityValue = NSLocalizedString(@"Shown", "Accessibility value if login page's password field is displaying the password."); + } + self.secureTextEntryToggle.accessibilityValue = accessibilityValue; +} + @end From e7a6fb0d26dd7e3338bd7c64c4eef5ec5d81eff3 Mon Sep 17 00:00:00 2001 From: Shiki Date: Fri, 13 Dec 2019 12:08:28 -0700 Subject: [PATCH 08/14] LoginSelfHostedVC: Make forgotPassword a link The forgotPasswordButton opens Safari when tapped. Buttons with behaviors like this should be announced as a link by VoiceOver. --- .../Signin/LoginSelfHostedViewController.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift index bc961f8a4..49b697625 100644 --- a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift @@ -106,6 +106,8 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder { usernameField.placeholder = nil passwordField.placeholder = nil } + + forgotPasswordButton.accessibilityTraits = .link } From d36d0cafb49797a295eebb3a4d508a4235ee2522 Mon Sep 17 00:00:00 2001 From: Shiki Date: Fri, 13 Dec 2019 12:10:24 -0700 Subject: [PATCH 09/14] Refactor displayError to house VoiceOver focus The same functionality will be needed from other VCs later. --- .../Signin/LoginSiteAddressViewController.swift | 11 ++--------- .../Signin/LoginViewController.swift | 12 +++++++++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift index 295f2fb99..04b1d6238 100644 --- a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift @@ -182,17 +182,10 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder WordPressAuthenticator.track(.loginFailed, error: error) self.configureViewLoading(false) - let displayAndFocusOnErrorLabel: (String) -> () = { message in - if let errorLabel = self.errorLabel { - UIAccessibility.post(notification: .layoutChanged, argument: self.errorLabel) - } - self.displayError(message: message) - } - let err = self.originalErrorOrError(error: error as NSError) if let xmlrpcValidatorError = err as? WordPressOrgXMLRPCValidatorError { - displayAndFocusOnErrorLabel(xmlrpcValidatorError.localizedDescription) + self.displayError(message: xmlrpcValidatorError.localizedDescription, moveVoiceOverFocus: true) } else if (err.domain == NSURLErrorDomain && err.code == NSURLErrorCannotFindHost) || (err.domain == NSURLErrorDomain && err.code == NSURLErrorNetworkConnectionLost) { @@ -200,7 +193,7 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder let msg = NSLocalizedString( "The site at this address is not a WordPress site. For us to connect to it, the site must use WordPress.", comment: "Error message shown a URL does not point to an existing site.") - displayAndFocusOnErrorLabel(msg) + self.displayError(message: msg, moveVoiceOverFocus: true) } else { self.displayError(error as NSError, sourceTag: self.sourceTag) diff --git a/WordPressAuthenticator/Signin/LoginViewController.swift b/WordPressAuthenticator/Signin/LoginViewController.swift index a41528fda..68cfadde3 100644 --- a/WordPressAuthenticator/Signin/LoginViewController.swift +++ b/WordPressAuthenticator/Signin/LoginViewController.swift @@ -82,7 +82,13 @@ open class LoginViewController: NUXViewController, LoginFacadeDelegate { } /// Sets the text of the error label. - func displayError(message: String) { + /// + /// - Parameter message: The message to display in the `errorLabel`. If empty, the `errorLabel` + /// will be hidden. + /// - Parameter moveVoiceOverFocus: If `true`, moves the VoiceOver focus to the `errorLabel`. + /// You will want to set this to `true` if the error was caused after pressing a button + /// (e.g. Next button). + func displayError(message: String, moveVoiceOverFocus: Bool = false) { guard message.count > 0 else { errorLabel?.isHidden = true return @@ -90,6 +96,10 @@ open class LoginViewController: NUXViewController, LoginFacadeDelegate { errorLabel?.isHidden = false errorLabel?.text = message errorToPresent = nil + + if moveVoiceOverFocus, let errorLabel = errorLabel { + UIAccessibility.post(notification: .layoutChanged, argument: errorLabel) + } } private func mustShowLoginEpilogue() -> Bool { From 9c8ba151eadb03386d5816782a7e943716149e53 Mon Sep 17 00:00:00 2001 From: Shiki Date: Fri, 13 Dec 2019 12:20:26 -0700 Subject: [PATCH 10/14] LoginSelfHostedVC: Announce errors --- .../Signin/LoginSelfHostedViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift index 49b697625..a009818ec 100644 --- a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift @@ -315,7 +315,9 @@ extension LoginSelfHostedViewController { configureViewLoading(false) let err = error as NSError if err.code == 403 { - displayError(message: NSLocalizedString("It looks like this username/password isn't associated with this site.", comment: "An error message shown during log in when the username or password is incorrect.")) + let message = NSLocalizedString("It looks like this username/password isn't associated with this site.", + comment: "An error message shown during log in when the username or password is incorrect.") + displayError(message: message, moveVoiceOverFocus: true) } else { displayError(error as NSError, sourceTag: sourceTag) } From cafee3d971f3212631d8dd063980925db8ab9480 Mon Sep 17 00:00:00 2001 From: Shiki Date: Fri, 13 Dec 2019 12:30:04 -0700 Subject: [PATCH 11/14] Update podspec version to 1.10.5-beta.4 --- WordPressAuthenticator.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index cd5adddaf..4cc86c2d5 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.10.5-beta.3" + s.version = "1.10.5-beta.4" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC From 6e306d7a35c13b5b288045d137cc2bba036d94d8 Mon Sep 17 00:00:00 2001 From: Brandon Titus Date: Wed, 8 Jan 2020 08:52:15 -0700 Subject: [PATCH 12/14] Update WordPressKit to 4.5.6-beta.1 --- Podfile | 2 +- Podfile.lock | 8 ++++---- WordPressAuthenticator.podspec | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Podfile b/Podfile index f4a019b03..74c82904e 100644 --- a/Podfile +++ b/Podfile @@ -11,7 +11,7 @@ def wordpress_authenticator_pods ## pod 'Gridicons', '~> 0.15' pod 'WordPressUI', '~> 1.4-beta.1' - pod 'WordPressKit', '~> 4.5.5' + pod 'WordPressKit', '~> 4.5.6-beta.1' # pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :branch => 'issue/apple_2fa_auth' pod 'WordPressShared', '~> 1.8' diff --git a/Podfile.lock b/Podfile.lock index cc90cdeb0..e28f4a195 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -44,7 +44,7 @@ PODS: - Specta (1.0.7) - SVProgressHUD (2.2.5) - UIDeviceIdentifier (1.4.0) - - WordPressKit (4.5.5): + - WordPressKit (4.5.6-beta.1): - Alamofire (~> 4.7.3) - CocoaLumberjack (~> 3.4) - NSObject-SafeExpectations (= 0.0.3) @@ -71,7 +71,7 @@ DEPENDENCIES: - OHHTTPStubs/Swift (= 8.0.0) - Specta (= 1.0.7) - SVProgressHUD (= 2.2.5) - - WordPressKit (~> 4.5.5) + - WordPressKit (~> 4.5.6-beta.1) - WordPressShared (~> 1.8) - WordPressUI (~> 1.4-beta.1) @@ -117,11 +117,11 @@ SPEC CHECKSUMS: Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6 UIDeviceIdentifier: 44f805037d21b94394821828f4fcaba34b38c2d0 - WordPressKit: 8029cb93a89de79442254c346523da11c2706d7b + WordPressKit: eb6742df639843f5e7b2da9450da39d222b22ab8 WordPressShared: 09cf184caa614835f5811e8609227165201e6d3e WordPressUI: 35b144885c8e5817ba6874b68accc200bda61ee1 wpxmlrpc: 6ba55c773cfa27083ae4a2173e69b19f46da98e2 -PODFILE CHECKSUM: e4f5f036a95bf5e1df937bfa7d2d24b4ee5bbb18 +PODFILE CHECKSUM: 0efdfa2e4fbdc215152337ee314105a404d69957 COCOAPODS: 1.8.4 diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 66400426a..4d94210c1 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.10.6-beta.1" + s.version = "1.10.6-beta.2" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC @@ -39,6 +39,6 @@ Pod::Spec.new do |s| s.dependency 'Gridicons', '~> 0.15' s.dependency 'GoogleSignIn', '~> 4.4' s.dependency 'WordPressUI', '~> 1.4-beta.1' - s.dependency 'WordPressKit', '~> 4.5.5' + s.dependency 'WordPressKit', '~> 4.5.6-beta.1' s.dependency 'WordPressShared', '~> 1.8' end From 95db920832bb996703973045384f6e52a08a79ba Mon Sep 17 00:00:00 2001 From: Jaclyn Chen Date: Mon, 13 Jan 2020 10:30:55 +0800 Subject: [PATCH 13/14] Image and color updates: site address helper alert, site address header, and magic link UI (#173) * Update `icon-url-field` image asset rendering mode to always template. Set its `UIImageView`'s tintColor to the placeholder color in `SiteInfoHeaderView` where the image is used. * Create `WordPressAuthenticatorDisplayImages` for configurable images. * Magic Link: configure Use Password button with text button styles and set the image based on the `WordPressAuthenticatorDisplayImages`. * Log In with Site Address help alert: set the image based on `WordPressAuthenticatorDisplayImages`. * Remove @objc and public for the 2 new image getters. * Bump pod version. * Add an outlet for the prompt label on login with username and password screen. * Update `SiteInfoHeaderView` title and subtitle colors to `WordPressAuthenticator.shared.style.subheadlineColor`. * Revert "Update `SiteInfoHeaderView` title and subtitle colors to `WordPressAuthenticator.shared.style.subheadlineColor`." This reverts commit 4c6e83fdbef8601dc05ea67d6d96f4cfc857be0d. * Revert "Add an outlet for the prompt label on login with username and password screen." This reverts commit 9857b28c2e68b3666fb5fbe3962bf044ce9f48dc. * Bump pod version after merging the latest `develop`. --- WordPressAuthenticator.podspec | 2 +- .../project.pbxproj | 4 ++++ .../WordPressAuthenticator.swift | 12 +++++++++- .../WordPressAuthenticatorDisplayImages.swift | 22 +++++++++++++++++++ .../FancyAlertViewController+LoginError.swift | 2 +- .../Extensions/UIImage+Assets.swift | 11 ++++++++++ .../NUX/NUXLinkMailViewController.swift | 11 ++++++++++ .../icon-url-field.imageset/Contents.json | 4 ++++ .../Signin/EmailMagicLink.storyboard | 1 + .../LoginSelfHostedViewController.swift | 2 +- .../UI/SiteInfoHeaderView.swift | 2 +- 11 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayImages.swift diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 4d94210c1..42530f293 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.10.6-beta.2" + s.version = "1.10.6-beta.3" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC diff --git a/WordPressAuthenticator.xcodeproj/project.pbxproj b/WordPressAuthenticator.xcodeproj/project.pbxproj index e0f6c018a..974446116 100644 --- a/WordPressAuthenticator.xcodeproj/project.pbxproj +++ b/WordPressAuthenticator.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 020BE74A23B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020BE74923B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift */; }; 1A21EE9822832BC300C940C6 /* WordPressComOAuthClientFacade+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A21EE9722832BC200C940C6 /* WordPressComOAuthClientFacade+Swift.swift */; }; 1A4095182271AEFC009AA86D /* WPAuthenticator-Swift.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4095152271AEFC009AA86D /* WPAuthenticator-Swift.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7A7A9B9CD2D81959F9AB9AF6 /* Pods_WordPressAuthenticator.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C736FF243DE333FCAB1C2614 /* Pods_WordPressAuthenticator.framework */; }; @@ -142,6 +143,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 020BE74923B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WordPressAuthenticatorDisplayImages.swift; sourceTree = ""; }; 1A21EE9722832BC200C940C6 /* WordPressComOAuthClientFacade+Swift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WordPressComOAuthClientFacade+Swift.swift"; sourceTree = ""; }; 1A4095152271AEFC009AA86D /* WPAuthenticator-Swift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WPAuthenticator-Swift.h"; sourceTree = ""; }; 276354F054C34AD36CA32AB6 /* Pods-WordPressAuthenticator.release-alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressAuthenticator.release-alpha.xcconfig"; path = "Pods/Target Support Files/Pods-WordPressAuthenticator/Pods-WordPressAuthenticator.release-alpha.xcconfig"; sourceTree = ""; }; @@ -433,6 +435,7 @@ B56090F6208A533200399AE4 /* WordPressSupportSourceTag.swift */, CE1B18CF20EEC41600BECC3F /* WordPressAuthenticatorConfiguration.swift */, CE1B18D120EEC44400BECC3F /* WordPressAuthenticatorStyles.swift */, + 020BE74923B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift */, CE16177421B6D82200B82A47 /* WordPressAuthenticatorDisplayStrings.swift */, ); path = Authenticator; @@ -879,6 +882,7 @@ B5609139208A563800399AE4 /* LoginEmailViewController.swift in Sources */, 98C9195B2308E3DA00A90E12 /* AppleAuthenticator.swift in Sources */, B56090F9208A533200399AE4 /* WordPressAuthenticator+Events.swift in Sources */, + 020BE74A23B0BD2E007FE54C /* WordPressAuthenticatorDisplayImages.swift in Sources */, B560913A208A563800399AE4 /* LoginLinkRequestViewController.swift in Sources */, B560910C208A54F800399AE4 /* WordPressComOAuthClientFacade.m in Sources */, B55272C320B2FE4100E18BC5 /* WPAuthenticatorLoggingPrivate.m in Sources */, diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift index 1ba0fd82b..ab90cf6a6 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift @@ -40,6 +40,10 @@ import AuthenticationServices /// public let style: WordPressAuthenticatorStyle + /// Authenticator's Display Images. + /// + public let displayImages: WordPressAuthenticatorDisplayImages + /// Authenticator's Display Texts. /// public let displayStrings: WordPressAuthenticatorDisplayStrings @@ -65,9 +69,11 @@ import AuthenticationServices /// private init(configuration: WordPressAuthenticatorConfiguration, style: WordPressAuthenticatorStyle, + displayImages: WordPressAuthenticatorDisplayImages, displayStrings: WordPressAuthenticatorDisplayStrings) { self.configuration = configuration self.style = style + self.displayImages = displayImages self.displayStrings = displayStrings } @@ -75,12 +81,16 @@ import AuthenticationServices /// public static func initialize(configuration: WordPressAuthenticatorConfiguration, style: WordPressAuthenticatorStyle, + displayImages: WordPressAuthenticatorDisplayImages = .defaultImages, displayStrings: WordPressAuthenticatorDisplayStrings = .defaultStrings) { guard privateInstance == nil else { fatalError("WordPressAuthenticator is already initialized") } - privateInstance = WordPressAuthenticator(configuration: configuration, style: style, displayStrings: displayStrings) + privateInstance = WordPressAuthenticator(configuration: configuration, + style: style, + displayImages: displayImages, + displayStrings: displayStrings) } // MARK: - Public Methods diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayImages.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayImages.swift new file mode 100644 index 000000000..83d554523 --- /dev/null +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticatorDisplayImages.swift @@ -0,0 +1,22 @@ +// MARK: - WordPress Authenticator Display Images +// +public struct WordPressAuthenticatorDisplayImages { + public let magicLink: UIImage + public let siteAddressModalPlaceholder: UIImage + + /// Designated initializer. + /// + public init(magicLink: UIImage, siteAddressModalPlaceholder: UIImage) { + self.magicLink = magicLink + self.siteAddressModalPlaceholder = siteAddressModalPlaceholder + } +} + +public extension WordPressAuthenticatorDisplayImages { + static var defaultImages: WordPressAuthenticatorDisplayImages { + return WordPressAuthenticatorDisplayImages( + magicLink: .magicLinkImage, + siteAddressModalPlaceholder: .siteAddressModalPlaceholder + ) + } +} diff --git a/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift b/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift index 70bca911a..816177de2 100644 --- a/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift +++ b/WordPressAuthenticator/Extensions/FancyAlertViewController+LoginError.swift @@ -34,7 +34,7 @@ extension FancyAlertViewController { } } - let image = UIImage.siteAddressModalPlaceholder + let image = WordPressAuthenticator.shared.displayImages.siteAddressModalPlaceholder let config = FancyAlertViewController.Config(titleText: Strings.titleText, bodyText: Strings.bodyText, diff --git a/WordPressAuthenticator/Extensions/UIImage+Assets.swift b/WordPressAuthenticator/Extensions/UIImage+Assets.swift index 3f60f727b..09450628d 100644 --- a/WordPressAuthenticator/Extensions/UIImage+Assets.swift +++ b/WordPressAuthenticator/Extensions/UIImage+Assets.swift @@ -4,6 +4,17 @@ import Foundation // MARK: - Named Assets // extension UIImage { + /// Returns the Link Image. + /// + static var linkFieldImage: UIImage { + return UIImage(named: "icon-url-field", in: bundle, compatibleWith: nil)! + } + + /// Returns the Default Magic Link Image. + /// + static var magicLinkImage: UIImage { + return UIImage(named: "login-magic-link", in: bundle, compatibleWith: nil)! + } /// Returns the Default Site Icon Placeholder Image. /// diff --git a/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift b/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift index d03170764..395166101 100644 --- a/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift +++ b/WordPressAuthenticator/NUX/NUXLinkMailViewController.swift @@ -7,6 +7,7 @@ import WordPressShared /// app to look for the emailed authentication link. /// class NUXLinkMailViewController: LoginViewController { + @IBOutlet private weak var imageView: UIImageView! @IBOutlet var label: UILabel? @IBOutlet var openMailButton: NUXButton? @IBOutlet var usePasswordButton: UIButton? @@ -27,6 +28,8 @@ class NUXLinkMailViewController: LoginViewController { override func viewDidLoad() { super.viewDidLoad() + imageView.image = WordPressAuthenticator.shared.displayImages.magicLink + let email = loginFields.username if !email.isValidEmail() { assert(email.isValidEmail(), "The value of loginFields.username was not a valid email address.") @@ -35,6 +38,7 @@ class NUXLinkMailViewController: LoginViewController { emailMagicLinkSource = loginFields.meta.emailMagicLinkSource assert(emailMagicLinkSource != nil, "Must have an email link source.") + styleUsePasswordButton() localizeControls() } @@ -44,6 +48,13 @@ class NUXLinkMailViewController: LoginViewController { // MARK: - Configuration + private func styleUsePasswordButton() { + guard let usePasswordButton = usePasswordButton else { + return + } + WPStyleGuide.configureTextButton(usePasswordButton) + } + /// Assigns localized strings to various UIControl defined in the storyboard. /// @objc func localizeControls() { diff --git a/WordPressAuthenticator/Resources/Assets.xcassets/icon-url-field.imageset/Contents.json b/WordPressAuthenticator/Resources/Assets.xcassets/icon-url-field.imageset/Contents.json index d296daff0..50860130d 100644 --- a/WordPressAuthenticator/Resources/Assets.xcassets/icon-url-field.imageset/Contents.json +++ b/WordPressAuthenticator/Resources/Assets.xcassets/icon-url-field.imageset/Contents.json @@ -8,5 +8,9 @@ "info" : { "version" : 1, "author" : "xcode" + }, + "properties" : { + "template-rendering-intent" : "template", + "preserves-vector-representation" : true } } \ No newline at end of file diff --git a/WordPressAuthenticator/Signin/EmailMagicLink.storyboard b/WordPressAuthenticator/Signin/EmailMagicLink.storyboard index 35d934f1b..976e00ad5 100644 --- a/WordPressAuthenticator/Signin/EmailMagicLink.storyboard +++ b/WordPressAuthenticator/Signin/EmailMagicLink.storyboard @@ -152,6 +152,7 @@ + diff --git a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift index a009818ec..42b47e961 100644 --- a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift @@ -208,7 +208,7 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder { siteHeaderView.subtitleIsHidden = true siteHeaderView.blavatarBorderIsHidden = true - siteHeaderView.blavatarImage = UIImage.linkFieldImage.imageWithTintColor(WordPressAuthenticator.shared.style.placeholderColor) + siteHeaderView.blavatarImage = .linkFieldImage } diff --git a/WordPressAuthenticator/UI/SiteInfoHeaderView.swift b/WordPressAuthenticator/UI/SiteInfoHeaderView.swift index 9b2a0423f..a6741f8d4 100644 --- a/WordPressAuthenticator/UI/SiteInfoHeaderView.swift +++ b/WordPressAuthenticator/UI/SiteInfoHeaderView.swift @@ -111,7 +111,7 @@ private extension SiteInfoHeaderView { func refreshBlavatarStyle() { if blavatarBorderIsHidden { blavatarImageView.layer.borderWidth = 0 - blavatarImageView.tintColor = .clear + blavatarImageView.tintColor = WordPressAuthenticator.shared.style.placeholderColor } else { blavatarImageView.layer.borderColor = WordPressAuthenticator.shared.style.instructionColor.cgColor blavatarImageView.layer.borderWidth = 1 From ff6130b25203051f7f142e369716a4f0790e0dea Mon Sep 17 00:00:00 2001 From: Lorenzo Mattei Date: Mon, 13 Jan 2020 09:21:32 -0500 Subject: [PATCH 14/14] Bump version to 1.10.6 --- WordPressAuthenticator.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 42530f293..c24e204c3 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.10.6-beta.3" + s.version = "1.10.6" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC