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

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

Issue 2963163002: [Payment Request] Displays accepted card types (credit, debit, etc) in iOS (Closed)
Patch Set: Addressed comment Created 3 years, 5 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_mediator.h" 5 #import "ios/chrome/browser/ui/payments/credit_card_edit_mediator.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "components/autofill/core/browser/autofill_data_util.h" 8 #include "components/autofill/core/browser/autofill_data_util.h"
9 #include "components/autofill/core/browser/autofill_profile.h" 9 #include "components/autofill/core/browser/autofill_profile.h"
10 #include "components/autofill/core/browser/credit_card.h" 10 #include "components/autofill/core/browser/credit_card.h"
11 #include "components/autofill/core/browser/personal_data_manager.h" 11 #include "components/autofill/core/browser/personal_data_manager.h"
12 #import "components/autofill/ios/browser/credit_card_util.h" 12 #import "components/autofill/ios/browser/credit_card_util.h"
13 #include "components/payments/core/payment_request_data_util.h" 13 #include "components/payments/core/payment_request_data_util.h"
14 #include "components/payments/core/strings_util.h"
14 #include "components/strings/grit/components_strings.h" 15 #include "components/strings/grit/components_strings.h"
15 #include "ios/chrome/browser/application_context.h" 16 #include "ios/chrome/browser/application_context.h"
16 #include "ios/chrome/browser/payments/payment_request.h" 17 #include "ios/chrome/browser/payments/payment_request.h"
17 #import "ios/chrome/browser/payments/payment_request_util.h" 18 #import "ios/chrome/browser/payments/payment_request_util.h"
18 #import "ios/chrome/browser/ui/autofill/autofill_ui_type.h" 19 #import "ios/chrome/browser/ui/autofill/autofill_ui_type.h"
19 #import "ios/chrome/browser/ui/payments/cells/accepted_payment_methods_item.h" 20 #import "ios/chrome/browser/ui/payments/cells/accepted_payment_methods_item.h"
20 #import "ios/chrome/browser/ui/payments/cells/payment_method_item.h" 21 #import "ios/chrome/browser/ui/payments/cells/payment_method_item.h"
21 #import "ios/chrome/browser/ui/payments/payment_request_edit_consumer.h" 22 #import "ios/chrome/browser/ui/payments/payment_request_edit_consumer.h"
22 #import "ios/chrome/browser/ui/payments/payment_request_editor_field.h" 23 #import "ios/chrome/browser/ui/payments/payment_request_editor_field.h"
23 #import "ios/chrome/browser/ui/uikit_ui_util.h" 24 #import "ios/chrome/browser/ui/uikit_ui_util.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 GetPaymentRequestData(issuerNetwork); 130 GetPaymentRequestData(issuerNetwork);
130 UIImage* issuerNetworkIcon = NativeImage(cardData.icon_resource_id); 131 UIImage* issuerNetworkIcon = NativeImage(cardData.icon_resource_id);
131 issuerNetworkIcon.accessibilityLabel = 132 issuerNetworkIcon.accessibilityLabel =
132 l10n_util::GetNSString(cardData.a11y_label_resource_id); 133 l10n_util::GetNSString(cardData.a11y_label_resource_id);
133 [issuerNetworkIcons addObject:issuerNetworkIcon]; 134 [issuerNetworkIcons addObject:issuerNetworkIcon];
134 } 135 }
135 136
136 AcceptedPaymentMethodsItem* acceptedMethodsItem = 137 AcceptedPaymentMethodsItem* acceptedMethodsItem =
137 [[AcceptedPaymentMethodsItem alloc] init]; 138 [[AcceptedPaymentMethodsItem alloc] init];
138 acceptedMethodsItem.message = 139 acceptedMethodsItem.message =
139 l10n_util::GetNSString(IDS_PAYMENTS_ACCEPTED_CARDS_LABEL); 140 base::SysUTF16ToNSString(payments::GetAcceptedCardTypesText(
141 _paymentRequest->supported_card_types_set()));
140 acceptedMethodsItem.methodTypeIcons = issuerNetworkIcons; 142 acceptedMethodsItem.methodTypeIcons = issuerNetworkIcons;
141 return acceptedMethodsItem; 143 return acceptedMethodsItem;
142 } 144 }
143 145
144 - (BOOL)shouldHideBackgroundForHeaderItem { 146 - (BOOL)shouldHideBackgroundForHeaderItem {
145 // YES if the header item displays the accepted payment method type icons. 147 // YES if the header item displays the accepted payment method type icons.
146 return !_creditCard || autofill::IsCreditCardLocal(*_creditCard); 148 return !_creditCard || autofill::IsCreditCardLocal(*_creditCard);
147 } 149 }
148 150
149 - (void)formatValueForEditorField:(EditorField*)field { 151 - (void)formatValueForEditorField:(EditorField*)field {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 value:@"YES" 328 value:@"YES"
327 required:YES]; 329 required:YES];
328 [self.fieldsMap setObject:saveToChromeField forKey:fieldKey]; 330 [self.fieldsMap setObject:saveToChromeField forKey:fieldKey];
329 } 331 }
330 [fields addObject:saveToChromeField]; 332 [fields addObject:saveToChromeField];
331 333
332 return fields; 334 return fields;
333 } 335 }
334 336
335 @end 337 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/payments/payment_request.mm ('k') | ios/chrome/browser/ui/payments/payment_method_selection_mediator.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698