diff --git a/Podfile b/Podfile index 5e7789d04..0a4dd901e 100644 --- a/Podfile +++ b/Podfile @@ -11,7 +11,7 @@ def wordpress_authenticator_pods ## pod 'Gridicons', '~> 1.0' pod 'WordPressUI', '~> 1.5.2' - pod 'WordPressKit', '~> 4.7.0' + pod 'WordPressKit', '~> 4.8.0' # pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :branch => '' # pod 'WordPressKit', :git => 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', :commit => '' pod 'WordPressShared', '~> 1.8.16' diff --git a/Podfile.lock b/Podfile.lock index 38440736e..86b625bd6 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.7.0): + - WordPressKit (4.8.0): - Alamofire (~> 4.8.0) - CocoaLumberjack (~> 3.4) - NSObject-SafeExpectations (= 0.0.4) @@ -71,7 +71,7 @@ DEPENDENCIES: - OHHTTPStubs/Swift (= 8.0.0) - Specta (= 1.0.7) - SVProgressHUD (= 2.2.5) - - WordPressKit (~> 4.7.0) + - WordPressKit (~> 4.8.0) - WordPressShared (~> 1.8.16) - WordPressUI (~> 1.5.2) @@ -117,11 +117,11 @@ SPEC CHECKSUMS: Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66 SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6 UIDeviceIdentifier: 44f805037d21b94394821828f4fcaba34b38c2d0 - WordPressKit: 0602e8188245b3267269570d3d78c138e64a4eba + WordPressKit: 84045e236949248632a2c644149e5657733011bb WordPressShared: 1bc316ed162f42af4e0fa2869437e9e28b532b01 WordPressUI: 70cc58a253c352330b23cd8fa6dd6a2021570e18 wpxmlrpc: 6a9bdd6ab9d1b159b384b0df0f3f39de9af4fecf -PODFILE CHECKSUM: d2a5f1cb57eeb9eb2ac2cb22d29b6b827ccf8ce4 +PODFILE CHECKSUM: 8e0158473c1f3e6910b3b417c2f53fee11dc0bfc COCOAPODS: 1.8.4 diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 6c06058e7..f6d07700f 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressAuthenticator" - s.version = "1.12.1" + s.version = "1.13.0" s.summary = "WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps." s.description = <<-DESC @@ -40,6 +40,6 @@ Pod::Spec.new do |s| s.dependency 'Gridicons', '~> 1.0' s.dependency 'GoogleSignIn', '~> 4.4' s.dependency 'WordPressUI', '~> 1.5.2' - s.dependency 'WordPressKit', '~> 4.7.0' + s.dependency 'WordPressKit', '~> 4.8.0' s.dependency 'WordPressShared', '~> 1.8.16' end diff --git a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift index 9e20f0fb5..4e4cbf05d 100644 --- a/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift +++ b/WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift @@ -198,8 +198,7 @@ import AuthenticationServices /// Returns an instance of LoginSiteAddressViewController: allows the user to log into a WordPress.org website. /// @objc public class func signinForWPOrg() -> UIViewController { - let storyboard = UIStoryboard(name: "Login", bundle: bundle) - guard let controller = storyboard.instantiateViewController(withIdentifier: "siteAddress") as? LoginSiteAddressViewController else { + guard let controller = LoginSiteAddressViewController.instantiate(from: .login) else { fatalError("unable to create wpcom password screen") } diff --git a/WordPressAuthenticator/NUX/NUXViewController.swift b/WordPressAuthenticator/NUX/NUXViewController.swift index 94646b58d..489557766 100644 --- a/WordPressAuthenticator/NUX/NUXViewController.swift +++ b/WordPressAuthenticator/NUX/NUXViewController.swift @@ -25,10 +25,7 @@ open class NUXViewController: UIViewController, NUXViewControllerBase, UIViewCon // MARK: associated type for NUXSegueHandler /// Segue identifiers to avoid using strings public enum SegueIdentifier: String { - case showSigninV2 - case showURLUsernamePassword case showWPUsernamePassword - case showSelfHostedLogin case showWPComLogin case startMagicLinkFlow case showMagicLink diff --git a/WordPressAuthenticator/Signin/Login.storyboard b/WordPressAuthenticator/Signin/Login.storyboard index da1ed4cf2..82aee14c0 100644 --- a/WordPressAuthenticator/Signin/Login.storyboard +++ b/WordPressAuthenticator/Signin/Login.storyboard @@ -1,9 +1,9 @@ - + - + @@ -108,9 +108,7 @@ - - @@ -350,28 +348,17 @@ - - - - - - - - - - - - + @@ -1013,7 +1000,7 @@ - + @@ -1155,7 +1142,6 @@ - @@ -1435,17 +1421,14 @@ - - - - - - - - + + + + + diff --git a/WordPressAuthenticator/Signin/LoginEmailViewController.swift b/WordPressAuthenticator/Signin/LoginEmailViewController.swift index 26575fddb..b3903f61e 100644 --- a/WordPressAuthenticator/Signin/LoginEmailViewController.swift +++ b/WordPressAuthenticator/Signin/LoginEmailViewController.swift @@ -205,8 +205,14 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder { // Don't forget to handle the button taps! vc.emailTapped = { [weak self] in - self?.performSegue(withIdentifier: .showSigninV2, sender: self) + guard let toVC = SignupEmailViewController.instantiate(from: .signup) else { + DDLogError("Failed to navigate from LoginEmailViewController to SignupEmailViewController") + return + } + + self?.navigationController?.pushViewController(toVC, animated: true) } + vc.googleTapped = { [weak self] in guard let toVC = SignupGoogleViewController.instantiate(from: .signup) else { DDLogError("Failed to navigate to SignupGoogleViewController") @@ -215,6 +221,7 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder { self?.navigationController?.pushViewController(toVC, animated: true) } + vc.appleTapped = { [weak self] in self?.appleTapped() } @@ -396,13 +403,24 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder { } /// Configures loginFields to log into wordpress.com and - /// navigates to the selfhosted username/password form. Displays the specified - /// error message when the new view controller appears. + /// navigates to the selfhosted username/password form. + /// Displays the specified error message when the new + /// view controller appears. /// @objc func showSelfHostedUsernamePasswordAndError(_ error: Error) { loginFields.siteAddress = "https://wordpress.com" errorToPresent = error - performSegue(withIdentifier: .showURLUsernamePassword, sender: self) + + guard let vc = LoginSelfHostedViewController.instantiate(from: .login) else { + DDLogError("Failed to navigate from LoginEmailViewController to LoginSelfHostedViewController") + return + } + + vc.loginFields = loginFields + vc.dismissBlock = dismissBlock + vc.errorToPresent = errorToPresent + + navigationController?.pushViewController(vc, animated: true) } override open func displayRemoteError(_ error: Error) { @@ -417,29 +435,6 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder { return EmailFormatValidator.validate(string: loginFields.username) } - - // MARK: - Segue - - override open func prepare(for segue: UIStoryboardSegue, sender: Any?) { - super.prepare(for: segue, sender: sender) - - if let vc = segue.destination as? LoginPrologueSignupMethodViewController { - vc.transitioningDelegate = self - vc.emailTapped = { [weak self] in - self?.performSegue(withIdentifier: .showSigninV2, sender: self) - } - vc.googleTapped = { [weak self] in - guard let toVC = SignupGoogleViewController.instantiate(from: .signup) else { - DDLogError("Failed to navigate to SignupGoogleViewController") - return - } - - self?.navigationController?.pushViewController(toVC, animated: true) - } - vc.modalPresentationStyle = .custom - } - } - // MARK: - Actions @@ -536,7 +531,9 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder { // MARK: - Google Sign In -// LoginFacadeDelegate methods for Google Google Sign In +/// Make Google Sign In conform to the LoginFacade protocol. +/// The delegate calls these methods from LoginFacade.m. +/// extension LoginEmailViewController { func finishedLogin(withGoogleIDToken googleIDToken: String, authToken: String) { googleFinishedLogin(withGoogleIDToken: googleIDToken, authToken: authToken) @@ -547,6 +544,9 @@ extension LoginEmailViewController { googleExistingUserNeedsConnection(email) } + /// After a successful Google Sign In, this method gets called when the user + /// has enabled 2-factor authentication for their WordPress.com account. + /// func needsMultifactorCode(forUserID userID: Int, andNonceInfo nonceInfo: SocialLogin2FANonceInfo) { configureViewLoading(false) socialNeedsMultifactorCode(forUserID: userID, andNonceInfo: nonceInfo) diff --git a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift index 2ef87d374..c05dd0a3e 100644 --- a/WordPressAuthenticator/Signin/LoginPrologueViewController.swift +++ b/WordPressAuthenticator/Signin/LoginPrologueViewController.swift @@ -78,10 +78,10 @@ class LoginPrologueViewController: LoginViewController { let loginTitle = NSLocalizedString("Log In", comment: "Button title. Tapping takes the user to the login form.") let createTitle = NSLocalizedString("Sign up for WordPress.com", comment: "Button title. Tapping begins the process of creating a WordPress.com account.") - buttonViewController.setupTopButton(title: loginTitle, isPrimary: true, accessibilityIdentifier: "Prologue Log In Button") { [weak self] in + buttonViewController.setupTopButton(title: loginTitle, isPrimary: false, accessibilityIdentifier: "Prologue Log In Button") { [weak self] in self?.loginTapped() } - buttonViewController.setupBottomButton(title: createTitle, isPrimary: false, accessibilityIdentifier: "Prologue Signup Button") { [weak self] in + buttonViewController.setupBottomButton(title: createTitle, isPrimary: true, accessibilityIdentifier: "Prologue Signup Button") { [weak self] in self?.signupTapped() } if showCancel { @@ -124,7 +124,12 @@ class LoginPrologueViewController: LoginViewController { vc.modalPresentationStyle = .custom vc.emailTapped = { [weak self] in - self?.performSegue(withIdentifier: .showSigninV2, sender: self) + guard let toVC = SignupEmailViewController.instantiate(from: .signup) else { + DDLogError("Failed to navigate to SignupEmailViewController") + return + } + + self?.navigationController?.pushViewController(toVC, animated: true) } vc.googleTapped = { [weak self] in diff --git a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift index 03363719b..8c0326022 100644 --- a/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift +++ b/WordPressAuthenticator/Signin/LoginSiteAddressViewController.swift @@ -258,7 +258,16 @@ class LoginSiteAddressViewController: LoginViewController, NUXKeyboardResponder /// @objc func showSelfHostedUsernamePassword() { configureViewLoading(false) - performSegue(withIdentifier: .showURLUsernamePassword, sender: self) + guard let vc = LoginSelfHostedViewController.instantiate(from: .login) else { + DDLogError("Failed to navigate from LoginEmailViewController to LoginSelfHostedViewController") + return + } + + vc.loginFields = loginFields + vc.dismissBlock = dismissBlock + vc.errorToPresent = errorToPresent + + navigationController?.pushViewController(vc, animated: true) } /// Break away from the self-hosted flow. diff --git a/WordPressAuthenticator/Signin/LoginViewController.swift b/WordPressAuthenticator/Signin/LoginViewController.swift index 0252a08c9..c12b391f7 100644 --- a/WordPressAuthenticator/Signin/LoginViewController.swift +++ b/WordPressAuthenticator/Signin/LoginViewController.swift @@ -136,8 +136,18 @@ open class LoginViewController: NUXViewController, LoginFacadeDelegate { } /// Displays the self-hosted sign in form. + /// func loginToSelfHostedSite() { - performSegue(withIdentifier: .showSelfHostedLogin, sender: self) + guard let vc = LoginSiteAddressViewController.instantiate(from: .login) else { + DDLogError("Failed to navigate from LoginViewController to LoginSiteAddressViewController") + return + } + + vc.loginFields = loginFields + vc.dismissBlock = dismissBlock + vc.errorToPresent = errorToPresent + + navigationController?.pushViewController(vc, animated: true) } /// Validates what is entered in the various form fields and, if valid, diff --git a/WordPressAuthenticator/Signup/Signup.storyboard b/WordPressAuthenticator/Signup/Signup.storyboard index d6ab6cfe0..94c12288e 100644 --- a/WordPressAuthenticator/Signup/Signup.storyboard +++ b/WordPressAuthenticator/Signup/Signup.storyboard @@ -27,7 +27,7 @@ - +