diff --git a/.circleci/config.yml b/.circleci/config.yml index 0bda75289..c8465b743 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,20 +2,29 @@ version: 2.1 orbs: # This uses the iOS Orb located at https://github.com/wordpress-mobile/circleci-orbs - ios: wordpress-mobile/ios@0.0.24 + ios: wordpress-mobile/ios@0.0.31 workflows: test_and_validate: jobs: - ios/test: name: Test - xcode-version: "10.2.0" + xcode-version: "11.0" workspace: WordPressAuthenticator.xcworkspace scheme: WordPressAuthenticator - device: iPhone XS - ios-version: "12.2" + device: iPhone 11 + ios-version: "13.0" - ios/validate-podspec: name: Validate Podspec - xcode-version: "10.2.0" + xcode-version: "11.0" podspec-path: WordPressAuthenticator.podspec update-specs-repo: true + - ios/publish-podspec: + name: Publish to Trunk + xcode-version: "11.0" + podspec-path: WordPressAuthenticator.podspec + filters: + tags: + only: /.*/ + branches: + ignore: /.*/ diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index b329a5421..e5df79888 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.8.1-beta.2" + s.version = "1.9.0" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC diff --git a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift index d64ac8cbd..e91513e7f 100644 --- a/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift +++ b/WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift @@ -122,7 +122,6 @@ extension WPStyleGuide { /// class func appleLoginButton() -> UIControl { - #if XCODE11 if #available(iOS 13.0, *) { let traits = UITraitCollection.current let buttonStyle: ASAuthorizationAppleIDButton.Style = (traits.userInterfaceStyle == .dark) ? .white : .black @@ -132,7 +131,6 @@ extension WPStyleGuide { appleButton.heightAnchor.constraint(greaterThanOrEqualToConstant: Constants.buttonMinHeight).isActive = true return appleButton } - #endif return UIControl() } @@ -156,7 +154,7 @@ extension WPStyleGuide { button = textButton(normal: attrStrNormal, highlighted: attrStrHighlight, font: font, alignment: alignment) } else { - let baseString = NSLocalizedString("Log in by entering your site address.", comment: "Label for button to log in using your site address.") + let baseString = NSLocalizedString("Enter the address of the WordPress site you'd like to connect.", comment: "Label for button to log in using your site address.") let attrStrNormal = selfHostedButtonString(baseString, linkColor: style.textButtonColor) let attrStrHighlight = selfHostedButtonString(baseString, linkColor: style.textButtonHighlightColor) diff --git a/WordPressAuthenticator/Signin/AppleAuthenticator.swift b/WordPressAuthenticator/Signin/AppleAuthenticator.swift index 4dee52169..0b994bb1c 100644 --- a/WordPressAuthenticator/Signin/AppleAuthenticator.swift +++ b/WordPressAuthenticator/Signin/AppleAuthenticator.swift @@ -3,8 +3,6 @@ import AuthenticationServices import WordPressKit import SVProgressHUD -#if XCODE11 - @objc protocol AppleAuthenticatorDelegate { func showWPComLogin(loginFields: LoginFields) func authFailedWithError(message: String) @@ -101,12 +99,13 @@ private extension AppleAuthenticator { func signupSuccessful(with credentials: AuthenticatorCredentials) { WordPressAuthenticator.track(.createdAccount, properties: ["source": "apple"]) - WordPressAuthenticator.track(.signupSocialSuccess) + WordPressAuthenticator.track(.signupSocialSuccess, properties: ["source": "apple"]) showSignupEpilogue(for: credentials) } func loginSuccessful(with credentials: AuthenticatorCredentials) { - // TODO: Tracks events for login + WordPressAuthenticator.track(.signedIn, properties: ["source": "apple"]) + WordPressAuthenticator.track(.loginSocialSuccess, properties: ["source": "apple"]) showSigninEpilogue(for: credentials) } @@ -132,13 +131,13 @@ private extension AppleAuthenticator { func signupFailed(with error: Error) { DDLogError("Apple Authenticator: Signup failed. error: \(error.localizedDescription)") - WPAnalytics.track(.signupSocialFailure) + WordPressAuthenticator.track(.signupSocialFailure, properties: ["source": "apple"]) delegate?.authFailedWithError(message: error.localizedDescription) } func logInInstead() { - WordPressAuthenticator.track(.signupSocialToLogin) - WordPressAuthenticator.track(.loginSocialSuccess) + WordPressAuthenticator.track(.signupSocialToLogin, properties: ["source": "apple"]) + WordPressAuthenticator.track(.loginSocialSuccess, properties: ["source": "apple"]) delegate?.showWPComLogin(loginFields: loginFields) } @@ -193,5 +192,3 @@ extension AppleAuthenticator: ASAuthorizationControllerPresentationContextProvid return showFromViewController?.view.window ?? UIWindow() } } - -#endif diff --git a/WordPressAuthenticator/Signin/LoginEmailViewController.swift b/WordPressAuthenticator/Signin/LoginEmailViewController.swift index e362cb4f6..26d07687c 100644 --- a/WordPressAuthenticator/Signin/LoginEmailViewController.swift +++ b/WordPressAuthenticator/Signin/LoginEmailViewController.swift @@ -172,7 +172,7 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder { GIDSignIn.sharedInstance().signIn() - WordPressAuthenticator.track(.loginSocialButtonClick) + WordPressAuthenticator.track(.loginSocialButtonClick, properties: ["source": "google"]) } /// Add the log in with site address button to the view @@ -545,10 +545,8 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder { } private func appleTapped() { - #if XCODE11 AppleAuthenticator.sharedInstance.delegate = self AppleAuthenticator.sharedInstance.showFrom(viewController: self) - #endif } } @@ -637,7 +635,6 @@ extension LoginEmailViewController: LoginSocialErrorViewControllerDelegate { extension LoginEmailViewController: GIDSignInUIDelegate { } -#if XCODE11 extension LoginEmailViewController: AppleAuthenticatorDelegate { func showWPComLogin(loginFields: LoginFields) { @@ -650,4 +647,3 @@ extension LoginEmailViewController: AppleAuthenticatorDelegate { } } -#endif diff --git a/WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift index 56e61d7e9..cd9410360 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueLoginMethodViewController.swift @@ -45,7 +45,7 @@ class LoginPrologueLoginMethodViewController: NUXViewController { let googleTitle = NSLocalizedString("Continue with Google", comment: "Button title. Tapping begins log in using Google.") buttonViewController.setupBottomButton(title: googleTitle, isPrimary: false, accessibilityIdentifier: "Log in with Google Button") { [weak self] in defer { - WordPressAuthenticator.track(.loginSocialButtonClick) + WordPressAuthenticator.track(.loginSocialButtonClick, properties: ["source": "google"]) } self?.dismiss(animated: true) @@ -59,13 +59,11 @@ class LoginPrologueLoginMethodViewController: NUXViewController { } if WordPressAuthenticator.shared.configuration.enableSignInWithApple { - #if XCODE11 if #available(iOS 13.0, *) { let appleButton = WPStyleGuide.appleLoginButton() appleButton.addTarget(self, action: #selector(handleAppleButtonTapped), for: .touchDown) - buttonViewController.stackView?.insertArrangedSubview(appleButton, at: 0) + buttonViewController.stackView?.insertArrangedSubview(appleButton, at: 2) } - #endif } buttonViewController.backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor @@ -81,6 +79,8 @@ class LoginPrologueLoginMethodViewController: NUXViewController { } @objc func handleAppleButtonTapped() { + WordPressAuthenticator.track(.loginSocialButtonClick, properties: ["source": "apple"]) + dismiss(animated: true) appleTapped?() } diff --git a/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift index 1a1029404..9df8f60e6 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift @@ -49,7 +49,7 @@ class LoginPrologueSignupMethodViewController: NUXViewController { buttonViewController.setupBottomButton(title: createTitle, isPrimary: false, accessibilityIdentifier: "Sign up with Google Button") { [weak self] in defer { - WordPressAuthenticator.track(.signupSocialButtonTapped) + WordPressAuthenticator.track(.signupSocialButtonTapped, properties: ["source": "google"]) } self?.dismiss(animated: true) @@ -71,13 +71,11 @@ class LoginPrologueSignupMethodViewController: NUXViewController { buttonViewController.stackView?.insertArrangedSubview(termsButton, at: 0) if WordPressAuthenticator.shared.configuration.enableSignInWithApple { - #if XCODE11 if #available(iOS 13.0, *) { let appleButton = WPStyleGuide.appleLoginButton() appleButton.addTarget(self, action: #selector(handleAppleButtonTapped), for: .touchDown) - buttonViewController.stackView?.insertArrangedSubview(appleButton, at: 1) + buttonViewController.stackView?.insertArrangedSubview(appleButton, at: 3) } - #endif } buttonViewController.backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor @@ -89,6 +87,8 @@ class LoginPrologueSignupMethodViewController: NUXViewController { } @objc func handleAppleButtonTapped() { + WordPressAuthenticator.track(.signupSocialButtonTapped, properties: ["source": "apple"]) + dismiss(animated: true) appleTapped?() } diff --git a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift index 7903da9f3..627d5c074 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift @@ -118,15 +118,12 @@ class LoginPrologueViewController: LoginViewController { } private func appleTapped() { - #if XCODE11 AppleAuthenticator.sharedInstance.delegate = self AppleAuthenticator.sharedInstance.showFrom(viewController: self) - #endif } } -#if XCODE11 extension LoginPrologueViewController: AppleAuthenticatorDelegate { func showWPComLogin(loginFields: LoginFields) { @@ -139,4 +136,3 @@ extension LoginPrologueViewController: AppleAuthenticatorDelegate { } } -#endif diff --git a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift index 5b7774e72..4f3c85f87 100644 --- a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift @@ -27,7 +27,7 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder // MARK: - URL Validation private lazy var urlErrorDebouncer = Debouncer(delay: 2) { [weak self] in - let errorMessage = NSLocalizedString("Enter a valid URL eg. example.com.", comment: "Error message shown when a URL is invalid.") + let errorMessage = NSLocalizedString("Please enter a complete website address, like example.com.", comment: "Error message shown when a URL is invalid.") self?.displayError(message: errorMessage) } @@ -286,10 +286,8 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder } private func appleTapped() { - #if XCODE11 AppleAuthenticator.sharedInstance.delegate = self AppleAuthenticator.sharedInstance.showFrom(viewController: self) - #endif } /// Whether the form can be submitted. @@ -368,7 +366,6 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder } } -#if XCODE11 extension LoginSiteAddressViewController: AppleAuthenticatorDelegate { func showWPComLogin(loginFields: LoginFields) { @@ -380,4 +377,3 @@ extension LoginSiteAddressViewController: AppleAuthenticatorDelegate { displayErrorAlert(message, sourceTag: .loginApple) } } -#endif