Index: ios/chrome/browser/ui/payments/billing_address_selection_mediator.mm |
diff --git a/ios/chrome/browser/ui/payments/billing_address_selection_mediator.mm b/ios/chrome/browser/ui/payments/billing_address_selection_mediator.mm |
index 2f1c5f087c051a0407c33633ee8e5f21b5cbad68..1150e560a313d656ea7ce9b726ded1c75aa8bb04 100644 |
--- a/ios/chrome/browser/ui/payments/billing_address_selection_mediator.mm |
+++ b/ios/chrome/browser/ui/payments/billing_address_selection_mediator.mm |
@@ -38,7 +38,7 @@ using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile; |
@property(nonatomic, assign) autofill::AutofillProfile* selectedBillingProfile; |
// The selectable items to display in the collection. |
-@property(nonatomic, strong) NSArray<AutofillProfileItem*>* items; |
+@property(nonatomic, strong) NSMutableArray<AutofillProfileItem*>* items; |
@end |
@@ -59,13 +59,17 @@ using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile; |
_paymentRequest = paymentRequest; |
_selectedBillingProfile = selectedBillingProfile; |
_selectedItemIndex = NSUIntegerMax; |
- _items = [self createItems]; |
+ [self createItems]; |
} |
return self; |
} |
#pragma mark - PaymentRequestSelectorViewControllerDataSource |
+- (BOOL)allowsEditMode { |
+ return YES; |
+} |
+ |
- (CollectionViewItem*)headerItem { |
return nil; |
} |
@@ -81,14 +85,13 @@ using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile; |
return addButtonItem; |
} |
-#pragma mark - Helper methods |
+#pragma mark - Public methods |
-- (NSArray<AutofillProfileItem*>*)createItems { |
+- (void)createItems { |
const std::vector<autofill::AutofillProfile*>& billingProfiles = |
_paymentRequest->billing_profiles(); |
- NSMutableArray<AutofillProfileItem*>* items = |
- [NSMutableArray arrayWithCapacity:billingProfiles.size()]; |
+ _items = [NSMutableArray arrayWithCapacity:billingProfiles.size()]; |
for (size_t index = 0; index < billingProfiles.size(); ++index) { |
autofill::AutofillProfile* billingProfile = billingProfiles[index]; |
DCHECK(billingProfile); |
@@ -99,10 +102,8 @@ using ::payment_request_util::GetPhoneNumberLabelFromAutofillProfile; |
if (self.selectedBillingProfile == billingProfile) |
_selectedItemIndex = index; |
- [items addObject:item]; |
+ [_items addObject:item]; |
} |
- |
- return items; |
} |
@end |