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

Side by Side Diff: ios/showcase/payments/sc_payments_picker_coordinator.mm

Issue 2778343002: [Payment Request] Picker view + showcase integration + egtests (Closed)
Patch Set: Addressed comments Created 3 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/showcase/payments/sc_payments_picker_coordinator.h"
6
7 #import "ios/chrome/browser/payments/payment_request_picker_row.h"
8 #import "ios/chrome/browser/payments/payment_request_picker_view_controller.h"
9 #import "ios/showcase/common/protocol_alerter.h"
10
11 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support."
13 #endif
14
15 @interface SCPaymentsPickerCoordinator ()
16
17 @property(nonatomic, strong)
18 PaymentRequestPickerViewController* pickerViewController;
19 @property(nonatomic, strong) ProtocolAlerter* alerter;
20
21 @end
22
23 @implementation SCPaymentsPickerCoordinator
24
25 @synthesize baseViewController = _baseViewController;
26 @synthesize pickerViewController = _pickerViewController;
27 @synthesize alerter = _alerter;
28
29 - (void)start {
30 self.alerter = [[ProtocolAlerter alloc] initWithProtocols:@[
31 @protocol(PaymentRequestPickerViewControllerDelegate)
32 ]];
33 self.alerter.baseViewController = self.baseViewController;
34
35 NSArray<PickerRow*>* rows = [self rows];
36 _pickerViewController = [[PaymentRequestPickerViewController alloc]
37 initWithRows:rows
38 selected:rows[rows.count - 1]];
39 [_pickerViewController setTitle:@"Select a country"];
40 [_pickerViewController
41 setDelegate:reinterpret_cast<
42 id<PaymentRequestPickerViewControllerDelegate>>(
43 self.alerter)];
44
45 [self.baseViewController pushViewController:_pickerViewController
46 animated:YES];
47 }
48
49 #pragma mark - Helper methods
50
51 - (NSArray<PickerRow*>*)rows {
52 return @[
53 [[PickerRow alloc] initWithLabel:@"Chile" value:@"CHL"],
54 [[PickerRow alloc] initWithLabel:@"Canada" value:@"CAN"],
55 [[PickerRow alloc] initWithLabel:@"Belgium" value:@"BEL"],
56 [[PickerRow alloc] initWithLabel:@"España" value:@"ESP"],
57 [[PickerRow alloc] initWithLabel:@"México" value:@"MEX"],
58 [[PickerRow alloc] initWithLabel:@"Brazil" value:@"BRA"],
59 [[PickerRow alloc] initWithLabel:@"China" value:@"CHN"]
60 ];
61 }
62
63 @end
OLDNEW
« no previous file with comments | « ios/showcase/payments/sc_payments_picker_coordinator.h ('k') | ios/showcase/payments/sc_payments_picker_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698