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

Commit 08a25e9

Browse files
authored
Hide site credential login button from Get Started screen after entering a WPCom site address (#855)
2 parents 88d1755 + 0a18a7d commit 08a25e9

File tree

5 files changed

+37
-24
lines changed

5 files changed

+37
-24
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ _None._
4848

4949
_None._
5050

51+
## 9.0.9
52+
53+
### Bug Fixes
54+
55+
- Hide site credential login option from Get Started screen after entering a WPCom site address [#855]
56+
5157
## 9.0.8
5258

5359
### Internal Changes

Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PODS:
88
- SVProgressHUD (2.2.5)
99
- SwiftLint (0.54.0)
1010
- UIDeviceIdentifier (2.3.0)
11-
- WordPressAuthenticator (9.0.8):
11+
- WordPressAuthenticator (9.0.9):
1212
- Gridicons (~> 1.0)
1313
- "NSURL+IDN (= 0.4)"
1414
- SVProgressHUD (~> 2.2.5)
@@ -67,7 +67,7 @@ SPEC CHECKSUMS:
6767
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
6868
SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211
6969
UIDeviceIdentifier: 442b65b4ff1832d4ca9c2a157815cb29ad981b17
70-
WordPressAuthenticator: f396f27104420ef617ffdc73dc76fab169508867
70+
WordPressAuthenticator: f8dcccf4661255208fb54e5558b5175e1f5bdda9
7171
WordPressKit: a71cc550f4b525ab5eef057984c8de071462edd5
7272
WordPressShared: 87f3ee89b0a3e83106106f13a8b71605fb8eb6d2
7373
WordPressUI: a491454affda3b0fb812812e637dc5e8f8f6bd06

WordPressAuthenticator.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Pod::Spec.new do |s|
44
s.name = 'WordPressAuthenticator'
5-
s.version = '9.0.8'
5+
s.version = '9.0.9'
66

77
s.summary = 'WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps.'
88
s.description = <<-DESC

WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public enum SignInError: Error {
4343
class 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
}

WordPressAuthenticator/Unified Auth/View Related/Site Address/SiteAddressViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ private extension SiteAddressViewController {
584584
}
585585

586586
guard siteInfo?.isWPCom == false else {
587-
showGetStarted()
587+
showGetStarted(forWPComSite: true)
588588
return
589589
}
590590

@@ -600,7 +600,7 @@ private extension SiteAddressViewController {
600600

601601
self.showWPUsernamePassword()
602602
case .presentEmailController:
603-
self.showGetStarted()
603+
self.showGetStarted(forWPComSite: false)
604604
case let .injectViewController(customUI):
605605
self.pushCustomUI(customUI)
606606
}
@@ -651,16 +651,16 @@ private extension SiteAddressViewController {
651651

652652
/// If the site is WordPressDotCom, redirect to WP login.
653653
///
654-
func showGetStarted() {
654+
func showGetStarted(forWPComSite: Bool) {
655655
guard let vc = GetStartedViewController.instantiate(from: .getStarted) else {
656656
WPAuthenticatorLogError("Failed to navigate from SiteAddressViewController to GetStartedViewController")
657657
return
658658
}
659659
vc.source = .wpComSiteAddress
660-
661660
vc.loginFields = loginFields
662661
vc.dismissBlock = dismissBlock
663662
vc.errorToPresent = errorToPresent
663+
vc.wpcomSiteAddressDetected = forWPComSite
664664

665665
navigationController?.pushViewController(vc, animated: true)
666666
}

0 commit comments

Comments
 (0)