Index: ios/chrome/browser/ui/payments/payment_request_coordinator.mm |
diff --git a/ios/chrome/browser/ui/payments/payment_request_coordinator.mm b/ios/chrome/browser/ui/payments/payment_request_coordinator.mm |
index 1ada0661e8a015ebd439f2f82c76cde9aae48298..08653996b2f54a9cd29f7469664f4ee42077b8c9 100644 |
--- a/ios/chrome/browser/ui/payments/payment_request_coordinator.mm |
+++ b/ios/chrome/browser/ui/payments/payment_request_coordinator.mm |
@@ -55,10 +55,10 @@ |
- (void)start { |
_mediator = |
- [[PaymentRequestMediator alloc] initWithBrowserState:_browserState |
- paymentRequest:_paymentRequest]; |
- |
- _viewController = [[PaymentRequestViewController alloc] init]; |
+ [[PaymentRequestMediator alloc] initWithBrowserState:_browserState]; |
+ |
+ _viewController = [[PaymentRequestViewController alloc] |
+ initWithPaymentRequest:_paymentRequest]; |
[_viewController setPageFavicon:_pageFavicon]; |
[_viewController setPageTitle:_pageTitle]; |
[_viewController setPageHost:_pageHost]; |
@@ -124,7 +124,6 @@ |
- (void)updatePaymentDetails:(web::PaymentDetails)paymentDetails { |
BOOL totalValueChanged = |
(_paymentRequest->payment_details().total != paymentDetails.total); |
- [_mediator setTotalValueChanged:totalValueChanged]; |
_paymentRequest->UpdatePaymentDetails(paymentDetails); |
if (_paymentRequest->shipping_options().empty()) { |
@@ -139,25 +138,29 @@ |
[_viewController loadModel]; |
[[_viewController collectionView] reloadData]; |
} else { |
- // Update the payment summary item. |
- [_viewController updatePaymentSummaryItem]; |
+ // Update the payment summary section. |
+ [_viewController |
+ updatePaymentSummaryWithTotalValueChanged:totalValueChanged]; |
if (_shippingAddressSelectionCoordinator) { |
- // Set the selected shipping address. |
+ // Set the selected shipping address and update the selected shipping |
+ // address in the payment request summary view. |
_paymentRequest->set_selected_shipping_profile(_pendingShippingAddress); |
_pendingShippingAddress = nil; |
+ [_viewController updateSelectedShippingAddressUI]; |
// Dismiss the shipping address selection view. |
[_shippingAddressSelectionCoordinator stop]; |
_shippingAddressSelectionCoordinator = nil; |
} else if (_shippingOptionSelectionCoordinator) { |
+ // Update the selected shipping option in the payment request summary |
+ // view. The updated selection is already reflected in |_paymentRequest|. |
+ [_viewController updateSelectedShippingOptionUI]; |
+ |
// Dismiss the shipping option selection view. |
[_shippingOptionSelectionCoordinator stop]; |
_shippingOptionSelectionCoordinator = nil; |
} |
- |
- // Update the Shipping section in the payment request summary view. |
- [_viewController updateShippingSection]; |
} |
} |
@@ -257,7 +260,7 @@ |
- (void)paymentItemsDisplayCoordinatorDidReturn: |
(PaymentItemsDisplayCoordinator*)coordinator { |
// Clear the 'Updated' label on the payment summary item, if there is one. |
- [_viewController updatePaymentSummaryItem]; |
+ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; |
[_itemsDisplayCoordinator stop]; |
_itemsDisplayCoordinator = nil; |
@@ -275,7 +278,7 @@ |
didSelectContactProfile:(autofill::AutofillProfile*)contactProfile { |
_paymentRequest->set_selected_contact_profile(contactProfile); |
- [_viewController updateContactInfoSection]; |
+ [_viewController updateSelectedContactInfoUI]; |
[_contactInfoSelectionCoordinator stop]; |
_contactInfoSelectionCoordinator = nil; |
@@ -303,7 +306,7 @@ |
- (void)shippingAddressSelectionCoordinatorDidReturn: |
(ShippingAddressSelectionCoordinator*)coordinator { |
// Clear the 'Updated' label on the payment summary item, if there is one. |
- [_viewController updatePaymentSummaryItem]; |
+ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; |
[_shippingAddressSelectionCoordinator stop]; |
_shippingAddressSelectionCoordinator = nil; |
@@ -322,7 +325,7 @@ |
- (void)shippingOptionSelectionCoordinatorDidReturn: |
(ShippingAddressSelectionCoordinator*)coordinator { |
// Clear the 'Updated' label on the payment summary item, if there is one. |
- [_viewController updatePaymentSummaryItem]; |
+ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; |
[_shippingOptionSelectionCoordinator stop]; |
_shippingOptionSelectionCoordinator = nil; |
@@ -335,10 +338,10 @@ |
didSelectPaymentMethod:(autofill::CreditCard*)creditCard { |
_paymentRequest->set_selected_credit_card(creditCard); |
- [_viewController updatePaymentMethodSection]; |
- |
- // Clear the 'Updated' label on the payment summary item, if there is one. |
- [_viewController updatePaymentSummaryItem]; |
+ [_viewController updateSelectedPaymentMethodUI]; |
+ |
+ // Clear the 'Updated' label on the payment summary item, if there is one. |
+ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; |
[_methodSelectionCoordinator stop]; |
_methodSelectionCoordinator = nil; |
@@ -347,7 +350,7 @@ |
- (void)paymentMethodSelectionCoordinatorDidReturn: |
(PaymentMethodSelectionCoordinator*)coordinator { |
// Clear the 'Updated' label on the payment summary item, if there is one. |
- [_viewController updatePaymentSummaryItem]; |
+ [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; |
[_methodSelectionCoordinator stop]; |
_methodSelectionCoordinator = nil; |