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

Side by Side Diff: ios/chrome/browser/ui/payments/credit_card_edit_view_controller.mm

Issue 2911883002: [Payment Request] Renames a poorly named property of the AutofillEditItem. (Closed)
Patch Set: Initial Created 3 years, 6 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/ui/payments/credit_card_edit_view_controller.h" 5 #import "ios/chrome/browser/ui/payments/credit_card_edit_view_controller.h"
6 6
7 #import "base/mac/foundation_util.h" 7 #import "base/mac/foundation_util.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "components/strings/grit/components_strings.h" 9 #include "components/strings/grit/components_strings.h"
10 #import "ios/chrome/browser/ui/autofill/autofill_ui_type.h" 10 #import "ios/chrome/browser/ui/autofill/autofill_ui_type.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 - (void)loadModel { 89 - (void)loadModel {
90 [super loadModel]; 90 [super loadModel];
91 91
92 // If editing a credit card, set the card type icon (e.g. "Visa"). 92 // If editing a credit card, set the card type icon (e.g. "Visa").
93 if (_dataSource.state == EditViewControllerStateEdit) { 93 if (_dataSource.state == EditViewControllerStateEdit) {
94 for (EditorField* field in _fields) { 94 for (EditorField* field in _fields) {
95 if (field.autofillUIType == AutofillUITypeCreditCardNumber) { 95 if (field.autofillUIType == AutofillUITypeCreditCardNumber) {
96 AutofillEditItem* item = 96 AutofillEditItem* item =
97 base::mac::ObjCCastStrict<AutofillEditItem>(field.item); 97 base::mac::ObjCCastStrict<AutofillEditItem>(field.item);
98 item.cardTypeIcon = 98 item.identifyingIcon =
99 [_dataSource cardTypeIconFromCardNumber:item.textFieldValue]; 99 [_dataSource cardTypeIconFromCardNumber:item.textFieldValue];
100 } 100 }
101 } 101 }
102 } 102 }
103 } 103 }
104 104
105 - (void)loadFooterItems { 105 - (void)loadFooterItems {
106 CollectionViewModel* model = self.collectionViewModel; 106 CollectionViewModel* model = self.collectionViewModel;
107 107
108 // "Save card" section. Visible only when creating a card. 108 // "Save card" section. Visible only when creating a card.
(...skipping 25 matching lines...) Expand all
134 AutofillEditItem* item = base::mac::ObjCCastStrict<AutofillEditItem>( 134 AutofillEditItem* item = base::mac::ObjCCastStrict<AutofillEditItem>(
135 [self.collectionViewModel itemAtIndexPath:indexPath]); 135 [self.collectionViewModel itemAtIndexPath:indexPath]);
136 136
137 // If the user is typing in the credit card number field, update the card type 137 // If the user is typing in the credit card number field, update the card type
138 // icon (e.g. "Visa") to reflect the number being typed. 138 // icon (e.g. "Visa") to reflect the number being typed.
139 if (item.autofillUIType == AutofillUITypeCreditCardNumber) { 139 if (item.autofillUIType == AutofillUITypeCreditCardNumber) {
140 // Obtain the text being typed. 140 // Obtain the text being typed.
141 NSString* updatedText = 141 NSString* updatedText =
142 [textField.text stringByReplacingCharactersInRange:range 142 [textField.text stringByReplacingCharactersInRange:range
143 withString:newText]; 143 withString:newText];
144 item.cardTypeIcon = [_dataSource cardTypeIconFromCardNumber:updatedText]; 144 item.identifyingIcon = [_dataSource cardTypeIconFromCardNumber:updatedText];
145 145
146 // Update the cell. 146 // Update the cell.
147 [self reconfigureCellsForItems:@[ item ]]; 147 [self reconfigureCellsForItems:@[ item ]];
148 } 148 }
149 149
150 return YES; 150 return YES;
151 } 151 }
152 152
153 #pragma mark - UICollectionViewDataSource 153 #pragma mark - UICollectionViewDataSource
154 154
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 } 205 }
206 206
207 #pragma mark Switch Actions 207 #pragma mark Switch Actions
208 208
209 - (void)saveCardSwitchToggled:(UISwitch*)sender { 209 - (void)saveCardSwitchToggled:(UISwitch*)sender {
210 _saveCreditCard = sender.isOn; 210 _saveCreditCard = sender.isOn;
211 } 211 }
212 212
213 @end 213 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698