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

Commit 6ddbf0a

Browse files
committed
Add helper method to fetch site info
1 parent d50be84 commit 6ddbf0a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

WordPressAuthenticator/Authenticator/WordPressAuthenticator.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,17 @@ import WordPressKit
251251
presenter.present(navController, animated: true, completion: nil)
252252
}
253253

254+
/// A helper method to fetch site info for a given URL.
255+
///
256+
public class func fetchSiteInfo(for siteURL: String, onCompletion: @escaping (Result<WordPressComSiteInfo, Error>) -> Void) {
257+
let service = WordPressComBlogService()
258+
service.fetchUnauthenticatedSiteInfoForAddress(for: siteURL, success: { siteInfo in
259+
onCompletion(.success(siteInfo))
260+
}, failure: { error in
261+
onCompletion(.failure(error))
262+
})
263+
}
264+
254265
/// Shows the unified Login/Signup flow.
255266
///
256267
private class func showGetStarted(from presenter: UIViewController, jetpackLogin: Bool, connectedEmail: String? = nil, siteURL: String? = nil) {

0 commit comments

Comments
 (0)