Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit eaee752

Browse files
authored
Merge pull request #678 from wordpress-mobile/wcios/verify-email-from-delegate
Show verify email screen from the authenticator
2 parents 90cfbd6 + d246d72 commit eaee752

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Pod::Spec.new do |s|
44
s.name = 'WordPressAuthenticator'
5-
s.version = '3.0.0'
5+
s.version = '3.1.0-beta.1'
66

77
s.summary = 'WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps.'
88
s.description = <<-DESC

WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,35 @@ import WordPressKit
194194
showGetStarted(from: presenter, jetpackLogin: jetpackLogin, connectedEmail: connectedEmail, siteURL: siteURL)
195195
}
196196

197+
/// Used to present the Verify Email flow from the app delegate.
198+
///
199+
/// - Parameters:
200+
/// - presenter: The view controller that presents the Verify Email view.
201+
/// - xmlrpc: The URL to reach the XMLRPC file of the site to log in to.
202+
/// - connectedEmail: The email address used to authorized Jetpack connection with the site.
203+
/// - siteURL: The URL of the site to log in to.
204+
///
205+
@objc public class func showVerifyEmailForWPCom(from presenter: UIViewController, xmlrpc: String, connectedEmail: String, siteURL: String) {
206+
guard let xmlrpcURL = URL(string: xmlrpc) else {
207+
DDLogError("Failed to initiate XML-RPC URL from \(xmlrpc)")
208+
return
209+
}
210+
let loginFields = LoginFields()
211+
loginFields.meta.xmlrpcURL = xmlrpcURL as NSURL
212+
loginFields.username = connectedEmail
213+
loginFields.siteAddress = siteURL
214+
215+
guard let vc = VerifyEmailViewController.instantiate(from: .verifyEmail) else {
216+
DDLogError("Failed to navigate to VerifyEmailViewController")
217+
return
218+
}
219+
220+
vc.loginFields = loginFields
221+
let navController = LoginNavigationController(rootViewController: vc)
222+
navController.modalPresentationStyle = .fullScreen
223+
presenter.present(navController, animated: true, completion: nil)
224+
}
225+
197226
/// Shows the unified Login/Signup flow.
198227
///
199228
private class func showGetStarted(from presenter: UIViewController, jetpackLogin: Bool, connectedEmail: String? = nil, siteURL: String? = nil) {

0 commit comments

Comments
 (0)