| 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
|
|
|