| Index: ios/chrome/browser/ui/payments/shipping_address_selection_mediator.mm
|
| diff --git a/ios/chrome/browser/ui/payments/shipping_address_selection_mediator.mm b/ios/chrome/browser/ui/payments/shipping_address_selection_mediator.mm
|
| index 3841538d0a7ee408a16c222c81c78774cc932481..2a996dda50f37109daaf3c004a0a21ced5d5b9c2 100644
|
| --- a/ios/chrome/browser/ui/payments/shipping_address_selection_mediator.mm
|
| +++ b/ios/chrome/browser/ui/payments/shipping_address_selection_mediator.mm
|
| @@ -34,7 +34,7 @@ using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile;
|
| @property(nonatomic, assign) PaymentRequest* paymentRequest;
|
|
|
| // The selectable items to display in the collection.
|
| -@property(nonatomic, strong) NSArray<AutofillProfileItem*>* items;
|
| +@property(nonatomic, strong) NSMutableArray<AutofillProfileItem*>* items;
|
|
|
| @end
|
|
|
| @@ -51,13 +51,17 @@ using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile;
|
| if (self) {
|
| _paymentRequest = paymentRequest;
|
| _selectedItemIndex = NSUIntegerMax;
|
| - _items = [self createItems];
|
| + [self loadItems];
|
| }
|
| return self;
|
| }
|
|
|
| #pragma mark - PaymentRequestSelectorViewControllerDataSource
|
|
|
| +- (BOOL)allowsEditMode {
|
| + return YES;
|
| +}
|
| +
|
| - (CollectionViewItem*)headerItem {
|
| if (!self.headerText.length)
|
| return nil;
|
| @@ -80,13 +84,12 @@ using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile;
|
| return addButtonItem;
|
| }
|
|
|
| -#pragma mark - Helper methods
|
| +#pragma mark - Public methods
|
|
|
| -- (NSArray<AutofillProfileItem*>*)createItems {
|
| +- (void)loadItems {
|
| const std::vector<autofill::AutofillProfile*>& shippingProfiles =
|
| _paymentRequest->shipping_profiles();
|
| - NSMutableArray<AutofillProfileItem*>* items =
|
| - [NSMutableArray arrayWithCapacity:shippingProfiles.size()];
|
| + _items = [NSMutableArray arrayWithCapacity:shippingProfiles.size()];
|
| for (size_t index = 0; index < shippingProfiles.size(); ++index) {
|
| autofill::AutofillProfile* shippingAddress = shippingProfiles[index];
|
| DCHECK(shippingAddress);
|
| @@ -97,9 +100,8 @@ using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile;
|
| if (_paymentRequest->selected_shipping_profile() == shippingAddress)
|
| _selectedItemIndex = index;
|
|
|
| - [items addObject:item];
|
| + [_items addObject:item];
|
| }
|
| - return items;
|
| }
|
|
|
| @end
|
|
|