-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[MBL-1328] Pledge Button Active/Inactive States #2019
Conversation
I'm not sure this solves the "double tap" issue that @amy-at-kickstarter found during QA. I couldn't reproduce that before or after this update. |
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 may not be understanding something about the flow here, with regards to editing existing backing - before I approve, can you clarify?
let checkoutId = initialData.map(\.checkoutId) | ||
let baseReward = initialData.map(\.rewards).map(\.first) | ||
let baseReward = initialData.map(\.rewards).map(\.first).skipNil() |
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 is the case where the first reward is nil
? I thought we always had at least one reward (i.e. the no-reward award.)
@@ -109,14 +110,40 @@ public class PostCampaignCheckoutViewModel: PostCampaignCheckoutViewModelType, | |||
.map { _ in AppEnvironment.current.currentUser } | |||
.map(isNotNil) | |||
|
|||
let notChangingPaymentMethod = context.map { context in | |||
context.isUpdating && context != .changePaymentMethod |
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 you change the payment method on a post-campaign pledge? I thought they were immutable.
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.
ah yes thank you!
.map(paymentMethodValid) | ||
) | ||
|
||
let isEnabled = Signal.merge( |
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.
Nit: This could have a more descriptive name like pledgeButtonEnabled
.
context: PledgeViewContext | ||
) -> Bool { | ||
guard | ||
let backedPaymentSourceId = project.personalization.backing?.paymentSource?.id, |
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.
Same question here, I thought these were immutable?
PledgeViewCTAContainerViewData( | ||
isLoggedIn: isLoggedIn, | ||
isEnabled: true, // Pledge button never needs to be disabled on checkout page. |
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.
Well that's a convenient comment 😆
context.isUpdating, | ||
userIsBacking(reward: reward, inProject: project) | ||
else { | ||
return 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.
Won't this always return true if you haven't backed this project already?
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. yeah I guess that it true. I keep forgetting we won't be updating late pledges
} | ||
.filter(isTrue) | ||
|
||
let paymentMethodSelected = self.creditCardSelectedProperty.signal.skipNil() |
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.
Nit: Since this gets passed into the CTA to indicate whether or not it is enabled, does the CTA disable ApplePay as well? Technically we could still run an ApplePay transaction before the payment method is selected (since in that case, you select a card via the ApplePay dialog), but I also don't think that's a big deal.
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 set this up so that it doesn't impact apple pay for this reason. Which, is what we want here.
@@ -110,40 +110,23 @@ public class PostCampaignCheckoutViewModel: PostCampaignCheckoutViewModelType, | |||
.map { _ in AppEnvironment.current.currentUser } | |||
.map(isNotNil) | |||
|
|||
let notChangingPaymentMethod = context.map { context 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.
One thing you could potentially do is throw in an assert like assert(!context.isUpdating)
to document that it's unexpected behavior (for now).
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.
LGTM! Two small nits/suggestions.
paymentMethodChangedAndValid | ||
let pledgeButtonEnabled = Signal.merge( | ||
self.viewDidLoadProperty.signal.mapConst(false), | ||
shouldEnablePledgeButton |
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.
Nit: Is it possible for the credit card information to load before viewDidLoad
? Or is the credit card server request itself triggered by viewDidLoad
?
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.
Yes its tied to viewDidLoad so it's not possible 👍
📲 What
Sets the "Pledge" Button's enabled based on whether a payment method is currently selected and valid
🤔 Why
If no payment method has been added or selected, users shouldn't be able to pledge.
🛠 How
Following our existing flow, use the project, reward, selected payment source, and pledge context to validate the newly selected payment method
👀 See
Trello, screenshots, external resources?
| Before 🐛 | After 🦋 |
|
|
| No Saved Cards | Saved Cards |
|
✅ Acceptance criteria