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.
<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
</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]">
Full Name
</message>
......
64cccc843ea70fdf800d77ff72a1a9f1d69064d4
\ No newline at end of file
56bf15e2f93bdb7b5b128f00f7027ca2c1a74319
\ No newline at end of file
......@@ -13,6 +13,8 @@
#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/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"
#if !defined(__has_feature) || !__has_feature(objc_arc)
......@@ -154,10 +156,20 @@
self.modalViewController =
[[InfobarSaveCardTableViewController alloc] initWithModalDelegate:self];
// TODO(crbug.com/1014652): Replace with Modal specific text.
self.modalViewController.title = @"Save Credit Card";
self.modalViewController.title =
l10n_util::GetNSString(IDS_IOS_AUTOFILL_SAVE_CARD);
self.modalViewController.cardIssuerIcon =
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;
}
......
......@@ -20,9 +20,21 @@
(ChromeTableViewControllerStyle)appBarStyle
NS_UNAVAILABLE;
// Cardholder name to be displayed.
@property(nonatomic, copy) NSString* cardholderName;
// Card Issuer icon image to be displayed.
@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
#endif // IOS_CHROME_BROWSER_UI_INFOBARS_MODALS_INFOBAR_SAVE_CARD_TABLE_VIEW_CONTROLLER_H_
......@@ -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/chrome_table_view_styler.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)
#error "This file requires ARC support."
......@@ -101,56 +103,54 @@ typedef NS_ENUM(NSInteger, ItemType) {
TableViewModel* model = self.tableViewModel;
[model addSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the
// delegate.
TableViewTextEditItem* cardLastDigitsItem =
[self textEditItemWithType:ItemTypeCardExpireYear
textFieldName:@"Card Number"
textFieldValue:@"•••• 1234"
textFieldEnabled:NO];
TableViewTextEditItem* cardLastDigitsItem = [self
textEditItemWithType:ItemTypeCardExpireYear
textFieldName:l10n_util::GetNSString(IDS_IOS_AUTOFILL_CARD_NUMBER)
textFieldValue:self.cardNumber
textFieldEnabled:NO];
cardLastDigitsItem.identifyingIcon = self.cardIssuerIcon;
[model addItem:cardLastDigitsItem
toSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the
// delegate.
// TODO(crbug.com/1014652): Change textFieldEnabled to YES once editing its
// supported.
TableViewTextEditItem* cardholderNameItem =
[self textEditItemWithType:ItemTypeCardExpireYear
textFieldName:@"Cardholder Name"
textFieldValue:@"Sergio Collazos"
textFieldEnabled:YES];
textFieldName:l10n_util::GetNSString(
IDS_IOS_AUTOFILL_CARDHOLDER_NAME)
textFieldValue:self.cardholderName
textFieldEnabled:NO];
[model addItem:cardholderNameItem
toSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the
// delegate.
TableViewTextEditItem* expireMonthItem =
[self textEditItemWithType:ItemTypeCardExpireYear
textFieldName:@"Expiration Month"
textFieldValue:@"07"
textFieldEnabled:YES];
// TODO(crbug.com/1014652): Change textFieldEnabled to YES once editing its
// supported.
TableViewTextEditItem* expireMonthItem = [self
textEditItemWithType:ItemTypeCardExpireYear
textFieldName:l10n_util::GetNSString(IDS_IOS_AUTOFILL_EXP_MONTH)
textFieldValue:self.expirationMonth
textFieldEnabled:NO];
[model addItem:expireMonthItem
toSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the
// delegate.
TableViewTextEditItem* expireYearItem =
[self textEditItemWithType:ItemTypeCardExpireYear
textFieldName:@"Expiration Year"
textFieldValue:@"2020"
textFieldEnabled:YES];
// TODO(crbug.com/1014652): Change textFieldEnabled to YES once editing its
// supported.
TableViewTextEditItem* expireYearItem = [self
textEditItemWithType:ItemTypeCardExpireYear
textFieldName:l10n_util::GetNSString(IDS_IOS_AUTOFILL_EXP_YEAR)
textFieldValue:self.expirationYear
textFieldEnabled:NO];
[model addItem:expireYearItem
toSectionWithIdentifier:SectionIdentifierContent];
// TODO(crbug.com/1014652): Use the real strings once they are exposed in the
// delegate.
TableViewTextButtonItem* saveCardButtonItem =
[[TableViewTextButtonItem alloc] initWithType:ItemTypeCardSave];
saveCardButtonItem.textAlignment = NSTextAlignmentNatural;
// TODO(crbug.com/1014652): Implement TOS with Links. This might require a
// separate item.
saveCardButtonItem.text = @"TOS Agreement";
saveCardButtonItem.buttonText = @"Save Credit Card";
saveCardButtonItem.buttonText =
l10n_util::GetNSString(IDS_IOS_AUTOFILL_SAVE_CARD);
saveCardButtonItem.enabled = YES;
saveCardButtonItem.disableButtonIntrinsicWidth = YES;
[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