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

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

Issue 2778343002: [Payment Request] Picker view + showcase integration + egtests (Closed)
Patch Set: Initial 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
10 #if !defined(__has_feature) || !__has_feature(objc_arc)
11 #error "This file requires ARC support."
12 #endif
13
14 @interface SCPaymentsPickerCoordinator ()<
15 PaymentRequestPickerViewControllerDelegate>
16
17 @property(nonatomic, strong)
18 PaymentRequestPickerViewController* pickerViewController;
19
20 @end
21
22 @implementation SCPaymentsPickerCoordinator
23
24 @synthesize baseViewController = _baseViewController;
25 @synthesize pickerViewController = _pickerViewController;
26
27 - (void)start {
28 NSArray<PickerRow*>* rows = [self rows];
29 _pickerViewController = [[PaymentRequestPickerViewController alloc]
30 initWithRows:rows
31 selected:rows[rows.count - 1]];
32 [_pickerViewController setTitle:@"Select a country"];
33 [_pickerViewController setDelegate:self];
34 [self.baseViewController pushViewController:_pickerViewController
35 animated:YES];
36 }
37
38 #pragma mark - PaymentRequestPickerViewControllerDelegate
39
40 - (void)paymentRequestPickerViewController:
41 (PaymentRequestPickerViewController*)controller
42 didSelectRow:(PickerRow*)row {
lpromero 2017/03/29 11:38:15 You can use the ProtocolAlerter to trigger an aler
Moe 2017/03/29 17:04:09 Done.
43 }
44
45 #pragma mark - Helper methods
46
47 - (NSArray<PickerRow*>*)rows {
48 return @[
49 [[PickerRow alloc] initWithLabel:@"Chile" value:@"CHL"],
50 [[PickerRow alloc] initWithLabel:@"Canada" value:@"CAN"],
51 [[PickerRow alloc] initWithLabel:@"Belgium" value:@"BEL"],
52 [[PickerRow alloc] initWithLabel:@"España" value:@"ESP"],
53 [[PickerRow alloc] initWithLabel:@"México" value:@"MEX"],
54 [[PickerRow alloc] initWithLabel:@"Brazil" value:@"BRA"],
55 [[PickerRow alloc] initWithLabel:@"China" value:@"CHN"]
56 ];
57 }
58
59 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698