diff --git a/.circleci/config.yml b/.circleci/config.yml index 921e82d44..4fdd7fb65 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,21 +9,21 @@ workflows: jobs: - ios/test: name: Test - xcode-version: "11.0" + xcode-version: "11.2.1" workspace: WordPressAuthenticator.xcworkspace scheme: WordPressAuthenticator device: iPhone 11 - ios-version: "13.0" + ios-version: "13.2.2" bundle-install: true pod-install: true - ios/validate-podspec: name: Validate Podspec - xcode-version: "11.0" + xcode-version: "11.2.1" podspec-path: WordPressAuthenticator.podspec bundle-install: true - ios/publish-podspec: name: Publish to Trunk - xcode-version: "11.0" + xcode-version: "11.2.1" podspec-path: WordPressAuthenticator.podspec bundle-install: true post-to-slack: true diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 000000000..160fe391c --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.5.5 \ No newline at end of file diff --git a/Podfile b/Podfile index 11d59e25d..f4a019b03 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.4' + pod 'WordPressKit', '~> 4.5.5' # 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 bfc1f8236..cc90cdeb0 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.4): + - WordPressKit (4.5.5): - 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.4) + - WordPressKit (~> 4.5.5) - WordPressShared (~> 1.8) - WordPressUI (~> 1.4-beta.1) @@ -117,11 +117,11 @@ SPEC CHECKSUMS: Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6 UIDeviceIdentifier: 44f805037d21b94394821828f4fcaba34b38c2d0 - WordPressKit: 1d365775fac17903a76ad5723bc146ab1739ec82 + WordPressKit: 8029cb93a89de79442254c346523da11c2706d7b WordPressShared: 09cf184caa614835f5811e8609227165201e6d3e WordPressUI: 35b144885c8e5817ba6874b68accc200bda61ee1 wpxmlrpc: 6ba55c773cfa27083ae4a2173e69b19f46da98e2 -PODFILE CHECKSUM: 6f930e58860031b74be490800e49e91a4f3cd75f +PODFILE CHECKSUM: e4f5f036a95bf5e1df937bfa7d2d24b4ee5bbb18 COCOAPODS: 1.8.4 diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 2777d5b21..7afc98ffd 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.10.4" + s.version = "1.10.5" 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.4' + s.dependency 'WordPressKit', '~> 4.5.5' s.dependency 'WordPressShared', '~> 1.8' end diff --git a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift index e91513e7f..29c086e88 100644 --- a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift +++ b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift @@ -71,6 +71,13 @@ extension WPStyleGuide { onePasswordButton.addTarget(target, action: selector, for: .touchUpInside) } + /// Configures a plain text button with default styles. + /// + class func configureTextButton(_ button: UIButton) { + button.setTitleColor(WordPressAuthenticator.shared.style.textButtonColor, for: .normal) + button.setTitleColor(WordPressAuthenticator.shared.style.textButtonHighlightColor, for: .highlighted) + } + /// /// class func colorForErrorView(_ opaque: Bool) -> UIColor { diff --git a/WordPressAuthenticator/Logging/WPAuthenticatorLogging.h b/WordPressAuthenticator/Logging/WPAuthenticatorLogging.h index 5857fa83f..c3ff7df8b 100644 --- a/WordPressAuthenticator/Logging/WPAuthenticatorLogging.h +++ b/WordPressAuthenticator/Logging/WPAuthenticatorLogging.h @@ -1,2 +1,4 @@ -int WPAuthenticatorGetLoggingLevel(void); -void WPAuthenticatorSetLoggingLevel(int level); +@import CocoaLumberjack; + +DDLogLevel WPAuthenticatorGetLoggingLevel(void); +void WPAuthenticatorSetLoggingLevel(DDLogLevel level); diff --git a/WordPressAuthenticator/Logging/WPAuthenticatorLogging.m b/WordPressAuthenticator/Logging/WPAuthenticatorLogging.m index 6a77792a7..2514f3004 100644 --- a/WordPressAuthenticator/Logging/WPAuthenticatorLogging.m +++ b/WordPressAuthenticator/Logging/WPAuthenticatorLogging.m @@ -1,10 +1,10 @@ #import "WPAuthenticatorLogging.h" #import "WPAuthenticatorLoggingPrivate.h" -int WPAuthenticatorGetLoggingLevel() { +DDLogLevel WPAuthenticatorGetLoggingLevel() { return ddLogLevel; } -void WPAuthenticatorSetLoggingLevel(int level) { +void WPAuthenticatorSetLoggingLevel(DDLogLevel level) { ddLogLevel = level; } diff --git a/WordPressAuthenticator/Private/WPAuthenticatorLoggingPrivate.h b/WordPressAuthenticator/Private/WPAuthenticatorLoggingPrivate.h index 88f3382e9..65c4b333e 100644 --- a/WordPressAuthenticator/Private/WPAuthenticatorLoggingPrivate.h +++ b/WordPressAuthenticator/Private/WPAuthenticatorLoggingPrivate.h @@ -1,2 +1,2 @@ @import CocoaLumberjack; -extern int ddLogLevel; +extern DDLogLevel ddLogLevel; diff --git a/WordPressAuthenticator/Private/WPAuthenticatorLoggingPrivate.m b/WordPressAuthenticator/Private/WPAuthenticatorLoggingPrivate.m index 3f8c58d65..e53d621f3 100644 --- a/WordPressAuthenticator/Private/WPAuthenticatorLoggingPrivate.m +++ b/WordPressAuthenticator/Private/WPAuthenticatorLoggingPrivate.m @@ -1,2 +1,2 @@ #import "WPAuthenticatorLoggingPrivate.h" -int ddLogLevel = DDLogLevelWarning; +DDLogLevel ddLogLevel = DDLogLevelWarning; diff --git a/WordPressAuthenticator/Signin/Login.storyboard b/WordPressAuthenticator/Signin/Login.storyboard index 036146211..77ca59996 100644 --- a/WordPressAuthenticator/Signin/Login.storyboard +++ b/WordPressAuthenticator/Signin/Login.storyboard @@ -66,6 +66,7 @@ + @@ -1450,6 +1451,9 @@ + + + diff --git a/WordPressAuthenticator/Signin/Login2FAViewController.swift b/WordPressAuthenticator/Signin/Login2FAViewController.swift index 9f0a840b8..d0fad8fb7 100644 --- a/WordPressAuthenticator/Signin/Login2FAViewController.swift +++ b/WordPressAuthenticator/Signin/Login2FAViewController.swift @@ -40,6 +40,7 @@ class Login2FAViewController: LoginViewController, NUXKeyboardResponder, UITextF super.viewWillAppear(animated) configureViewForEditingIfNeeded() + styleSendCodeButton() } @@ -78,6 +79,7 @@ class Login2FAViewController: LoginViewController, NUXKeyboardResponder, UITextF private func styleSendCodeButton() { sendCodeButton.titleLabel?.adjustsFontForContentSizeCategory = true sendCodeButton.titleLabel?.adjustsFontSizeToFitWidth = true + WPStyleGuide.configureTextButton(sendCodeButton) } // MARK: Configuration Methods diff --git a/WordPressAuthenticator/Signin/LoginEmailViewController.swift b/WordPressAuthenticator/Signin/LoginEmailViewController.swift index 5cf2ef07a..d0619b71b 100644 --- a/WordPressAuthenticator/Signin/LoginEmailViewController.swift +++ b/WordPressAuthenticator/Signin/LoginEmailViewController.swift @@ -71,6 +71,7 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder { loginFields.meta.userIsDotCom = true configureEmailField() + configureAlternativeLabel() configureSubmitButton() configureViewForEditingIfNeeded() configureForWPComOnlyIfNeeded() diff --git a/WordPressAuthenticator/Signin/LoginLinkRequestViewController.swift b/WordPressAuthenticator/Signin/LoginLinkRequestViewController.swift index ca4fef406..e7a58d181 100644 --- a/WordPressAuthenticator/Signin/LoginLinkRequestViewController.swift +++ b/WordPressAuthenticator/Signin/LoginLinkRequestViewController.swift @@ -25,6 +25,7 @@ class LoginLinkRequestViewController: LoginViewController { super.viewDidLoad() localizeControls() + configureUsePasswordButton() let email = loginFields.username if !email.isValidEmail() { @@ -78,6 +79,13 @@ class LoginLinkRequestViewController: LoginViewController { sendLinkButton?.isEnabled = !animating } + private func configureUsePasswordButton() { + guard let usePasswordButton = usePasswordButton else { + return + } + WPStyleGuide.configureTextButton(usePasswordButton) + } + // MARK: - Instance Methods diff --git a/WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift index cd9410360..acadc0df4 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift @@ -13,6 +13,9 @@ class LoginPrologueLoginMethodViewController: NUXViewController { open var selfHostedTapped: (() -> Void)? open var appleTapped: (() -> Void)? + /// The big transparent (dismiss) button behind the buttons + @IBOutlet private weak var dismissButton: UIButton! + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { super.prepare(for: segue, sender: sender) @@ -24,6 +27,7 @@ class LoginPrologueLoginMethodViewController: NUXViewController { override func viewDidLoad() { super.viewDidLoad() configureButtonVC() + configureForAccessibility() } override func viewWillAppear(_ animated: Bool) { @@ -85,4 +89,23 @@ class LoginPrologueLoginMethodViewController: NUXViewController { appleTapped?() } + // MARK: - Accessibility + + private func configureForAccessibility() { + dismissButton.accessibilityLabel = NSLocalizedString("Dismiss", comment: "Accessibility label for the transparent space above the login dialog which acts as a button to dismiss the dialog.") + + // Ensure that the first button (in buttonViewController) is automatically selected by + // VoiceOver instead of the dismiss button. + if buttonViewController?.isViewLoaded == true, let buttonsView = buttonViewController?.view { + view.accessibilityElements = [ + buttonsView, + dismissButton + ] + } + } + + override func accessibilityPerformEscape() -> Bool { + dismiss(animated: true) + return true + } } diff --git a/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift index 9df8f60e6..beac431ba 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift @@ -14,6 +14,9 @@ class LoginPrologueSignupMethodViewController: NUXViewController { open var googleTapped: (() -> Void)? open var appleTapped: (() -> Void)? + /// The big transparent (dismiss) button behind the buttons + @IBOutlet private weak var dismissButton: UIButton! + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { super.prepare(for: segue, sender: sender) @@ -25,6 +28,7 @@ class LoginPrologueSignupMethodViewController: NUXViewController { override func viewDidLoad() { super.viewDidLoad() configureButtonVC() + configureForAccessibility() } override func viewWillAppear(_ animated: Bool) { @@ -82,8 +86,7 @@ class LoginPrologueSignupMethodViewController: NUXViewController { } @IBAction func dismissTapped() { - WordPressAuthenticator.track(.signupCancelled) - dismiss(animated: true) + trackCancellationAndThenDismiss() } @objc func handleAppleButtonTapped() { @@ -92,4 +95,29 @@ class LoginPrologueSignupMethodViewController: NUXViewController { dismiss(animated: true) appleTapped?() } + + private func trackCancellationAndThenDismiss() { + WordPressAuthenticator.track(.signupCancelled) + dismiss(animated: true) + } + + // MARK: - Accessibility + + private func configureForAccessibility() { + dismissButton.accessibilityLabel = NSLocalizedString("Dismiss", comment: "Accessibility label for the transparent space above the signup dialog which acts as a button to dismiss the dialog.") + + // Ensure that the first button (in buttonViewController) is automatically selected by + // VoiceOver instead of the dismiss button. + if buttonViewController?.isViewLoaded == true, let buttonsView = buttonViewController?.view { + view.accessibilityElements = [ + buttonsView, + dismissButton + ] + } + } + + override func accessibilityPerformEscape() -> Bool { + trackCancellationAndThenDismiss() + return true + } } diff --git a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift index 292c0fbb4..8db550889 100644 --- a/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSelfHostedViewController.swift @@ -113,6 +113,7 @@ class LoginSelfHostedViewController: LoginViewController, NUXKeyboardResponder { /// @objc func configureForgotPasswordButton() { forgotPasswordButton.isEnabled = enableSubmit(animating: false) + WPStyleGuide.configureTextButton(forgotPasswordButton) } diff --git a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift index b878083c7..e51faf76b 100644 --- a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift @@ -47,6 +47,7 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder loginFields.meta.userIsDotCom = false configureTextFields() + configureSiteAddressHelpButton() configureSubmitButton(animating: false) configureViewForEditingIfNeeded() @@ -132,6 +133,10 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder } } + private func configureSiteAddressHelpButton() { + WPStyleGuide.configureTextButton(siteAddressHelpButton) + } + // MARK: - Instance Methods diff --git a/WordPressAuthenticator/Signin/LoginUsernamePasswordViewController.swift b/WordPressAuthenticator/Signin/LoginUsernamePasswordViewController.swift index ae700c767..6c65d1bb9 100644 --- a/WordPressAuthenticator/Signin/LoginUsernamePasswordViewController.swift +++ b/WordPressAuthenticator/Signin/LoginUsernamePasswordViewController.swift @@ -113,6 +113,7 @@ class LoginUsernamePasswordViewController: LoginViewController, NUXKeyboardRespo /// @objc func configureForgotPasswordButton() { forgotPasswordButton.isEnabled = enableSubmit(animating: false) + WPStyleGuide.configureTextButton(forgotPasswordButton) } diff --git a/WordPressAuthenticator/Signin/LoginWPComViewController.swift b/WordPressAuthenticator/Signin/LoginWPComViewController.swift index 9add6ab27..6a420ba33 100644 --- a/WordPressAuthenticator/Signin/LoginWPComViewController.swift +++ b/WordPressAuthenticator/Signin/LoginWPComViewController.swift @@ -45,6 +45,7 @@ class LoginWPComViewController: LoginViewController, NUXKeyboardResponder { configureTextFields() configureEmailIcon() + configureForgotPasswordButton() configureSubmitButton(animating: false) configureViewForEditingIfNeeded() } @@ -128,6 +129,13 @@ class LoginWPComViewController: LoginViewController, NUXKeyboardResponder { emailIcon?.image = image.imageWithTintColor(WordPressAuthenticator.shared.style.subheadlineColor) } + private func configureForgotPasswordButton() { + guard let forgotPasswordButton = forgotPasswordButton else { + return + } + WPStyleGuide.configureTextButton(forgotPasswordButton) + } + @objc func localizeControls() { instructionLabel?.text = {