Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: /.*/
2 changes: 1 addition & 1 deletion WordPressAuthenticator.podspec
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 1 addition & 3 deletions WordPressAuthenticator/Extensions/WPStyleGuide+Login.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -132,7 +131,6 @@ extension WPStyleGuide {
appleButton.heightAnchor.constraint(greaterThanOrEqualToConstant: Constants.buttonMinHeight).isActive = true
return appleButton
}
#endif

return UIControl()
}
Expand All @@ -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)
Expand Down
15 changes: 6 additions & 9 deletions WordPressAuthenticator/Signin/AppleAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import AuthenticationServices
import WordPressKit
import SVProgressHUD

#if XCODE11

@objc protocol AppleAuthenticatorDelegate {
func showWPComLogin(loginFields: LoginFields)
func authFailedWithError(message: String)
Expand Down Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down Expand Up @@ -193,5 +192,3 @@ extension AppleAuthenticator: ASAuthorizationControllerPresentationContextProvid
return showFromViewController?.view.window ?? UIWindow()
}
}

#endif
6 changes: 1 addition & 5 deletions WordPressAuthenticator/Signin/LoginEmailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -545,10 +545,8 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder {
}

private func appleTapped() {
#if XCODE11
AppleAuthenticator.sharedInstance.delegate = self
AppleAuthenticator.sharedInstance.showFrom(viewController: self)
#endif
}
}

Expand Down Expand Up @@ -637,7 +635,6 @@ extension LoginEmailViewController: LoginSocialErrorViewControllerDelegate {
extension LoginEmailViewController: GIDSignInUIDelegate {
}

#if XCODE11
extension LoginEmailViewController: AppleAuthenticatorDelegate {

func showWPComLogin(loginFields: LoginFields) {
Expand All @@ -650,4 +647,3 @@ extension LoginEmailViewController: AppleAuthenticatorDelegate {
}

}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -81,6 +79,8 @@ class LoginPrologueLoginMethodViewController: NUXViewController {
}

@objc func handleAppleButtonTapped() {
WordPressAuthenticator.track(.loginSocialButtonClick, properties: ["source": "apple"])

dismiss(animated: true)
appleTapped?()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -89,6 +87,8 @@ class LoginPrologueSignupMethodViewController: NUXViewController {
}

@objc func handleAppleButtonTapped() {
WordPressAuthenticator.track(.signupSocialButtonTapped, properties: ["source": "apple"])

dismiss(animated: true)
appleTapped?()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -139,4 +136,3 @@ extension LoginPrologueViewController: AppleAuthenticatorDelegate {
}

}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -368,7 +366,6 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder
}
}

#if XCODE11
extension LoginSiteAddressViewController: AppleAuthenticatorDelegate {

func showWPComLogin(loginFields: LoginFields) {
Expand All @@ -380,4 +377,3 @@ extension LoginSiteAddressViewController: AppleAuthenticatorDelegate {
displayErrorAlert(message, sourceTag: .loginApple)
}
}
#endif