Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: ios/chrome/browser/payments/payment_request_edit_view_controller.mm

Issue 2826593005: [Payment Request] Sever card summary section in the credit card edit form (Closed)
Patch Set: Addressed comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/payment_request_edit_view_controller.h" 5 #import "ios/chrome/browser/payments/payment_request_edit_view_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/foundation_util.h" 8 #import "base/mac/foundation_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "components/strings/grit/components_strings.h" 10 #include "components/strings/grit/components_strings.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 name:UIKeyboardDidShowNotification 129 name:UIKeyboardDidShowNotification
130 object:nil]; 130 object:nil];
131 } 131 }
132 132
133 #pragma mark - CollectionViewController methods 133 #pragma mark - CollectionViewController methods
134 134
135 - (void)loadModel { 135 - (void)loadModel {
136 [super loadModel]; 136 [super loadModel];
137 CollectionViewModel* model = self.collectionViewModel; 137 CollectionViewModel* model = self.collectionViewModel;
138 138
139 [self loadHeaderItems];
140
139 // Iterate over the fields and add the respective sections and items. 141 // Iterate over the fields and add the respective sections and items.
140 int sectionIdentifier = static_cast<int>(SectionIdentifierFirstTextField); 142 int sectionIdentifier = static_cast<int>(SectionIdentifierFirstTextField);
141 for (EditorField* field in _fields) { 143 for (EditorField* field in _fields) {
142 [model addSectionWithIdentifier:sectionIdentifier]; 144 [model addSectionWithIdentifier:sectionIdentifier];
143 AutofillEditItem* item = 145 AutofillEditItem* item =
144 [[AutofillEditItem alloc] initWithType:ItemTypeTextField]; 146 [[AutofillEditItem alloc] initWithType:ItemTypeTextField];
145 item.textFieldName = field.label; 147 item.textFieldName = field.label;
146 item.textFieldEnabled = YES; 148 item.textFieldEnabled = YES;
147 item.textFieldValue = field.value; 149 item.textFieldValue = field.value;
148 item.required = field.isRequired; 150 item.required = field.isRequired;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 [self addOrRemoveErrorMessage:errorMessage 398 [self addOrRemoveErrorMessage:errorMessage
397 inSectionWithIdentifier:field.sectionIdentifier]; 399 inSectionWithIdentifier:field.sectionIdentifier];
398 if (errorMessage.length) 400 if (errorMessage.length)
399 return NO; 401 return NO;
400 402
401 field.value = item.textFieldValue; 403 field.value = item.textFieldValue;
402 } 404 }
403 return YES; 405 return YES;
404 } 406 }
405 407
408 - (void)loadHeaderItems {
409 }
410
406 - (void)loadFooterItems { 411 - (void)loadFooterItems {
407 CollectionViewModel* model = self.collectionViewModel; 412 CollectionViewModel* model = self.collectionViewModel;
408 413
409 [model addSectionWithIdentifier:SectionIdentifierFooter]; 414 [model addSectionWithIdentifier:SectionIdentifierFooter];
410 CollectionViewFooterItem* footerItem = 415 CollectionViewFooterItem* footerItem =
411 [[CollectionViewFooterItem alloc] initWithType:ItemTypeFooter]; 416 [[CollectionViewFooterItem alloc] initWithType:ItemTypeFooter];
412 footerItem.text = l10n_util::GetNSString(IDS_PAYMENTS_REQUIRED_FIELD_MESSAGE); 417 footerItem.text = l10n_util::GetNSString(IDS_PAYMENTS_REQUIRED_FIELD_MESSAGE);
413 [model addItem:footerItem toSectionWithIdentifier:SectionIdentifierFooter]; 418 [model addItem:footerItem toSectionWithIdentifier:SectionIdentifierFooter];
414 } 419 }
415 420
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 errorMessageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING); 453 errorMessageItem.image = NativeImage(IDR_IOS_PAYMENTS_WARNING);
449 errorMessageItem.accessibilityIdentifier = kWarningMessageAccessibilityID; 454 errorMessageItem.accessibilityIdentifier = kWarningMessageAccessibilityID;
450 [model addItem:errorMessageItem toSectionWithIdentifier:sectionIdentifier]; 455 [model addItem:errorMessageItem toSectionWithIdentifier:sectionIdentifier];
451 NSIndexPath* indexPath = [model indexPathForItemType:ItemTypeErrorMessage 456 NSIndexPath* indexPath = [model indexPathForItemType:ItemTypeErrorMessage
452 sectionIdentifier:sectionIdentifier]; 457 sectionIdentifier:sectionIdentifier];
453 [self.collectionView insertItemsAtIndexPaths:@[ indexPath ]]; 458 [self.collectionView insertItemsAtIndexPaths:@[ indexPath ]];
454 } 459 }
455 } 460 }
456 461
457 @end 462 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698