@@ -43,9 +43,9 @@ public enum SignInError: Error {
4343class GetStartedViewController : LoginViewController , NUXKeyboardResponder {
4444
4545 private enum ScreenMode {
46- /// For signing in using .org site credentials
46+ /// For signing in using site address
4747 ///
48- case signInUsingSiteCredentials
48+ case signInUsingSiteAddress ( isWPComSite : Bool )
4949
5050 /// For signing in using WPCOM credentials or social accounts
5151 case signInUsingWordPressComOrSocialAccounts
@@ -87,14 +87,17 @@ class GetStartedViewController: LoginViewController, NUXKeyboardResponder {
8787
8888 private var passwordCoordinator : PasswordCoordinator ?
8989
90+ // This is internal so it can be set from SiteAddressViewController.
91+ var wpcomSiteAddressDetected = false
92+
9093 /// Sign in with site credentials button will be displayed based on the `screenMode`
9194 ///
9295 private var screenMode : ScreenMode {
9396 guard configuration. enableSiteCredentialsLoginForSelfHostedSites,
9497 loginFields. siteAddress. isEmpty == false else {
9598 return . signInUsingWordPressComOrSocialAccounts
9699 }
97- return . signInUsingSiteCredentials
100+ return . signInUsingSiteAddress ( isWPComSite : wpcomSiteAddressDetected )
98101 }
99102
100103 // Submit button displayed in the table footer.
@@ -145,8 +148,8 @@ class GetStartedViewController: LoginViewController, NUXKeyboardResponder {
145148 setupTableFooterView ( )
146149 configureDivider ( )
147150
148- if screenMode == . signInUsingSiteCredentials {
149- configureButtonViewControllerForSiteCredentialsMode ( )
151+ if case . signInUsingSiteAddress ( let isWPComSite ) = screenMode {
152+ configureButtonViewControllerForSiteAddressMode ( isWPComSite : isWPComSite )
150153 } else if configuration. enableSocialLogin == false {
151154 configureButtonViewControllerWithoutSocialLogin ( )
152155 } else {
@@ -462,7 +465,7 @@ private extension GetStartedViewController {
462465 func configureAnalyticsTracker( ) {
463466 // Configure tracker flow based on screen mode.
464467 switch screenMode {
465- case . signInUsingSiteCredentials :
468+ case . signInUsingSiteAddress :
466469 tracker. set ( flow: . loginWithSiteAddress)
467470 case . signInUsingWordPressComOrSocialAccounts:
468471 tracker. set ( flow: . wpCom)
@@ -803,7 +806,7 @@ private extension GetStartedViewController {
803806 termsButton. addTarget ( self , action: #selector( termsTapped) , for: . touchUpInside)
804807 }
805808
806- func configureButtonViewControllerForSiteCredentialsMode ( ) {
809+ func configureButtonViewControllerForSiteAddressMode ( isWPComSite : Bool ) {
807810 guard let buttonViewController = buttonViewController else {
808811 return
809812 }
@@ -813,11 +816,13 @@ private extension GetStartedViewController {
813816 if configuration. enableSocialLogin {
814817 configureSocialButtons ( )
815818
816- // Setup Sign in with site credentials button
817- buttonViewController. setupTertiaryButton ( attributedTitle: WPStyleGuide . formattedSignInWithSiteCredentialsString ( ) ,
818- isPrimary: false ,
819- accessibilityIdentifier: ButtonConfiguration . SignInWithSiteCredentials. accessibilityIdentifier) { [ weak self] in
820- self ? . handleSiteCredentialsButtonTapped ( )
819+ if isWPComSite == false {
820+ // Setup Sign in with site credentials button
821+ buttonViewController. setupTertiaryButton ( attributedTitle: WPStyleGuide . formattedSignInWithSiteCredentialsString ( ) ,
822+ isPrimary: false ,
823+ accessibilityIdentifier: ButtonConfiguration . SignInWithSiteCredentials. accessibilityIdentifier) { [ weak self] in
824+ self ? . handleSiteCredentialsButtonTapped ( )
825+ }
821826 }
822827 } else {
823828 // Add a "Continue" button here as the `continueButton` at the top will be hidden
@@ -830,11 +835,13 @@ private extension GetStartedViewController {
830835 }
831836 }
832837
833- // Setup Sign in with site credentials button
834- buttonViewController. setupBottomButton ( attributedTitle: WPStyleGuide . formattedSignInWithSiteCredentialsString ( ) ,
835- isPrimary: false ,
836- accessibilityIdentifier: ButtonConfiguration . SignInWithSiteCredentials. accessibilityIdentifier) { [ weak self] in
837- self ? . handleSiteCredentialsButtonTapped ( )
838+ if isWPComSite == false {
839+ // Setup Sign in with site credentials button
840+ buttonViewController. setupBottomButton ( attributedTitle: WPStyleGuide . formattedSignInWithSiteCredentialsString ( ) ,
841+ isPrimary: false ,
842+ accessibilityIdentifier: ButtonConfiguration . SignInWithSiteCredentials. accessibilityIdentifier) { [ weak self] in
843+ self ? . handleSiteCredentialsButtonTapped ( )
844+ }
838845 }
839846 }
840847 }
0 commit comments