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-515] Rewards Carousel Creator View #925

Merged
merged 4 commits into from
Nov 4, 2019
Merged

Conversation

justinswart
Copy link
Contributor

@justinswart justinswart commented Nov 1, 2019

πŸ“² What

This makes the necessary changes to the rewards carousel for when a creator might be viewing their own project.

πŸ€” Why

Currently they would see their own rewards as a normal backer but things would fail when they tried to pledge against their own project. Instead we're showing them a read only state of their rewards to improve this experience.

πŸ›  How

  • Added a shared function func currentUserIsCreator(of project: Project) -> Bool for determining whether the current user is a creator of a particular project.
  • Added tests for this shared function.
  • Updated RewardCardContainerViewModel to hide the Select button when a creator is viewing the rewards.
  • Updated RewardsCollectionViewModel to return a title of View your rewards for the view when a creator is viewing it.

πŸ‘€ See

Before πŸ› After πŸ¦‹
testLive_NonBackedProject_LoggedIn_AvailableShippingEnabledReward_lang_en_device_phone4_7inch@2x testLive_IsCreator_AvailableShippingEnabledReward_lang_en_device_phone4_7inch@2x

βœ… Acceptance criteria

Create a project using your user on staging.

  • Log in as your user and navigate to your projects rewards, you should not see any Select button on any reward cards.
  • The title of the view should read "View your rewards".
  • Log in as any other user, repeat the above, you should see a Select button and the normal backer experience.
  • The title of the view should be that of the context that you're in (pledging/managing).

⏰ TODO

  • Add string for translation

Copy link
Contributor

@ifbarrera ifbarrera left a comment

Choose a reason for hiding this comment

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

Small suggestion but lgtm!

@@ -115,6 +115,8 @@ private func backingReward(fromProject project: Project) -> Reward? {
}

private func pledgeButtonTitle(project: Project, reward: Reward) -> String? {
guard !currentUserIsCreator(of: project) else { return nil }
Copy link
Contributor

Choose a reason for hiding this comment

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

I often find that using guards when the condition is negated is a little counter intuitive. Should we consider using if?:

if currentUserIsCreator(of: project) { return nil }

self.pledgeButtonTitleText.assertValueCount(self.allRewards.count)

self.gradientViewHidden.assertValues([false, false, false, false, false, false, false, false])
self.pledgeButtonStyleType.assertValues([.green, .green, .green, .green, .green, .green, .green, .green])

Choose a reason for hiding this comment

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

🚫 Line should be 110 characters or less: currently 111 characters
line_length RewardCardContainerViewModelTests.swift:206

@ksr-ci-bot
Copy link

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@justinswart justinswart merged commit 4fc6d69 into master Nov 4, 2019
@justinswart justinswart deleted the view-your-rewards branch November 4, 2019 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants