Commit 3b6c0f16 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Configures SaveCard Modal with final Strings

-Creates Strings to be used on the SaveCard Infobar Modal.
-Uses these newly created String along others from the saveCardDelegate
in order to configure the SaveCardModal.

Screenshot:
https://drive.google.com/open?id=1V0lJN1hd2aHVprN4K-HPQavA3Dmr27kz

Bug: 1014652
Change-Id: I8dfe51d4b06c58966e9946ab365e686a22ae72fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911384Reviewed-by: default avatarChris Lu <thegreenfrog@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714582}
parent d93edf21
...@@ -293,6 +293,12 @@ locale. The strings in this file are specific to iOS. ...@@ -293,6 +293,12 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_AUTOFILL_EXP_YEAR" desc="Title of the field representing the expiration year of a credit card. [Length: 15em] [iOS only]"> <message name="IDS_IOS_AUTOFILL_EXP_YEAR" desc="Title of the field representing the expiration year of a credit card. [Length: 15em] [iOS only]">
Expiration Year Expiration Year
</message> </message>
<message name="IDS_IOS_AUTOFILL_CARDHOLDER_NAME" desc="Tile of the field representing the cardholder name of a credit card. [Length: 15em] [iOS only]">
Cardholder Name
</message>
<message name="IDS_IOS_AUTOFILL_SAVE_CARD" desc="Title for the view for saving a credit card. [Length: 15em] [iOS only]">
Save Card
</message>
<message name="IDS_IOS_AUTOFILL_FULLNAME" desc="Title of the field of a profile address representing the full name of the addressee. [Length: 15em] [iOS only]"> <message name="IDS_IOS_AUTOFILL_FULLNAME" desc="Title of the field of a profile address representing the full name of the addressee. [Length: 15em] [iOS only]">
Full Name Full Name
</message> </message>
......
64cccc843ea70fdf800d77ff72a1a9f1d69064d4
\ No newline at end of file
56bf15e2f93bdb7b5b128f00f7027ca2c1a74319
\ No newline at end of file
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#import "ios/chrome/browser/ui/infobars/infobar_container.h" #import "ios/chrome/browser/ui/infobars/infobar_container.h"
#import "ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.h" #import "ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -154,10 +156,20 @@ ...@@ -154,10 +156,20 @@
self.modalViewController = self.modalViewController =
[[InfobarSaveCardTableViewController alloc] initWithModalDelegate:self]; [[InfobarSaveCardTableViewController alloc] initWithModalDelegate:self];
// TODO(crbug.com/1014652): Replace with Modal specific text. self.modalViewController.title =
self.modalViewController.title = @"Save Credit Card"; l10n_util::GetNSString(IDS_IOS_AUTOFILL_SAVE_CARD);
self.modalViewController.cardIssuerIcon = self.modalViewController.cardIssuerIcon =
NativeImage(self.saveCardInfoBarDelegate->issuer_icon_id()); NativeImage(self.saveCardInfoBarDelegate->issuer_icon_id());
self.modalViewController.cardNumber = [NSString
stringWithFormat:@"•••• %@",
base::SysUTF16ToNSString(self.saveCardInfoBarDelegate
->card_last_four_digits())];
self.modalViewController.cardholderName =
base::SysUTF16ToNSString(self.saveCardInfoBarDelegate->cardholder_name());
self.modalViewController.expirationMonth = base::SysUTF16ToNSString(
self.saveCardInfoBarDelegate->expiration_date_month());
self.modalViewController.expirationYear = base::SysUTF16ToNSString(
self.saveCardInfoBarDelegate->expiration_date_year());
return YES; return YES;
} }
......
...@@ -20,9 +20,21 @@ ...@@ -20,9 +20,21 @@
(ChromeTableViewControllerStyle)appBarStyle (ChromeTableViewControllerStyle)appBarStyle
NS_UNAVAILABLE; NS_UNAVAILABLE;
// Cardholder name to be displayed.
@property(nonatomic, copy) NSString* cardholderName;
// Card Issuer icon image to be displayed. // Card Issuer icon image to be displayed.
@property(nonatomic, strong) UIImage* cardIssuerIcon; @property(nonatomic, strong) UIImage* cardIssuerIcon;
// Card Number to be displayed.
@property(nonatomic, copy) NSString* cardNumber;
// Card Expiration Month to be displayed
@property(nonatomic, copy) NSString* expirationMonth;
// Card Expiration Year to be displayed.
@property(nonatomic, copy) NSString* expirationYear;
@end @end
#endif // IOS_CHROME_BROWSER_UI_INFOBARS_MODALS_INFOBAR_SAVE_CARD_TABLE_VIEW_CONTROLLER_H_ #endif // IOS_CHROME_BROWSER_UI_INFOBARS_MODALS_INFOBAR_SAVE_CARD_TABLE_VIEW_CONTROLLER_H_
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#import "ios/chrome/browser/ui/table_view/cells/table_view_text_edit_item.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_text_edit_item.h"
#import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h"
#import "ios/chrome/common/colors/semantic_color_names.h" #import "ios/chrome/common/colors/semantic_color_names.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
...@@ -101,56 +103,54 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -101,56 +103,54 @@ typedef NS_ENUM(NSInteger, ItemType) {
TableViewModel* model = self.tableViewModel; TableViewModel* model = self.tableViewModel;
[model addSectionWithIdentifier:SectionIdentifierContent]; [model addSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the TableViewTextEditItem* cardLastDigitsItem = [self
// delegate. textEditItemWithType:ItemTypeCardExpireYear
TableViewTextEditItem* cardLastDigitsItem = textFieldName:l10n_util::GetNSString(IDS_IOS_AUTOFILL_CARD_NUMBER)
[self textEditItemWithType:ItemTypeCardExpireYear textFieldValue:self.cardNumber
textFieldName:@"Card Number" textFieldEnabled:NO];
textFieldValue:@"•••• 1234"
textFieldEnabled:NO];
cardLastDigitsItem.identifyingIcon = self.cardIssuerIcon; cardLastDigitsItem.identifyingIcon = self.cardIssuerIcon;
[model addItem:cardLastDigitsItem [model addItem:cardLastDigitsItem
toSectionWithIdentifier:SectionIdentifierContent]; toSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the // TODO(crbug.com/1014652): Change textFieldEnabled to YES once editing its
// delegate. // supported.
TableViewTextEditItem* cardholderNameItem = TableViewTextEditItem* cardholderNameItem =
[self textEditItemWithType:ItemTypeCardExpireYear [self textEditItemWithType:ItemTypeCardExpireYear
textFieldName:@"Cardholder Name" textFieldName:l10n_util::GetNSString(
textFieldValue:@"Sergio Collazos" IDS_IOS_AUTOFILL_CARDHOLDER_NAME)
textFieldEnabled:YES]; textFieldValue:self.cardholderName
textFieldEnabled:NO];
[model addItem:cardholderNameItem [model addItem:cardholderNameItem
toSectionWithIdentifier:SectionIdentifierContent]; toSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the // TODO(crbug.com/1014652): Change textFieldEnabled to YES once editing its
// delegate. // supported.
TableViewTextEditItem* expireMonthItem = TableViewTextEditItem* expireMonthItem = [self
[self textEditItemWithType:ItemTypeCardExpireYear textEditItemWithType:ItemTypeCardExpireYear
textFieldName:@"Expiration Month" textFieldName:l10n_util::GetNSString(IDS_IOS_AUTOFILL_EXP_MONTH)
textFieldValue:@"07" textFieldValue:self.expirationMonth
textFieldEnabled:YES]; textFieldEnabled:NO];
[model addItem:expireMonthItem [model addItem:expireMonthItem
toSectionWithIdentifier:SectionIdentifierContent]; toSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the // TODO(crbug.com/1014652): Change textFieldEnabled to YES once editing its
// delegate. // supported.
TableViewTextEditItem* expireYearItem = TableViewTextEditItem* expireYearItem = [self
[self textEditItemWithType:ItemTypeCardExpireYear textEditItemWithType:ItemTypeCardExpireYear
textFieldName:@"Expiration Year" textFieldName:l10n_util::GetNSString(IDS_IOS_AUTOFILL_EXP_YEAR)
textFieldValue:@"2020" textFieldValue:self.expirationYear
textFieldEnabled:YES]; textFieldEnabled:NO];
[model addItem:expireYearItem [model addItem:expireYearItem
toSectionWithIdentifier:SectionIdentifierContent]; toSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the
// delegate.
TableViewTextButtonItem* saveCardButtonItem = TableViewTextButtonItem* saveCardButtonItem =
[[TableViewTextButtonItem alloc] initWithType:ItemTypeCardSave]; [[TableViewTextButtonItem alloc] initWithType:ItemTypeCardSave];
saveCardButtonItem.textAlignment = NSTextAlignmentNatural; saveCardButtonItem.textAlignment = NSTextAlignmentNatural;
// TODO(crbug.com/1014652): Implement TOS with Links. This might require a // TODO(crbug.com/1014652): Implement TOS with Links. This might require a
// separate item. // separate item.
saveCardButtonItem.text = @"TOS Agreement"; saveCardButtonItem.text = @"TOS Agreement";
saveCardButtonItem.buttonText = @"Save Credit Card"; saveCardButtonItem.buttonText =
l10n_util::GetNSString(IDS_IOS_AUTOFILL_SAVE_CARD);
saveCardButtonItem.enabled = YES; saveCardButtonItem.enabled = YES;
saveCardButtonItem.disableButtonIntrinsicWidth = YES; saveCardButtonItem.disableButtonIntrinsicWidth = YES;
[model addItem:saveCardButtonItem [model addItem:saveCardButtonItem
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment