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

Side by Side Diff: ios/chrome/browser/payments/shipping_option_selection_view_controller.mm

Issue 2701923003: [Payment Request] Error message screen (Closed)
Patch Set: Addressed comments Created 3 years, 10 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/payments/shipping_option_selection_view_controller.h " 5 #import "ios/chrome/browser/payments/shipping_option_selection_view_controller.h "
6 6
7 #import "base/ios/weak_nsobject.h" 7 #import "base/ios/weak_nsobject.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "components/payments/currency_formatter.h" 11 #include "components/payments/currency_formatter.h"
12 #include "components/strings/grit/components_strings.h" 12 #include "components/strings/grit/components_strings.h"
13 #import "ios/chrome/browser/payments/cells/payments_text_item.h" 13 #import "ios/chrome/browser/payments/cells/payments_text_item.h"
14 #include "ios/chrome/browser/payments/payment_request.h" 14 #include "ios/chrome/browser/payments/payment_request.h"
15 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" 15 #import "ios/chrome/browser/ui/autofill/cells/status_item.h"
16 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h" 16 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h"
17 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" 17 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
18 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h " 18 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h "
19 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" 19 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
20 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" 20 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
21 #import "ios/chrome/browser/ui/icons/chrome_icon.h" 21 #import "ios/chrome/browser/ui/icons/chrome_icon.h"
22 #include "ios/chrome/browser/ui/uikit_ui_util.h" 22 #include "ios/chrome/browser/ui/uikit_ui_util.h"
23 #include "ios/chrome/grit/ios_strings.h" 23 #include "ios/chrome/grit/ios_strings.h"
24 #include "ios/chrome/grit/ios_theme_resources.h" 24 #include "ios/chrome/grit/ios_theme_resources.h"
25 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h" 25 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h"
26 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h" 26 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 28
29 NSString* const kShippingOptionSelectionCollectionViewId = 29 NSString* const kShippingOptionSelectionCollectionViewID =
30 @"kShippingOptionSelectionCollectionViewId"; 30 @"kShippingOptionSelectionCollectionViewID";
31 31
32 namespace { 32 namespace {
33 33
34 const CGFloat kSeparatorEdgeInset = 14; 34 const CGFloat kSeparatorEdgeInset = 14;
35 35
36 typedef NS_ENUM(NSInteger, SectionIdentifier) { 36 typedef NS_ENUM(NSInteger, SectionIdentifier) {
37 SectionIdentifierShippingOption = kSectionIdentifierEnumZero, 37 SectionIdentifierShippingOption = kSectionIdentifierEnumZero,
38 }; 38 };
39 39
40 typedef NS_ENUM(NSInteger, ItemType) { 40 typedef NS_ENUM(NSInteger, ItemType) {
(...skipping 26 matching lines...) Expand all
67 67
68 @synthesize isLoading = _isLoading; 68 @synthesize isLoading = _isLoading;
69 @synthesize errorMessage = _errorMessage; 69 @synthesize errorMessage = _errorMessage;
70 70
71 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest { 71 - (instancetype)initWithPaymentRequest:(PaymentRequest*)paymentRequest {
72 DCHECK(paymentRequest); 72 DCHECK(paymentRequest);
73 if ((self = [super initWithStyle:CollectionViewControllerStyleAppBar])) { 73 if ((self = [super initWithStyle:CollectionViewControllerStyleAppBar])) {
74 self.title = l10n_util::GetNSString( 74 self.title = l10n_util::GetNSString(
75 IDS_IOS_PAYMENT_REQUEST_SHIPPING_OPTION_SELECTION_TITLE); 75 IDS_IOS_PAYMENT_REQUEST_SHIPPING_OPTION_SELECTION_TITLE);
76 76
77 // Set up leading (return) button.
77 UIBarButtonItem* returnButton = 78 UIBarButtonItem* returnButton =
78 [ChromeIcon templateBarButtonItemWithImage:[ChromeIcon backIcon] 79 [ChromeIcon templateBarButtonItemWithImage:[ChromeIcon backIcon]
79 target:nil 80 target:nil
80 action:@selector(onReturn)]; 81 action:@selector(onReturn)];
81 returnButton.accessibilityLabel = l10n_util::GetNSString(IDS_ACCNAME_BACK); 82 returnButton.accessibilityLabel = l10n_util::GetNSString(IDS_ACCNAME_BACK);
82 self.navigationItem.leftBarButtonItem = returnButton; 83 self.navigationItem.leftBarButtonItem = returnButton;
83 84
84 _paymentRequest = paymentRequest; 85 _paymentRequest = paymentRequest;
85 } 86 }
86 return self; 87 return self;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 149 }
149 150
150 [model addItem:item 151 [model addItem:item
151 toSectionWithIdentifier:SectionIdentifierShippingOption]; 152 toSectionWithIdentifier:SectionIdentifierShippingOption];
152 } 153 }
153 } 154 }
154 155
155 - (void)viewDidLoad { 156 - (void)viewDidLoad {
156 [super viewDidLoad]; 157 [super viewDidLoad];
157 self.collectionView.accessibilityIdentifier = 158 self.collectionView.accessibilityIdentifier =
158 kShippingOptionSelectionCollectionViewId; 159 kShippingOptionSelectionCollectionViewID;
159 160
160 // Customize collection view settings. 161 // Customize collection view settings.
161 self.styler.cellStyle = MDCCollectionViewCellStyleCard; 162 self.styler.cellStyle = MDCCollectionViewCellStyleCard;
162 self.styler.separatorInset = 163 self.styler.separatorInset =
163 UIEdgeInsetsMake(0, kSeparatorEdgeInset, 0, kSeparatorEdgeInset); 164 UIEdgeInsetsMake(0, kSeparatorEdgeInset, 0, kSeparatorEdgeInset);
164 } 165 }
165 166
166 #pragma mark UICollectionViewDataSource 167 #pragma mark UICollectionViewDataSource
167 168
168 - (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView 169 - (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath { 247 hidesInkViewAtIndexPath:(NSIndexPath*)indexPath {
247 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath]; 248 NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath];
248 if (type == ItemTypeMessage) { 249 if (type == ItemTypeMessage) {
249 return YES; 250 return YES;
250 } else { 251 } else {
251 return NO; 252 return NO;
252 } 253 }
253 } 254 }
254 255
255 @end 256 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698