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

Commit f219e8e

Browse files
committed
Remove address-based option in wpcom social errors
1 parent 38ffbba commit f219e8e

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

WordPressAuthenticator/Signin/LoginEmailViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ class LoginEmailViewController: LoginViewController, NUXKeyboardResponder {
386386
let socialErrorVC = LoginSocialErrorViewController(title: errorTitle, description: errorDescription)
387387
let socialErrorNav = LoginNavigationController(rootViewController: socialErrorVC)
388388
socialErrorVC.delegate = self
389+
socialErrorVC.loginFields = loginFields
389390
present(socialErrorNav, animated: true) {}
390391
} else {
391392
errorToPresent = error

WordPressAuthenticator/Signin/LoginSocialErrorViewController.swift

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class LoginSocialErrorViewController: NUXTableViewController {
2929
case tryEmail = 0
3030
case tryAddress = 1
3131
case signup = 2
32+
33+
static var count: Int {
34+
return signup.rawValue + 1
35+
}
3236
}
3337

3438
/// Create and instance of LoginSocialErrorViewController
@@ -67,7 +71,11 @@ class LoginSocialErrorViewController: NUXTableViewController {
6771
case Buttons.tryEmail.rawValue:
6872
delegate.retryWithEmail()
6973
case Buttons.tryAddress.rawValue:
70-
delegate.retryWithAddress()
74+
if loginFields.restrictToWPCom {
75+
fallthrough
76+
} else {
77+
delegate.retryWithAddress()
78+
}
7179
case Buttons.signup.rawValue:
7280
fallthrough
7381
default:
@@ -98,8 +106,8 @@ extension LoginSocialErrorViewController {
98106
// MARK: UITableViewDataSource methods
99107

100108
extension LoginSocialErrorViewController {
101-
private struct Constants {
102-
static let buttonCount = 3
109+
private func numberOfButtonsToShow() -> Int {
110+
return loginFields.restrictToWPCom ? Buttons.count - 1 : Buttons.count
103111
}
104112

105113
override func numberOfSections(in tableView: UITableView) -> Int {
@@ -111,7 +119,7 @@ extension LoginSocialErrorViewController {
111119
case Sections.titleAndDescription.rawValue:
112120
return 1
113121
case Sections.buttons.rawValue:
114-
return Constants.buttonCount
122+
return numberOfButtonsToShow()
115123
default:
116124
return 0
117125
}
@@ -153,8 +161,12 @@ extension LoginSocialErrorViewController {
153161
buttonText = NSLocalizedString("Try with another email", comment: "When social login fails, this button offers to let the user try again with a differen email address")
154162
buttonIcon = Gridicon.iconOfType(.undo)
155163
case Buttons.tryAddress.rawValue:
156-
buttonText = NSLocalizedString("Try with the site address", comment: "When social login fails, this button offers to let them try tp login using a URL")
157-
buttonIcon = Gridicon.iconOfType(.domains)
164+
if loginFields.restrictToWPCom {
165+
fallthrough
166+
} else {
167+
buttonText = NSLocalizedString("Try with the site address", comment: "When social login fails, this button offers to let them try tp login using a URL")
168+
buttonIcon = Gridicon.iconOfType(.domains)
169+
}
158170
case Buttons.signup.rawValue:
159171
fallthrough
160172
default:

0 commit comments

Comments
 (0)