Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NT-534] Show User Name and Avatar on the Manage Pledge screen #938

Merged
merged 13 commits into from
Nov 12, 2019

Conversation

ifbarrera
Copy link
Contributor

📲 What

This PR adds the user's avatar and name on the manage pledge screen if the current user is the backer of that project.

Also adds a placeholder image for remote avatar URL loading so the transition is more subtle.

🤔 Why

More visual context on the manage pledge screen.

🛠 How

We check whether the current user is the backer of the project, and if they are, we show their avatar and name on the Manage/View pledge screen. If the current user is not the backer of the project, we hide the avatar and name labels.

👀 See

Trello, screenshots, external resources?

Current User Is Backer Current User is Not Backer
Simulator Screen Shot - iPhone 8 - 2019-11-08 at 13 18 09 Simulator Screen Shot - iPhone 8 - 2019-11-08 at 16 29 25

♿️ Accessibility

  • Tap targets use minimum of 44x44 pts dimensions
  • Works with VoiceOver
  • Supports Dynamic Type

🏎 Performance

  • Optimized Blended Layers

✅ Acceptance criteria

  • Navigate to the manage pledge screen on a backed project. You should see your avatar and your name.

@@ -10,7 +10,7 @@ private enum Layout {
}
}

protocol ProjectPamphletCreatorHeaderCellDelegate: class {
protocol ProjectPamphletCreatorHeaderCellDelegate: AnyObject {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was done by swiftformat, seems it was missed in a recent PR.

@@ -105,6 +105,11 @@ public let checkoutBackgroundStyle: ViewStyle = { (view: UIView) in
|> \.backgroundColor .~ UIColor.ksr_grey_300
}

public let checkoutLabelStyle: LabelStyle = { label in
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To prevent color blending on labels.

@ifbarrera ifbarrera assigned Scollaco and unassigned justinswart Nov 11, 2019
Copy link
Contributor

@justinswart justinswart left a comment

Choose a reason for hiding this comment

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

Excellent work! Works great, I just had one or two minor questions.

@@ -19,12 +19,17 @@ final class ManagePledgeViewControllerTests: TestCase {
super.tearDown()
}

func testView() {
func testView_CurrentUser_IsBacker() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this just future-proofing? As I understand it from our discussions the user will always be the backer? Which is why I removed the creator strings in #934 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah sort of - although there's currently no way to get to this state, the VM does support it so I created a screenshot so we can verify that it visually matches what we expect.

.map(\.name)

self.backerImageURLAndPlaceholderImageName = userBackingProject
.map(\.avatar.small)
Copy link
Contributor

Choose a reason for hiding this comment

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

😮 🤯

Copy link
Contributor

@Scollaco Scollaco left a comment

Choose a reason for hiding this comment

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

Looking good, @ifbarrera . I left a few suggestions and comments, but nothing serious.

self.viewModel.outputs.backerImageURLAndPlaceholderImageName
.observeForUI()
.on(event: { [weak self] _ in
self?.circleAvatarImageView.af_cancelImageRequest()
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we need to cancel the image request (and set image to nil) here. I this this is usually done on Cells, where the imageViews will be recycled due scrolling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm is it possible that the user could navigate away from the VC before the request has completed, and then navigates back to it? I figure it doesn't hurt 🤔

@@ -41,11 +46,42 @@ final class ManagePledgeViewControllerTests: TestCase {
}
}

func testView_CurrentUser_IsNotBacker() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the name can cause confusion in the future, since only creators and backers will have access to this screen (and for now, we're not showing this screen to creators). So I think we could either delete it or maybe rename and update it to test view when user is creator of project?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's helpful to have this screenshot as a reference for how the view should look if the current user is not the backer 🤷‍♀

Library/ViewModels/ManagePledgeSummaryViewModel.swift Outdated Show resolved Hide resolved
Library/ViewModels/ManagePledgeSummaryViewModel.swift Outdated Show resolved Hide resolved
@ifbarrera ifbarrera merged commit 35213c4 into master Nov 12, 2019
@ifbarrera ifbarrera deleted the NT-534-user-name-and-avatar branch November 12, 2019 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants