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

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

Issue 2744823003: [Payment Request] Generic edit form (Closed)
Patch Set: Addressed comments 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
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..304e27661335f09f9e05100f20625cbb15f3b92c
--- /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/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
+
+namespace {
+
+typedef NS_ENUM(NSInteger, SectionIdentifier) {
+ SectionIdentifierName = kSectionIdentifierEnumZero,
+ SectionIdentifierAddress,
+ SectionIdentifierPostalCode,
+};
+
+typedef NS_ENUM(NSInteger, ItemType) {
+ ItemTypeName = kItemTypeEnumZero,
+ ItemTypeAddress,
+ ItemTypePostalCode,
+};
+
+} // namespace
+
+@interface ConcreteEditViewController : PaymentRequestEditViewController
+
+- (instancetype)init;
+
+@end
+
+@implementation ConcreteEditViewController
+
+#pragma mark - Initialization
+
+- (instancetype)init {
+ self = [super init];
+ if (self) {
+ [self setTitle:@"Add info"];
+ }
+ return self;
+}
+
+- (std::vector<EditorField>)editorFields {
+ return std::vector<EditorField>{
+ {autofill::UNKNOWN_TYPE, base::UTF8ToUTF16("Name"),
+ /* required= */ true, ItemTypeName, SectionIdentifierName},
+ {autofill::UNKNOWN_TYPE, base::UTF8ToUTF16("Address"),
+ /* required= */ true, ItemTypeAddress, SectionIdentifierAddress},
+ {autofill::UNKNOWN_TYPE, base::UTF8ToUTF16("Postal Code"),
+ /* required= */ false, ItemTypePostalCode, SectionIdentifierPostalCode}};
+}
+
+@end
+
+@implementation SCPaymentsEditorCoordinator
+@synthesize baseViewController = _baseViewController;
+
+- (void)start {
+ ConcreteEditViewController* concreteEditViewController =
+ [[ConcreteEditViewController alloc] init];
+ [concreteEditViewController loadModel];
+ [self.baseViewController pushViewController:concreteEditViewController
+ animated:YES];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698