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

Unified Diff: ios/showcase/payments/sc_payments_editor_coordinator.mm

Issue 2744823003: [Payment Request] Generic edit form (Closed)
Patch Set: rebase Created 3 years, 9 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
« no previous file with comments | « ios/showcase/payments/sc_payments_editor_coordinator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/showcase/payments/sc_payments_editor_coordinator.mm
diff --git a/ios/showcase/payments/sc_payments_editor_coordinator.mm b/ios/showcase/payments/sc_payments_editor_coordinator.mm
new file mode 100644
index 0000000000000000000000000000000000000000..28500199345056d52a1909b88d47e501a309ee7f
--- /dev/null
+++ b/ios/showcase/payments/sc_payments_editor_coordinator.mm
@@ -0,0 +1,75 @@
+// 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_editor_coordinator.h"
+
+#import "base/mac/foundation_util.h"
+#include "base/strings/utf_string_conversions.h"
+#import "ios/chrome/browser/payments/cells/payments_text_item.h"
+#import "ios/chrome/browser/payments/payment_request_edit_view_controller.h"
+#import "ios/chrome/browser/payments/payment_request_editor_field.h"
+#import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h"
+#import "ios/chrome/browser/ui/settings/cells/autofill_edit_item.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@interface SCPaymentsEditorCoordinator ()<
+ PaymentRequestEditViewControllerDelegate> {
+ PaymentRequestEditViewController* _paymentRequestEditViewController;
+}
+@end
+
+@implementation SCPaymentsEditorCoordinator
+
+@synthesize baseViewController = _baseViewController;
+
+- (void)start {
+ NSArray<EditorField*>* editorFields = [self editorFields];
+ _paymentRequestEditViewController = [[PaymentRequestEditViewController alloc]
+ initWithEditorFields:editorFields];
+ [_paymentRequestEditViewController setTitle:@"Add info"];
+ [_paymentRequestEditViewController setEditorDelegate:self];
+ [_paymentRequestEditViewController loadModel];
+ [self.baseViewController pushViewController:_paymentRequestEditViewController
+ animated:YES];
+}
+
+#pragma mark - PaymentRequestEditViewControllerDelegate
+
+- (void)paymentRequestEditViewController:
+ (PaymentRequestEditViewController*)controller
+ didFinishEditingFields:(NSArray<EditorField*>*)fields {
+ [self.baseViewController popViewControllerAnimated:YES];
+}
+
+- (void)paymentRequestEditViewControllerDidReturn:
+ (PaymentRequestEditViewController*)controller {
+ [self.baseViewController popViewControllerAnimated:YES];
+}
+
+#pragma mark - Helper methods
+
+- (NSArray<EditorField*>*)editorFields {
+ return @[
+ [[EditorField alloc]
+ initWithAutofillType:static_cast<NSInteger>(autofill::UNKNOWN_TYPE)
+ label:@"Name"
+ value:@"John Doe"
+ required:YES],
+ [[EditorField alloc]
+ initWithAutofillType:static_cast<NSInteger>(autofill::UNKNOWN_TYPE)
+ label:@"Address"
+ value:@""
+ required:YES],
+ [[EditorField alloc]
+ initWithAutofillType:static_cast<NSInteger>(autofill::UNKNOWN_TYPE)
+ label:@"Postal Code"
+ value:@""
+ required:NO]
+ ];
+}
+
+@end
« no previous file with comments | « ios/showcase/payments/sc_payments_editor_coordinator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698