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-205] Manage pledge reward section #868

Merged
merged 25 commits into from
Oct 9, 2019
Merged

Conversation

Scollaco
Copy link
Contributor

@Scollaco Scollaco commented Oct 3, 2019

📲 What

  • Adds the backed reward to the ManagePledge screen

🤔 Why

  • To allow users to see which reward they chose.

🛠 How

  • By creating a ManagePledgeRewardView containing basically the RewardCardView and a title label.
  • The RewardCardView now needs RewardCardViewContext to be configured properly, since little UI changes will occur depending if the reward is being seen from the Rewards Carousel or from the ManagePledgeViewController
  • Now that ManagePledgeViewController contains all the sections, snapshots were added

Note:

The No Reward title wasn't updated. This will be made in a small PR (coming soon) to avoid this PR to get too big.

👀 See

Trello, screenshots, external resources?

Default 🐛 Dynamic Type 🦋
Simulator Screen Shot - iPhone 8 - 2019-10-03 at 11 04 47 Simulator Screen Shot - iPhone 8 - 2019-10-03 at 11 05 06

♿️ Accessibility

  • Works with VoiceOver
  • Supports Dynamic Type

✅ Acceptance criteria

  • The backed reward should be shown on the ManagePledge screen below Payment Methods section.
  • The section title label should show Selected reward

@ksr-ci-bot
Copy link

ksr-ci-bot commented Oct 3, 2019

1 Warning
⚠️ Big PR

SwiftFormat found issues:

File Rules
Kickstarter-iOS/Views/RewardCardView.swift indent

Generated by 🚫 Danger

@Scollaco Scollaco mentioned this pull request Oct 3, 2019
2 tasks
@@ -26,16 +24,51 @@ final class ManagePledgeViewController: UIViewController {
)
}()

private lazy var pledgeSummaryView: ManagePledgeSummaryView = { ManagePledgeSummaryView(frame: .zero) }()
private lazy var navigationBarShadowImage: UIImage? = {
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to be referenced anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(@justinswart ) This should be remove it since it's not being used. (Let's use a holistic approach to make the codebase consistent)

@@ -277,11 +275,14 @@ public final class RewardCardView: UIView {
self.setNeedsLayout()
}

fileprivate func load(items: [String]) {
fileprivate func load(items: ([String], UIColor)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we name the tuple values here like fileprivate func load(items: (includedItems: [String], separatorBackgroundColo: UIColor)) {, and then below refer to like items.includedItems and items.separatorBackgroundColor?

@@ -4329,7 +4329,7 @@
};
};
buildConfigurationList = A7E06C741C5A6EB300EBDCC2 /* Build configuration list for PBXProject "Kickstarter" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 10.0";
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm what dis?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we revert this line just because it seems unrelated?

@@ -107,6 +123,14 @@ public final class RewardCardViewModel: RewardCardViewModelType, RewardCardViewM
: rewardsItem.item.name
}
}
.combineLatest(with: context)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah cool, I don't use .combineLatest(with:) often enough 🤔

// MARK: - Configuration

public func configure(with value: (Project, Either<Reward, Backing>), context: RewardCardViewContext) {
self.rewardView.configure(with: value, context: context)
Copy link
Contributor Author

@Scollaco Scollaco Oct 7, 2019

Choose a reason for hiding this comment

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

(@justinswart )This view can pass the context itself

@@ -119,7 +168,9 @@ final class ManagePledgeViewController: UIViewController {

self.viewModel.outputs.configureRewardSummaryView
.observeForUI()
.observeValues { _ in }
.observeValues { [weak self] in
self?.rewardView.configure(with: $0, context: .pledgeView)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(@justinswart ) We don't need to pass the context here either

@@ -38,7 +38,7 @@ public final class RewardCardView: UIView {
sectionInset: UIEdgeInsets(topBottom: Styles.grid(1))
)
)
|> \.backgroundColor .~ UIColor.white
|> \.backgroundColor .~ self.backgroundColor
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(@justinswart ) Let's move this line to bindStyles()

@@ -99,6 +111,10 @@ public final class RewardCardViewModel: RewardCardViewModelType, RewardCardViewM

self.includedItemsStackViewHidden = rewardItemsIsEmpty.skipRepeats()

let context = self.projectAndRewardOrBackingProperty.signal
.skipNil()
.map { $0.2 }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(@justinswart ) We can use .map(third) here

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.

I think this is looking good to go, one thing I'd like to just try to reverting the snapshots and trying to test against them again, I'm still not understanding why it's recorded new ones because there shouldn't be any change. Maybe the snapshot diff could tell us?

@@ -4329,7 +4329,7 @@
};
};
buildConfigurationList = A7E06C741C5A6EB300EBDCC2 /* Build configuration list for PBXProject "Kickstarter" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 10.0";
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we revert this line just because it seems unrelated?

@dusi
Copy link
Contributor

dusi commented Oct 8, 2019

By accident I've noticed this weirdness...any idea what's going on in there?? 🤔

Screen Shot 2019-10-08 at 10 25 26 AM

@@ -160,6 +159,7 @@ public final class RewardCardView: UIView {
self.pillCollectionView.rac.hidden = self.viewModel.outputs.pillCollectionViewHidden
self.rewardTitleLabel.rac.hidden = self.viewModel.outputs.rewardTitleLabelHidden
self.rewardTitleLabel.rac.text = self.viewModel.outputs.rewardTitleLabelText
self.includedItemsTitleLabel.rac.textColor = self.viewModel.outputs.sectionTitleLabelTextColor
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noticed here that the output name doesn't match the element that's being set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

@Scollaco Scollaco force-pushed the manage-pledge-reward-section branch from 31ca55d to 69b1e7b Compare October 8, 2019 18:40
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.

Cool I think this is gtg. Could you merge master and also maybe delete these old screenshots? Looks like they were recorded with a spelling mistake and then not removed after it was fixed:

image

@Scollaco Scollaco merged commit c1a2d59 into master Oct 9, 2019
@Scollaco Scollaco deleted the manage-pledge-reward-section branch October 9, 2019 18:17
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

4 participants