Skip to content

Commit 5e1bdac

Browse files
committed
Create variable for noWPUI
1 parent 297756a commit 5e1bdac

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

WooCommerce/Classes/Authentication/AuthenticationManager.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@ extension AuthenticationManager: WordPressAuthenticatorDelegate {
321321
hasValidJetpack: siteInfo?.hasValidJetpack ?? false))
322322

323323
guard let site = siteInfo, let navigationController = navigationController else {
324-
let viewModel = NotWPErrorViewModel()
325-
let noWPUI = ULErrorViewController(viewModel: viewModel)
326324
navigationController?.show(noWPUI, sender: nil)
327325
return
328326
}
@@ -615,12 +613,18 @@ private extension AuthenticationManager {
615613
return noWooUI
616614
}
617615

616+
/// The error screen to be displayed when the user tries to enter a site without WordPress.
617+
///
618+
var noWPUI: UIViewController {
619+
let viewModel = NotWPErrorViewModel()
620+
return ULErrorViewController(viewModel: viewModel)
621+
}
622+
618623
/// Appropriate error to display for a site when entered from the site discovery flow.
619624
///
620625
func errorUI(for site: WordPressComSiteInfo, in navigationController: UINavigationController) -> UIViewController {
621626
guard site.isWP else {
622-
let viewModel = NotWPErrorViewModel()
623-
return ULErrorViewController(viewModel: viewModel)
627+
return noWPUI
624628
}
625629

626630
let matcher = ULAccountMatcher(storageManager: storageManager)

0 commit comments

Comments
 (0)