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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ios/showcase/payments/sc_payments_picker_coordinator.mm
diff --git a/ios/showcase/payments/sc_payments_picker_coordinator.mm b/ios/showcase/payments/sc_payments_picker_coordinator.mm
new file mode 100644
index 0000000000000000000000000000000000000000..26256b5c907c3e65056d50297b2c43bf4aa3e26a
--- /dev/null
+++ b/ios/showcase/payments/sc_payments_picker_coordinator.mm
@@ -0,0 +1,63 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/showcase/payments/sc_payments_picker_coordinator.h"
+
+#import "ios/chrome/browser/payments/payment_request_picker_row.h"
+#import "ios/chrome/browser/payments/payment_request_picker_view_controller.h"
+#import "ios/showcase/common/protocol_alerter.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@interface SCPaymentsPickerCoordinator ()
+
+@property(nonatomic, strong)
+ PaymentRequestPickerViewController* pickerViewController;
+@property(nonatomic, strong) ProtocolAlerter* alerter;
+
+@end
+
+@implementation SCPaymentsPickerCoordinator
+
+@synthesize baseViewController = _baseViewController;
+@synthesize pickerViewController = _pickerViewController;
+@synthesize alerter = _alerter;
+
+- (void)start {
+ self.alerter = [[ProtocolAlerter alloc] initWithProtocols:@[
+ @protocol(PaymentRequestPickerViewControllerDelegate)
+ ]];
+ self.alerter.baseViewController = self.baseViewController;
+
+ NSArray<PickerRow*>* rows = [self rows];
+ _pickerViewController = [[PaymentRequestPickerViewController alloc]
+ initWithRows:rows
+ selected:rows[rows.count - 1]];
+ [_pickerViewController setTitle:@"Select a country"];
+ [_pickerViewController
+ setDelegate:reinterpret_cast<
+ id<PaymentRequestPickerViewControllerDelegate>>(
+ self.alerter)];
+
+ [self.baseViewController pushViewController:_pickerViewController
+ animated:YES];
+}
+
+#pragma mark - Helper methods
+
+- (NSArray<PickerRow*>*)rows {
+ return @[
+ [[PickerRow alloc] initWithLabel:@"Chile" value:@"CHL"],
+ [[PickerRow alloc] initWithLabel:@"Canada" value:@"CAN"],
+ [[PickerRow alloc] initWithLabel:@"Belgium" value:@"BEL"],
+ [[PickerRow alloc] initWithLabel:@"España" value:@"ESP"],
+ [[PickerRow alloc] initWithLabel:@"México" value:@"MEX"],
+ [[PickerRow alloc] initWithLabel:@"Brazil" value:@"BRA"],
+ [[PickerRow alloc] initWithLabel:@"China" value:@"CHN"]
+ ];
+}
+
+@end
« 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