| Index: ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm
|
| diff --git a/ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm b/ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm
|
| index 89f7e4aa8c61919866577228a83ced3c780800b7..84412481cba6bb27bc1a1bfa37cbde1c2d5f4165 100644
|
| --- a/ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm
|
| +++ b/ios/chrome/browser/ui/payments/payment_method_selection_coordinator.mm
|
| @@ -80,7 +80,7 @@ const int64_t kDelegateNotificationDelayInNanoSeconds = 0.2 * NSEC_PER_SEC;
|
|
|
| #pragma mark - PaymentRequestSelectorViewControllerDelegate
|
|
|
| -- (void)paymentRequestSelectorViewController:
|
| +- (BOOL)paymentRequestSelectorViewController:
|
| (PaymentRequestSelectorViewController*)controller
|
| didSelectItemAtIndex:(NSUInteger)index {
|
| DCHECK(index < self.paymentRequest->credit_cards().size());
|
| @@ -94,8 +94,10 @@ const int64_t kDelegateNotificationDelayInNanoSeconds = 0.2 * NSEC_PER_SEC;
|
| // Update the data source with the selection.
|
| self.mediator.selectedItemIndex = index;
|
| [self delayedNotifyDelegateOfSelection:creditCard];
|
| + return YES;
|
| } else {
|
| [self startCreditCardEditCoordinatorWithCreditCard:creditCard];
|
| + return NO;
|
| }
|
| }
|
|
|
| @@ -131,13 +133,19 @@ const int64_t kDelegateNotificationDelayInNanoSeconds = 0.2 * NSEC_PER_SEC;
|
| // Update the data source with the new data.
|
| [self.mediator loadItems];
|
|
|
| + const std::vector<autofill::CreditCard*>& creditCards =
|
| + self.paymentRequest->credit_cards();
|
| + auto position = std::find(creditCards.begin(), creditCards.end(), creditCard);
|
| + DCHECK(position != creditCards.end());
|
| +
|
| + // Mark the edited item as complete meaning all required information has been
|
| + // filled out.
|
| + CollectionViewItem<PaymentsIsSelectable>* editedItem =
|
| + self.mediator.selectableItems[position - creditCards.begin()];
|
| + editedItem.complete = YES;
|
| +
|
| if (![self.viewController isEditing]) {
|
| // Update the data source with the selection.
|
| - const std::vector<autofill::CreditCard*>& creditCards =
|
| - self.paymentRequest->credit_cards();
|
| - auto position =
|
| - std::find(creditCards.begin(), creditCards.end(), creditCard);
|
| - DCHECK(position != creditCards.end());
|
| self.mediator.selectedItemIndex = position - creditCards.begin();
|
| }
|
|
|
|
|