@@ -9,84 +9,6 @@ struct JetpackAuthenticationManager: AuthenticationHandler {
99 var prologuePrimaryButtonStyle : NUXButtonStyle ? = JetpackPrologueStyleGuide . continueButtonStyle
1010 var prologueSecondaryButtonStyle : NUXButtonStyle ? = JetpackPrologueStyleGuide . siteAddressButtonStyle
1111
12- func shouldPresentUsernamePasswordController( for siteInfo: WordPressComSiteInfo ? , onCompletion: @escaping ( WordPressAuthenticatorResult ) -> Void ) {
13- /// Jetpack is required. Present an error if we don't detect a valid installation.
14- guard let site = siteInfo, isValidJetpack ( for: site) else {
15- let viewModel = JetpackNotFoundErrorViewModel ( with: siteInfo? . url)
16- let controller = errorViewController ( with: viewModel)
17-
18- let authenticationResult : WordPressAuthenticatorResult = . injectViewController( value: controller)
19- onCompletion ( authenticationResult)
20-
21- return
22- }
23-
24- /// WordPress must be present.
25- guard site. isWP else {
26- let viewModel = JetpackNotWPErrorViewModel ( )
27- let controller = errorViewController ( with: viewModel)
28-
29- let authenticationResult : WordPressAuthenticatorResult = . injectViewController( value: controller)
30- onCompletion ( authenticationResult)
31-
32- return
33- }
34-
35- /// For self-hosted sites, navigate to enter the email address associated to the wp.com account:
36- guard site. isWPCom else {
37- let authenticationResult : WordPressAuthenticatorResult = . presentEmailController
38-
39- onCompletion ( authenticationResult)
40-
41- return
42- }
43-
44- /// We should never reach this point, as WPAuthenticator won't call its delegate for this case.
45- ///
46- DDLogWarn ( " ⚠️ Present password controller for site: \( site. url) " )
47- let authenticationResult : WordPressAuthenticatorResult = . presentPasswordController( value: false )
48- onCompletion ( authenticationResult)
49- }
50-
51- func willHandlePresentLoginEpilogue( in navigationController: UINavigationController , for credentials: AuthenticatorCredentials ) -> Bool {
52- // Don't display the "no sites" epilogue if we allow site creation
53- return !AppConfiguration. allowSiteCreation
54- }
55-
56- func presentLoginEpilogue( in navigationController: UINavigationController , for credentials: AuthenticatorCredentials , windowManager: WindowManager , onDismiss: @escaping ( ) -> Void ) -> Bool {
57- if AccountHelper . hasBlogs {
58- return false
59- }
60-
61- // Exit out of the sign in process, if we don't do this we later can't
62- // display the sign in again
63- windowManager. dismissFullscreenSignIn ( )
64-
65- // Display the no sites view
66- let viewModel = JetpackNoSitesErrorViewModel ( )
67- let controller = errorViewController ( with: viewModel)
68- windowManager. show ( controller, completion: nil )
69-
70- return true
71- }
72-
73- func willHandlePresentSignupEpilogue( in navigationController: UINavigationController , for credentials: AuthenticatorCredentials , service: SocialService ? ) -> Bool {
74- // Don't display the "no sites" epilogue if we allow site creation
75- return !AppConfiguration. allowSiteCreation
76- }
77-
78- // If the user signs up using the Jetpack app (through SIWA, for example)
79- // We show right away the screen explaining that they do not have Jetpack sites
80- func presentSignupEpilogue( in navigationController: UINavigationController , for credentials: AuthenticatorCredentials , service: SocialService ? ) {
81- let windowManager = WordPressAppDelegate . shared? . windowManager
82-
83- windowManager? . dismissFullscreenSignIn ( )
84-
85- let viewModel = JetpackNoSitesErrorViewModel ( )
86- let controller = errorViewController ( with: viewModel)
87- windowManager? . show ( controller, completion: nil )
88- }
89-
9012 // MARK: - Private: Helpers
9113 private func isValidJetpack( for site: WordPressComSiteInfo ) -> Bool {
9214 return site. hasJetpack &&
0 commit comments