Skip to content

Login: Social Error Screens - #7887

Merged
nheagy merged 15 commits into
developfrom
feature/7675-error-screens
Oct 11, 2017
Merged

Login: Social Error Screens#7887
nheagy merged 15 commits into
developfrom
feature/7675-error-screens

Conversation

@nheagy

@nheagy nheagy commented Oct 2, 2017

Copy link
Copy Markdown
Contributor

Refs #7675

Error display screen for when login to Google succeeds, but login using the token with WordPress.com subsequently fails.

simulator screen shot - iphone 8 - 2017-10-01 at 23 12 13

To test:

  • login to a Google account with an email that doesn't have a wpcom account
  • ensure error screen matches mockup

Note:

This is forked from #7872 and can't be merged until that PR is approved & merged.

Needs review: @aerych

@nheagy nheagy added the Login label Oct 2, 2017
@nheagy nheagy added this to the 8.6 milestone Oct 2, 2017
@nheagy nheagy self-assigned this Oct 2, 2017
@nheagy
nheagy requested a review from aerych October 2, 2017 05:14

// MARK: UITableViewDataSource methods

extension LoginSocialErrorViewController

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)

@nheagy
nheagy force-pushed the feature/7675-error-screens branch from 5d15084 to 0ec7017 Compare October 2, 2017 21:05
@aerych

aerych commented Oct 2, 2017

Copy link
Copy Markdown
Contributor

Heya @nheagy!
Two quick visual things I noticed and can share before getting too deep into the code review.

  • The nav bar is missing the W logo and the Help button.
  • The font color of the cell text is black. It should one of the dark grey shades judging from the comp. @folletto can say for sure but maybe darkGrey() to match text use elsewhere? https://cloudup.com/ilmApZlpV4i

@aerych aerych left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hiya Nate! Here are a few thoughts after peeking at the code and playing with the screen in the simulator. I had a couple of suggestions. Overall the code is very pretty. :) Nice yo!

configureViewLoading(false)
if awaitingGoogle {
let socialErrorVC = LoginSocialErrorViewController(title: NSLocalizedString("Unable To Connect", comment: "Shown when a user logs in with Google but it subsequently fails to work as login to WordPress.com"), description: error.localizedDescription)
navigationController?.setViewControllers([socialErrorVC], animated: true)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a good place to set awaitingGoogle back to false?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tho I expect this VC will get dealloced because the navigation controller is about to release it.

let socialErrorVC = LoginSocialErrorViewController(title: NSLocalizedString("Unable To Connect", comment: "Shown when a user logs in with Google but it subsequently fails to work as login to WordPress.com"), description: error.localizedDescription)
navigationController?.setViewControllers([socialErrorVC], animated: true)
} else {
configureViewLoading(false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we still set configureViewLoading(false) regardless of the value of awaitingGoogle?

@nheagy nheagy Oct 3, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably. Same thinking as above—currently this method destroys the current VC so ¯\(ツ)

But I can see that a future refactoring may miss the need to make these changes, so perhaps they make sense regardless 😀

descriptionLabel.font = WPStyleGuide.mediumWeightFont(forStyle: .subheadline)
descriptionLabel.textColor = WPStyleGuide.darkGrey()
descriptionLabel.numberOfLines = 0
descriptionLabel.heightAnchor.constraint(greaterThanOrEqualToConstant: 14.0).isActive = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this constant be a ... constant?

import Foundation
import Gridicons

class LoginSocialErrorViewController: UITableViewController {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might have been a good candidate for ImmuTable. Just FYI. No need to refactor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. Hadn't even crossed my mind.


let storyboard = UIStoryboard(name: "Login", bundle: nil)
if let controller = storyboard.instantiateViewController(withIdentifier: controllerKey) as? NUXAbstractViewController {
navigationController?.setViewControllers([controller], animated: true)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this. Summoning @folletto.
When I first tapped the email option to retry another view controller appeared to be pushed onto the stack. My expectation, since the error screen was pushed onto the nav stack, was that I'd go back a screen. But then there's no back button so that's a bit odd.
When I tried the option to sign up I was trapped with no way to get back to the login flow.
This is similar for the site address screen... there is no way to return to the email screen.

Given the scenarios above I think it would make sense to present the error screen as a modal and maybe let the presenting controller decide what action to take via a delegate method. Thoughts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, I could see model presentation + delegate as a nice UX.

I did it this way because of the navigation bar being part of these screens. I'd also like to hear @folletto's take 😀

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I need to ask a screenshot of the 2+ screens you're discussing about. It's a bit too theoretical in writing :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@folletto here's a demonstration: http://d.pr/v/bX1dEZ

Producing that video made it clear that @aerych has a point. A bit of direction on how best to alter it please 😀

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "← Back" action should be present there, behaving exactly like the user just opened that screen in a normal flow of actions, which means that the "Back":

  • On the site address screen, it should go back to the email screen (where normally the user would select to enter site address).
  • On the email screen, it should go back to the intro screen.

This is because these actions there act as "shortcuts" into a specific part of the flow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "← Back" action should be present there, behaving exactly like the user just opened that screen in a normal flow of actions

I have concerns about this. In the video example Nate shared new screens are sliding in from the right and the error screen is transitioned away by sliding to the left... a typical navigation experience. This implies that tapping back will take the user to the error screen, but if I understand correctly, we're suggesting that we break this expectation. So the experience would be the error screen slides in, the user taps an option on the error screen, a new screen slides in. The user taps the back button... but rather than seeing the error screen they see something different. I expect this would be confusing.

I think it would be better for the error screen presented modally so it slides up from the bottom of the screen and dismisses by sliding down. This removes any expectation that it is something the user would see by tapping a back button.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep — the sliding motion should be different too with this model.

If we want to do it modal we need to go back to the design and rework both iOS and Android at this point.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught up with @folletto in chat. To summarize ... we're talking about the same thing but speaking in different terms. :D So let's go ahead and present the error screen "modally" (such an ambiguous term), full screen, sliding up from the bottom, etc. so we avoid any weirdness with user expectations and the back button. :)

// MARK: UITableViewDelegate methods

extension LoginSocialErrorViewController {
override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method isn't needed when setting tableView.estimatedRowHeight

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah damn, right.


tableView.estimatedRowHeight = 100.0

view.backgroundColor = WPStyleGuide.greyLighten30()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like these properties would be better set on viewDidLoad since its work that should only need to be done once.

}

override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method can be removed if tableView:viewForFooterInSection: returns UIView(frame: .zero). Seems that way when I test. Same for setting the footer.backgroundColor

@nheagy nheagy Oct 3, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This draws the dark line above and below the button cells.

The initial frame size of .zero will be ignored/modified by autolayout.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally missed that there were lines in the mock. Totally makes sense now. :)

The initial frame size of .zero will be ignored/modified by autolayout

This hasn't been my experience, but whatev 🤷‍♂️

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually just do UIView() not sure why I decided to use UIView(frame: .zero) here 😜 I'll probably switch it to the former, to make the result more clear.

@aerych

aerych commented Oct 2, 2017

Copy link
Copy Markdown
Contributor

Something I've been thinking about is how to best share some of our existing screens, like 2fa and the wpcom password screen, while performing a google login flow.
One idea is to add a new flag to LoginFields but its starting to be a bit of a dumping ground for state and its not good to keep piling on. Its something we need to sort for the 2fa and password flows and probably would include the use of awaitingGoogle in this PR. Not something that needs to be solved for this PR, but if you have ideas I'm all ears.

@nheagy

nheagy commented Oct 3, 2017

Copy link
Copy Markdown
Contributor Author

I agree that we need a way to maintain state between all the login screens. And I agree that LoginFields isn't designed to hold a variety of data elegantly, but I think it could possibly be refactored to do so? I'd like to give that a short first, at least.

@nheagy

nheagy commented Oct 4, 2017

Copy link
Copy Markdown
Contributor Author

Good call on the button text color. The mockup is darker than the handbook's Gray Dark/darkGrey (#2e4453)—I sampled it as #163B4C, which is still definitely not black 😉 I switched it to darkGrey, hoping @folletto can say if that's ok.

@aerych

aerych commented Oct 5, 2017

Copy link
Copy Markdown
Contributor

Good call on the button text color

Did you mean the cell text color? Not sure we're talking about the same thing? Fwiw, Digital Color Meter shows it as #000000, even in the screen shot above.:
screen shot 2017-10-04 at 8 05 34 pm

@nheagy

nheagy commented Oct 5, 2017

Copy link
Copy Markdown
Contributor Author

@aerych I know the PR has the text as black. I’m referring to the color used in the mockups - it is darker than our darkGrey.

@aerych

aerych commented Oct 5, 2017

Copy link
Copy Markdown
Contributor

Ahh. Gotcha! 👍

@folletto

folletto commented Oct 5, 2017

Copy link
Copy Markdown

Ah thanks for that review of text color. As a general rule of thumb:

  1. We don't use black most of the time — if it's black it's likely an oversight and should be darkGrey
  2. If the color looks outside the color palette, it's likely an artifact, as with some exceptions we tend to stick to the palette.

@nheagy

nheagy commented Oct 6, 2017

Copy link
Copy Markdown
Contributor Author

Ok, @aerych this should be good for review #2!

@aerych aerych left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heya @nheagy. Changes look great and the interaction with the modal feels soooo much better. :shipit: after resolving the conflicts :)

let imageView = UIImageView(image: image.imageWithTintColor(UIColor.white))
navigationItem.titleView = imageView
}
func addHelpButtonToNavController() -> (UIButton, WPNUXHelpBadgeLabel) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice tupile usage :)

import Gridicons

class LoginViewController: NUXAbstractViewController {
protocol LoginWithLogoAndHelpViewController {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor :)

@elibud elibud modified the milestones: 8.6, 8.7 Oct 9, 2017
@nheagy
nheagy merged commit f551b01 into develop Oct 11, 2017
@nheagy
nheagy deleted the feature/7675-error-screens branch October 11, 2017 18:00
@nheagy nheagy mentioned this pull request Oct 13, 2017
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants