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-558][NT-508][NT-532] Indicate Backing state on Manage Pledge View #934

Merged
merged 25 commits into from
Nov 12, 2019

Conversation

justinswart
Copy link
Contributor

@justinswart justinswart commented Nov 7, 2019

📲 What

Adds text describing the Backing's state to ManagePledgeViewController.

🤔 Why

This provides some additional context to our backers that may be useful for them when viewing their pledge in the app.

🛠 How

  • Added strings for each state.
  • Added tests.
  • Repurposes attributedConfirmationString from PledgeViewModel to be a bit more reusable.
  • Updated snapshots for this view.
    • Didn't record new snapshots for each state as I feel the view model tests are covering this.

Note: Once we are sure that we have the final copy for all of the strings I will add them for translation and rebuild the strings.

👀 See

Before 🐛 After 🦋
image image

♿️ Accessibility

  • Works with VoiceOver
  • Supports Dynamic Type

🏎 Performance

  • Optimized Blended Layers (screenshots)

✅ Acceptance criteria

Note: It may be easiest to test by manipulating the JSON response using breakpoints with Charles proxy.

For both backer and creator:

  • Back a project, navigate to Manage Pledge. The copy that you see for each state should match the JIRA ticket.
  • Note that if a project has a canceled or failed state, we show different copy also noted on the ticket.

⏰ TODO

  • Add strings for translation.

@ksr-ci-bot
Copy link

ksr-ci-bot commented Nov 7, 2019

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@justinswart
Copy link
Contributor Author

Apologies, this PR got a lot bigger than initially intended.

@justinswart justinswart changed the title [NT-508] Indicate Backing state on Manage Pledge View [NT-508][NT-532] Indicate Backing state on Manage Pledge View Nov 7, 2019
@justinswart justinswart assigned Scollaco and unassigned cdolm92 Nov 8, 2019
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.

Paired with @justinswart on this PR and it looks good. I would just wait for the Strings to be deployed before merging it.

@@ -12,6 +12,10 @@ final class ManagePledgeSummaryViewController: UIViewController {
private lazy var backerNumberLabel: UILabel = { UILabel(frame: .zero) }()
private lazy var backingDateLabel: UILabel = { UILabel(frame: .zero) }()

private lazy var pledgeStatusLabelViewController: PledgeStatusLabelViewController = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why did you opt for using a VC here instead of a UIView? 🤔

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 just had a good feeling about it 😄

NSAttributedString.Key.paragraphStyle: paragraphStyle
]

if project.stats.currentCurrency == project.stats.currency {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could use if project.stats.needsConversion here instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or rather if !project.stats.needsConversion, though maybe it would make more sense to use a guard:

guard project.stats.needsConversion else { 
  return Strings.If_the_project_reaches_its_funding_goal_you_will_be_charged_on_project_deadline(
      project_deadline: date
    )
    .attributed(with: font, foregroundColor: foregroundColor, attributes: attributes, bolding: [date])
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh cool thanks!

|> Backing.lens.status .~ $0
)

self.vm.inputs.configure(with: project)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to call self.vm.inputs.viewDidLoad() somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😬 😬

attributedString.addAttributes(regularFontAttribute, range: fullRange)
attributedString.addAttributes(boldFontAttribute, range: rangePledgeTotal)
attributedString.addAttributes(boldFontAttribute, range: rangeProjectDeadline)
if project.stats.currentCurrency == project.stats.currency {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here too we could use project.stats.needsConversion

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 change seemed to break snapshots. Will dig in more tomorrow.

# Conflicts:
#	Kickstarter-iOS/Views/Controllers/ManagePledgeSummaryViewController.swift
#	Library/ViewModels/ManagePledgeSummaryViewModel.swift
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_GooglePay_lang_en_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_NoReward_ApplePay_lang_en_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_de_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_de_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_en_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_en_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_es_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_es_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_fr_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_fr_device_phone4_7inch@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_ja_device_pad@2x.png
#	Screenshots/_64/Kickstarter_Framework_iOSTests.ManagePledgeViewControllerTests/testView_lang_ja_device_phone4_7inch@2x.png
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.

I only left a couple of suggestions, but none are blockers.

self.labelText = project.map(statusLabelText(with:)).skipNil()
}

private let configureWithProjectStatusProperty = MutableProperty<Project?>(nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe configureWithProjectProperty here could be more appropriated, since we're getting not only the project's state, but the whole project?

@justinswart justinswart changed the title [NT-508][NT-532] Indicate Backing state on Manage Pledge View [NT-558][NT-508][NT-532] Indicate Backing state on Manage Pledge View Nov 12, 2019
@justinswart justinswart merged commit eccc8dc into master Nov 12, 2019
@justinswart justinswart deleted the manage-pledge-backing-state-string branch November 12, 2019 21:45
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.

5 participants