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

Commit 1b6b543

Browse files
committed
Add new method to present verify email screen from the delegate
1 parent 81bf0ee commit 1b6b543

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,29 @@ 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+
@objc public class func showVerifyEmailForWPCom(from presenter: UIViewController, xmlrpc: String, connectedEmail: String, siteURL: String) {
200+
guard let xmlrpcURL = URL(string: xmlrpc) else {
201+
DDLogError("Failed to initiate XML-RPC URL from \(xmlrpc)")
202+
return
203+
}
204+
let loginFields = LoginFields()
205+
loginFields.meta.xmlrpcURL = xmlrpcURL as NSURL
206+
loginFields.username = connectedEmail
207+
loginFields.siteAddress = siteURL
208+
209+
guard let vc = VerifyEmailViewController.instantiate(from: .verifyEmail) else {
210+
DDLogError("Failed to navigate to VerifyEmailViewController")
211+
return
212+
}
213+
214+
vc.loginFields = loginFields
215+
let navController = LoginNavigationController(rootViewController: vc)
216+
navController.modalPresentationStyle = .fullScreen
217+
presenter.present(navController, animated: true, completion: nil)
218+
}
219+
197220
/// Shows the unified Login/Signup flow.
198221
///
199222
private class func showGetStarted(from presenter: UIViewController, jetpackLogin: Bool, connectedEmail: String? = nil, siteURL: String? = nil) {

0 commit comments

Comments
 (0)