OLD | NEW |
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/showcase/payments/sc_payments_picker_coordinator.h" | 5 #import "ios/showcase/payments/sc_payments_picker_coordinator.h" |
6 | 6 |
7 #import "ios/chrome/browser/ui/payments/payment_request_picker_row.h" | 7 #import "ios/chrome/browser/ui/payments/payment_request_picker_row.h" |
8 #import "ios/chrome/browser/ui/payments/payment_request_picker_view_controller.h
" | 8 #import "ios/chrome/browser/ui/payments/payment_request_picker_view_controller.h
" |
9 #import "ios/showcase/common/protocol_alerter.h" | 9 #import "ios/showcase/common/protocol_alerter.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 @protocol(PaymentRequestPickerViewControllerDelegate) | 31 @protocol(PaymentRequestPickerViewControllerDelegate) |
32 ]]; | 32 ]]; |
33 self.alerter.baseViewController = self.baseViewController; | 33 self.alerter.baseViewController = self.baseViewController; |
34 | 34 |
35 NSArray<PickerRow*>* rows = [self rows]; | 35 NSArray<PickerRow*>* rows = [self rows]; |
36 _pickerViewController = [[PaymentRequestPickerViewController alloc] | 36 _pickerViewController = [[PaymentRequestPickerViewController alloc] |
37 initWithRows:rows | 37 initWithRows:rows |
38 selected:rows[rows.count - 1]]; | 38 selected:rows[rows.count - 1]]; |
39 [_pickerViewController setTitle:@"Select a country"]; | 39 [_pickerViewController setTitle:@"Select a country"]; |
40 [_pickerViewController | 40 [_pickerViewController |
41 setDelegate:reinterpret_cast< | 41 setDelegate:static_cast<id<PaymentRequestPickerViewControllerDelegate>>( |
42 id<PaymentRequestPickerViewControllerDelegate>>( | |
43 self.alerter)]; | 42 self.alerter)]; |
44 | 43 |
45 [self.baseViewController pushViewController:_pickerViewController | 44 [self.baseViewController pushViewController:_pickerViewController |
46 animated:YES]; | 45 animated:YES]; |
47 } | 46 } |
48 | 47 |
49 #pragma mark - Helper methods | 48 #pragma mark - Helper methods |
50 | 49 |
51 - (NSArray<PickerRow*>*)rows { | 50 - (NSArray<PickerRow*>*)rows { |
52 return @[ | 51 return @[ |
53 [[PickerRow alloc] initWithLabel:@"Chile" value:@"CHL"], | 52 [[PickerRow alloc] initWithLabel:@"Chile" value:@"CHL"], |
54 [[PickerRow alloc] initWithLabel:@"Canada" value:@"CAN"], | 53 [[PickerRow alloc] initWithLabel:@"Canada" value:@"CAN"], |
55 [[PickerRow alloc] initWithLabel:@"Belgium" value:@"BEL"], | 54 [[PickerRow alloc] initWithLabel:@"Belgium" value:@"BEL"], |
56 [[PickerRow alloc] initWithLabel:@"España" value:@"ESP"], | 55 [[PickerRow alloc] initWithLabel:@"España" value:@"ESP"], |
57 [[PickerRow alloc] initWithLabel:@"México" value:@"MEX"], | 56 [[PickerRow alloc] initWithLabel:@"México" value:@"MEX"], |
58 [[PickerRow alloc] initWithLabel:@"Brazil" value:@"BRA"], | 57 [[PickerRow alloc] initWithLabel:@"Brazil" value:@"BRA"], |
59 [[PickerRow alloc] initWithLabel:@"China" value:@"CHN"] | 58 [[PickerRow alloc] initWithLabel:@"China" value:@"CHN"] |
60 ]; | 59 ]; |
61 } | 60 } |
62 | 61 |
63 @end | 62 @end |
OLD | NEW |