| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h" | 5 #import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h" |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "components/autofill/core/browser/autofill_profile.h" | 8 #include "components/autofill/core/browser/autofill_profile.h" |
| 9 #include "ios/chrome/browser/payments/payment_request.h" | 9 #include "ios/chrome/browser/payments/payment_request.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 - (void)stop { | 47 - (void)stop { |
| 48 [self.baseViewController.navigationController popViewControllerAnimated:YES]; | 48 [self.baseViewController.navigationController popViewControllerAnimated:YES]; |
| 49 _viewController = nil; | 49 _viewController = nil; |
| 50 } | 50 } |
| 51 | 51 |
| 52 - (void)stopSpinnerAndDisplayError { | 52 - (void)stopSpinnerAndDisplayError { |
| 53 // Re-enable user interactions that were disabled earlier in | 53 // Re-enable user interactions that were disabled earlier in |
| 54 // delayedNotifyDelegateOfSelection. | 54 // delayedNotifyDelegateOfSelection. |
| 55 _viewController.view.userInteractionEnabled = YES; | 55 _viewController.view.userInteractionEnabled = YES; |
| 56 | 56 |
| 57 [_viewController setIsLoading:NO]; | 57 [_viewController setIsPending:NO]; |
| 58 [_viewController | 58 [_viewController |
| 59 setErrorMessage:base::SysUTF16ToNSString( | 59 setErrorMessage:base::SysUTF16ToNSString( |
| 60 _paymentRequest->payment_details().error)]; | 60 _paymentRequest->payment_details().error)]; |
| 61 [_viewController loadModel]; | 61 [_viewController loadModel]; |
| 62 [[_viewController collectionView] reloadData]; | 62 [[_viewController collectionView] reloadData]; |
| 63 } | 63 } |
| 64 | 64 |
| 65 #pragma mark - ShippingAddressSelectionViewControllerDelegate | 65 #pragma mark - ShippingAddressSelectionViewControllerDelegate |
| 66 | 66 |
| 67 - (void)shippingAddressSelectionViewController: | 67 - (void)shippingAddressSelectionViewController: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 81 _viewController.view.userInteractionEnabled = NO; | 81 _viewController.view.userInteractionEnabled = NO; |
| 82 __weak ShippingAddressSelectionCoordinator* weakSelf = self; | 82 __weak ShippingAddressSelectionCoordinator* weakSelf = self; |
| 83 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, | 83 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, |
| 84 static_cast<int64_t>(0.2 * NSEC_PER_SEC)), | 84 static_cast<int64_t>(0.2 * NSEC_PER_SEC)), |
| 85 dispatch_get_main_queue(), ^{ | 85 dispatch_get_main_queue(), ^{ |
| 86 ShippingAddressSelectionCoordinator* strongSelf = weakSelf; | 86 ShippingAddressSelectionCoordinator* strongSelf = weakSelf; |
| 87 // Early return if the coordinator has been deallocated. | 87 // Early return if the coordinator has been deallocated. |
| 88 if (!strongSelf) | 88 if (!strongSelf) |
| 89 return; | 89 return; |
| 90 | 90 |
| 91 [strongSelf.viewController setIsLoading:YES]; | 91 [strongSelf.viewController setIsPending:YES]; |
| 92 [strongSelf.viewController loadModel]; | 92 [strongSelf.viewController loadModel]; |
| 93 [[strongSelf.viewController collectionView] reloadData]; | 93 [[strongSelf.viewController collectionView] reloadData]; |
| 94 | 94 |
| 95 [strongSelf.delegate | 95 [strongSelf.delegate |
| 96 shippingAddressSelectionCoordinator:strongSelf | 96 shippingAddressSelectionCoordinator:strongSelf |
| 97 didSelectShippingAddress:shippingAddress]; | 97 didSelectShippingAddress:shippingAddress]; |
| 98 }); | 98 }); |
| 99 } | 99 } |
| 100 | 100 |
| 101 @end | 101 @end |
| OLD | NEW |