| Index: ios/chrome/browser/ui/payments/billing_address_selection_coordinator.mm
|
| diff --git a/ios/chrome/browser/ui/payments/billing_address_selection_coordinator.mm b/ios/chrome/browser/ui/payments/billing_address_selection_coordinator.mm
|
| index 271335e35e77cc2a2744f890acbb06bb7ff29fd9..3335c867a7474e610cae1770849052154604dca2 100644
|
| --- a/ios/chrome/browser/ui/payments/billing_address_selection_coordinator.mm
|
| +++ b/ios/chrome/browser/ui/payments/billing_address_selection_coordinator.mm
|
| @@ -83,7 +83,7 @@ const int64_t kDelegateNotificationDelayInNanoSeconds = 0.2 * NSEC_PER_SEC;
|
|
|
| #pragma mark - PaymentRequestSelectorViewControllerDelegate
|
|
|
| -- (void)paymentRequestSelectorViewController:
|
| +- (BOOL)paymentRequestSelectorViewController:
|
| (PaymentRequestSelectorViewController*)controller
|
| didSelectItemAtIndex:(NSUInteger)index {
|
| CollectionViewItem<PaymentsIsSelectable>* selectedItem =
|
| @@ -99,8 +99,10 @@ const int64_t kDelegateNotificationDelayInNanoSeconds = 0.2 * NSEC_PER_SEC;
|
| // Update the data source with the selection.
|
| self.mediator.selectedItemIndex = index;
|
| [self delayedNotifyDelegateOfSelection:billingProfile];
|
| + return YES;
|
| } else {
|
| [self startAddressEditCoordinatorWithAddress:billingProfile];
|
| + return NO;
|
| }
|
| }
|
|
|
| @@ -135,13 +137,20 @@ const int64_t kDelegateNotificationDelayInNanoSeconds = 0.2 * NSEC_PER_SEC;
|
| // Update the data source with the new data.
|
| [self.mediator loadItems];
|
|
|
| + const std::vector<autofill::AutofillProfile*>& billingProfiles =
|
| + self.paymentRequest->billing_profiles();
|
| + const auto position =
|
| + std::find(billingProfiles.begin(), billingProfiles.end(), address);
|
| + DCHECK(position != billingProfiles.end());
|
| +
|
| + // Mark the edited item as complete meaning all required information has been
|
| + // filled out.
|
| + CollectionViewItem<PaymentsIsSelectable>* editedItem =
|
| + self.mediator.selectableItems[position - billingProfiles.begin()];
|
| + editedItem.complete = YES;
|
| +
|
| if (![self.viewController isEditing]) {
|
| // Update the data source with the selection.
|
| - const std::vector<autofill::AutofillProfile*>& billingProfiles =
|
| - self.paymentRequest->billing_profiles();
|
| - const auto position =
|
| - std::find(billingProfiles.begin(), billingProfiles.end(), address);
|
| - DCHECK(position != billingProfiles.end());
|
| self.mediator.selectedItemIndex = position - billingProfiles.begin();
|
| }
|
|
|
| @@ -151,12 +160,6 @@ const int64_t kDelegateNotificationDelayInNanoSeconds = 0.2 * NSEC_PER_SEC;
|
| [self.addressEditCoordinator stop];
|
| self.addressEditCoordinator = nil;
|
|
|
| - // Mark the item as complete meaning all required information has been
|
| - // filled out.
|
| - CollectionViewItem<PaymentsIsSelectable>* selectedItem =
|
| - self.mediator.selectableItems[self.mediator.selectedItemIndex];
|
| - selectedItem.complete = YES;
|
| -
|
| if (![self.viewController isEditing]) {
|
| // Inform |self.delegate| that |address| has been selected.
|
| [self.delegate billingAddressSelectionCoordinator:self
|
|
|