-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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-204] Manage pledge payment method section #851
Conversation
…ewPledgeViewController
….com/kickstarter/ios-oss into manage-pledge-payment-method-section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a first pass...mostly looking good..couple suggestions plus some weirdness around a11y bellow
VoiceOver
I wasn't able to focus on any of the textual fields in the payments section using VoiceOver.
Dynamic Type
Looks like the title of the section does not allow multiple lines and therefore on smaller devices it gets trimmed (see the screenshot)
@@ -102,6 +102,8 @@ final class PledgeCreditCardView: UIView { | |||
|> checkoutCardStackViewStyle | |||
} | |||
|
|||
// MARK: - View model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also add // MARK: - Configuration
??
private lazy var rootStackView: UIStackView = { UIStackView(frame: .zero) }() | ||
private lazy var titleLabel: UILabel = { UILabel(frame: .zero) }() | ||
|
||
private let viewModel = CreditCardCellViewModel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've been inconsistent in this lately but shouldn't we define vm
as CreditCardCellViewModelTypebefore we initialize it? This way we will be told by the compiler if we try to access any variables directly (skipping
inputs/
outputs`).
Could you maybe also add refactoring ticket in JIRA to do the same for all the other 17 occurrences of let viewModel =
where we let the compiler infer the type without being explicitly told so?
|
||
self.configureViews() | ||
self.setupConstraints() | ||
self.bindViewModel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any update on this @justinswart ? Thought we talked about swizzling some swizzlers to make this automatic :)
|
||
private func configureViews() { | ||
_ = self | ||
|> \.accessibilityElements .~ self.subviews |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we exclude the image view here?
|
||
self.expirationDateLabel.rac.text = self.viewModel.outputs.expirationDateText | ||
self.lastFourLabel.rac.text = self.viewModel.outputs.cardNumberTextShortStyle | ||
self.viewModel.outputs.cardImage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add empty line here to separate rac
and output
signals?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a second thought, would it be worth it adding reactive extension on the UIImageView
to being able to bind image
property? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea. I can create a ticket for that to be done in a different PR.
|> checkoutTitleLabelStyle | ||
|> \.font .~ UIFont.ksr_caption1().bolded | ||
|> \.adjustsFontForContentSizeCategory .~ true | ||
|> \.textColor .~ .ksr_text_dark_grey_500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be explicit when defining styles and use full types? UIColor.
this helps the compiler with the type inference and prevents from potential type-check warnings. This has been something we've mostly seen with styles so this should only be done when dealing with styles. We can be more on ease for other operations.
|> \.textColor .~ .ksr_text_dark_grey_500 | ||
} | ||
|
||
private let cardLabelsStackViewStyle: StackViewStyle = { stackView in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we simply use verticalStackViewStyle
without defining a wrapper style?
|> \.textColor .~ UIColor.black | ||
|> \.font .~ UIFont.ksr_subhead().bolded | ||
|> \.adjustsFontForContentSizeCategory .~ true | ||
|> \.text %~ { _ in Strings.Payment_method() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll also need to use numberOfLines .~ 0
here to prevent from trimming the title
@@ -114,7 +109,9 @@ final class ManageViewPledgeViewController: UIViewController { | |||
|
|||
self.viewModel.outputs.configurePaymentMethodView | |||
.observeForUI() | |||
.observeValues { _ in } | |||
.observeValues { [weak self] in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name the closure variable for better readability? To better describe $0
in this case. Feel like we've been pretty consistent about that everywhere else.
@@ -77,7 +79,7 @@ public final class ManageViewPledgeViewModel: | |||
self.viewDidLoadObserver.send(value: ()) | |||
} | |||
|
|||
public let configurePaymentMethodView: Signal<Project, Never> | |||
public let configurePaymentMethodView: Signal<GraphUserCreditCard.CreditCard, Never> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to my comment here #835 (comment)
Would communicate the change with Christella to prevent from merge conflicts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So was the typealias created yet? I think that creating it in this PR will add a ton of new diffs, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still noticed couple things we should address plus I'm not sure if this is caused by this PR (I could not seem to find any traces of what it would cause)...but I'm unable to display the blue Manage
CTA button when I go to live projects that I've backed...what's working on master
isn't working on this branch..any ideas?
I only see this ¯_(ツ)_/¯
label | ||
|> checkoutTitleLabelStyle | ||
|> \.font .~ UIFont.ksr_caption1().bolded | ||
|> \.adjustsFontForContentSizeCategory .~ true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate of checkoutTitleLabelStyle
|> \.adjustsFontForContentSizeCategory .~ true |
label | ||
|> checkoutTitleLabelStyle | ||
|> \.font .~ UIFont.ksr_subhead().bolded | ||
|> \.adjustsFontForContentSizeCategory .~ true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate of checkoutTitleLabelStyle
|> \.adjustsFontForContentSizeCategory .~ true |
let childViews: [UIView] = [ | ||
self.pledgeSummaryView, | ||
self.paymentMethodView, | ||
self.rewardReceivedViewController.view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add this not only to view hierarchy but to view-controller hierarchy as we do at other places (this is to ensure proper behavior fo the view-controller when being embedded in a parent VC.
self.addChild(viewController)
self.view.addSubview(viewController.view) // or using our functional helper
viewController.didMove(toParent: self)
private lazy var cardImageView: UIImageView = { UIImageView(frame: .zero) }() | ||
private lazy var cardLabelsStackView: UIStackView = { UIStackView(frame: .zero) }() | ||
private lazy var expirationDateLabel: UILabel = { UILabel(frame: .zero) }() | ||
private lazy var lastFourLabel: UILabel = { UILabel(frame: .zero) }() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lastFour
what? Should we be more explicit? Also the signal & the UI element do not match (not sure if this is again due to copy-pasting stuff around)?
|
||
private let cardExpirationDateLabelStyle: LabelStyle = { label in | ||
label | ||
|> checkoutTitleLabelStyle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Rename label and styles * Refactor styles * Add vc to parent properly * Flatten the style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📲 What
ManageViewPledgeViewController
Note
🤔 Why
Manage/View pledge screen
, to see which payment method was used to back a project.🛠 How
ManagePledgePaymentMethodView
classpaymentSource
to the Backing modelGraphUserCreditCard.CreditCard
aspaymentSource
property typeGraphUserCreditCard.CreditCard
conform toArgo.Decodable
. This was necessary in order to be able to reuseGraphUserCreditCard.CreditCard
as paymentSource👀 See
♿️ Accessibility
✅ Acceptance criteria
With Native Checkout Pledge View feature enabled: