-
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-303] Pledge Button #847
Conversation
|
||
@objc private func applePayButtonTapped() { | ||
self.viewModel.inputs.applePayButtonTapped() | ||
} | ||
|
||
func updatePledgeButton(_ enabled: Bool) { | ||
self.viewModel.inputs.updatePledgeButtonEnabled(isEnabled: enabled) |
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.
The real "brains" of the pledge button enabled state is actually the PledgeViewModel
. This is because we expect the pledge button's enabled state to be driven by a variety of factors: whether the reward minimum is met, whether a shipping location has been selected, etc. Since the PledgeViewModel
is the only source of truth for this information, it needs to be the one to drive the pledge button's enabled state.
@@ -53,6 +62,9 @@ public final class PledgePaymentMethodsViewModel: PledgePaymentMethodsViewModelT | |||
self.notifyDelegateLoadPaymentMethodsError = storedCardsEvent | |||
.errors() | |||
.map { $0.localizedDescription } | |||
|
|||
self.notifyDelegateCreditCardSelected = self.creditCardSelectedSignal |
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.
Right now this is very simple - has a credit card been selected? An upcoming PR will add the rest of the requirements for the pledge button being enabled: reward minimum is met, shipping rule selected, etc.
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.
Cool cool, I think important to just note that there is payment method selection stuff being done in this PR and in #835, so we would want to align on that.
Also, the spacing here seems quite tight?
And a final thought - should this button be in PledgePaymentMethodsViewController
or PledgeViewController
as its own nested VC? 🤔 😱
@@ -3,18 +3,25 @@ import Library | |||
import Prelude | |||
import UIKit | |||
|
|||
protocol PledgeCreditCardViewDelegate: AnyObject { | |||
func pledgeCreditCardViewSelected( |
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.
This might overlap with some of the work happening in #835.
private let expirationDateLabel: UILabel = { UILabel(frame: .zero) }() | ||
private let imageView: UIImageView = { UIImageView(frame: .zero) }() | ||
private let labelsStackView: UIStackView = { UIStackView(frame: .zero) }() | ||
private let lastFourLabel: UILabel = { UILabel(frame: .zero) }() | ||
private let rootStackView: UIStackView = { UIStackView(frame: .zero) }() | ||
private let selectButton: UIButton = { UIButton(type: .custom) }() | ||
private let viewModel: CreditCardCellViewModelType = 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.
I mentioned in #835 that we should probably rename this 😬
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.
Yeah I agree - I really don't think we should have used the same view model as the one in the Settings
screen at all 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.
Oh I had no idea it was being used in both places.
Kickstarter-iOS/Views/Controllers/PledgePaymentMethodsViewController.swift
Outdated
Show resolved
Hide resolved
|
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.
nice!
📲 What
Adds a
Pledge
button below the list of stored payment methods. This button is initially disabled until the user selects a credit card. Once a card is selected, the button becomes enabled.🤔 Why
To allow users to pledge, and to simplify the pledging experience.
🛠 How
Some things to keep in mind:
Select
on any of the cards will enable thePledge
button even though the card'sselected
state doesn't change. This is because toggling the card view'sselected
state is currently being worked on separately as part of another ticket👀 See
♿️ Accessibility
✅ Acceptance criteria
Native Pledge Screen
feature flag turned ON, navigate to any project and select any reward. Scroll down and you should see thePledge
button below the list of stored cards, and it should be disabled. TapSelect
on any of the stored cards - thePledge
button should become enabled.