| OLD | NEW |
| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 // If the user is typing in the credit card number field, update the card type | 236 // If the user is typing in the credit card number field, update the card type |
| 237 // icon (e.g. "Visa") to reflect the number being typed. | 237 // icon (e.g. "Visa") to reflect the number being typed. |
| 238 if (item.autofillUIType == AutofillUITypeCreditCardNumber) { | 238 if (item.autofillUIType == AutofillUITypeCreditCardNumber) { |
| 239 // Obtain the text being typed. | 239 // Obtain the text being typed. |
| 240 NSString* updatedText = | 240 NSString* updatedText = |
| 241 [textField.text stringByReplacingCharactersInRange:range | 241 [textField.text stringByReplacingCharactersInRange:range |
| 242 withString:newText]; | 242 withString:newText]; |
| 243 item.cardTypeIcon = [_dataSource cardTypeIconFromCardNumber:updatedText]; | 243 item.cardTypeIcon = [_dataSource cardTypeIconFromCardNumber:updatedText]; |
| 244 | 244 |
| 245 NSInteger sectionIdentifier = [self.collectionViewModel | |
| 246 sectionIdentifierForSection:[indexPath section]]; | |
| 247 // Update the cell. | 245 // Update the cell. |
| 248 [self reconfigureCellsForItems:@[ item ] | 246 [self reconfigureCellsForItems:@[ item ]]; |
| 249 inSectionWithIdentifier:sectionIdentifier]; | |
| 250 } | 247 } |
| 251 | 248 |
| 252 return YES; | 249 return YES; |
| 253 } | 250 } |
| 254 | 251 |
| 255 #pragma mark - UICollectionViewDataSource | 252 #pragma mark - UICollectionViewDataSource |
| 256 | 253 |
| 257 - (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView | 254 - (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView |
| 258 cellForItemAtIndexPath:(NSIndexPath*)indexPath { | 255 cellForItemAtIndexPath:(NSIndexPath*)indexPath { |
| 259 UICollectionViewCell* cell = | 256 UICollectionViewCell* cell = |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } | 353 } |
| 357 } | 354 } |
| 358 | 355 |
| 359 #pragma mark Switch Actions | 356 #pragma mark Switch Actions |
| 360 | 357 |
| 361 - (void)saveCardSwitchToggled:(UISwitch*)sender { | 358 - (void)saveCardSwitchToggled:(UISwitch*)sender { |
| 362 _saveCreditCard = sender.isOn; | 359 _saveCreditCard = sender.isOn; |
| 363 } | 360 } |
| 364 | 361 |
| 365 @end | 362 @end |
| OLD | NEW |