-
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-262] Remember this card added to mutation #856
Conversation
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 noticed during testing that by making the reusable
field default to false
, it seems to have broken adding a new card from settings, because although adding the card succeeds, the card isn't shown in the list of stored cards.
I also noticed while looking at the checked out code that the AddNewCardViewControllerDelegate
seems to have two functions that are basically the same:
func addNewCardViewController(
_ viewController: AddNewCardViewController,
didSucceedWithMessage message: String
)
func addNewCardViewController(
_ viewController: AddNewCardViewController,
_ newCard: GraphUserCreditCard.CreditCard
)
Both of these seem to trigger when a new card is added, would it make sense to just combine them into one delegate function?
|
||
// MARK: - Functions | ||
|
||
private func createPaymentSourceInput( |
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've been putting these helper functions into their own files as CreatePaymentSourceInput+Constructor
- that way they can be tested separately.
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 cool, thanks!
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! Just one small suggestion.
} | ||
|
||
self.newCardAddedWithMessage = addNewCardEvent | ||
.map { $0.value?.paymentSource } |
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.
You could also use values()
which does the same thing as you're doing here (grabbing the value and doing skipNil()
):
addNewCardEvent
.values()
.map { $0.paymentSource }
.map { card in (card, Strings.Got_it) }
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.
Hmm, yeah seems it was that way, I just moved it around a little.
Thanks have updated!
📲 What
reusable
boolean toCreatePaymentSourceInput
so that the payment source can be stored for reuse.🤔 Why
🛠 How
reusable
boolean to theCreatePaymentSourceInput
mutation.✅ Acceptance criteria
With native pledge view enabled, Tap on add new card from
PledgeViewController
.reusable: false
.reusable: true
.