merge develop
This commit is contained in:
commit
2c04e6521e
@ -11,6 +11,8 @@
|
||||
D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */; };
|
||||
D28B4F8A21FF967C00712C7A /* MVMCoreUIObject.h in Headers */ = {isa = PBXBuildFile; fileRef = D28B4F8821FF967C00712C7A /* MVMCoreUIObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D28B4F8B21FF967C00712C7A /* MVMCoreUIObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D28B4F8921FF967C00712C7A /* MVMCoreUIObject.m */; };
|
||||
01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */; };
|
||||
01DF567021FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01DF566F21FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift */; };
|
||||
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */; };
|
||||
D29770C921F7C4AE00B2F0D0 /* TopLabelsView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770EE21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m */; };
|
||||
@ -150,6 +152,8 @@
|
||||
D206997621FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUINavigationControllerViewController.m; sourceTree = "<group>"; };
|
||||
D28B4F8821FF967C00712C7A /* MVMCoreUIObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIObject.h; sourceTree = "<group>"; };
|
||||
D28B4F8921FF967C00712C7A /* MVMCoreUIObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIObject.m; sourceTree = "<group>"; };
|
||||
01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MFTextFieldListView.swift; sourceTree = "<group>"; };
|
||||
01DF566F21FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MVMCoreUITextFieldListFormViewController.swift; sourceTree = "<group>"; };
|
||||
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = "<group>"; };
|
||||
D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsView.h; sourceTree = "<group>"; };
|
||||
D29770EE21F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsAndBottomButtonsTableViewController.m; sourceTree = "<group>"; };
|
||||
@ -341,6 +345,7 @@
|
||||
D29DF0DF21E418B2003B2FB9 /* Templates */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
01DF566F21FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift */,
|
||||
D29DF0E021E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.h */,
|
||||
D29DF0E121E4F3B6003B2FB9 /* MVMCoreUILargeHeaderSingleLabelTemplate.m */,
|
||||
);
|
||||
@ -369,6 +374,7 @@
|
||||
D29DF10E21E67A77003B2FB9 /* Molecules */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
01DF55DF21F8FAA800CC099B /* MFTextFieldListView.swift */,
|
||||
D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */,
|
||||
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */,
|
||||
D29770F621F7C73800B2F0D0 /* PrimaryButtonView.h */,
|
||||
@ -805,6 +811,7 @@
|
||||
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */,
|
||||
D29DF12E21E6851E003B2FB9 /* MVMCoreUITopAlertView.m in Sources */,
|
||||
D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */,
|
||||
01DF567021FA5AB300CC099B /* MVMCoreUITextFieldListFormViewController.swift in Sources */,
|
||||
D29DF27621E79E81003B2FB9 /* MVMCoreUILoggingHandler.m in Sources */,
|
||||
D29DF24D21E6A177003B2FB9 /* MFTextField.m in Sources */,
|
||||
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
|
||||
@ -825,6 +832,7 @@
|
||||
D29DF28A21E7AC2B003B2FB9 /* MFLabel.m in Sources */,
|
||||
D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationControllerViewController.m in Sources */,
|
||||
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */,
|
||||
01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */,
|
||||
D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */,
|
||||
D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */,
|
||||
D29DF2A521E7B2A0003B2FB9 /* MFCaretView.m in Sources */,
|
||||
|
||||
123
MVMCoreUI/Molecules/MFTextFieldListView.swift
Normal file
123
MVMCoreUI/Molecules/MFTextFieldListView.swift
Normal file
@ -0,0 +1,123 @@
|
||||
//
|
||||
// MFTextFieldListView.swift
|
||||
// MobileFirstFramework
|
||||
//
|
||||
// Created by Suresh, Kamlesh on 9/21/18.
|
||||
// Copyright © 2018 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MVMCore
|
||||
|
||||
|
||||
public class MFTextFieldListView: MFView {
|
||||
|
||||
public var textFieldMapList: [[String: Any]]?
|
||||
public var parentViewContoller: MFViewController?
|
||||
public var textFieldsToValidate: [MFTextField] = []
|
||||
public var textFields: [MFTextField] = []
|
||||
public var primaryButton: PrimaryButton?
|
||||
|
||||
public init(textFieldMapList: [[String: Any]], parentViewContoller: MFViewController, primaryButton: PrimaryButton?) {
|
||||
self.textFieldMapList = textFieldMapList
|
||||
self.parentViewContoller = parentViewContoller
|
||||
self.primaryButton = primaryButton
|
||||
super.init(frame: .zero)
|
||||
}
|
||||
|
||||
public required init?(coder decoder: NSCoder) {
|
||||
super.init(coder: decoder)
|
||||
}
|
||||
|
||||
public override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
for textField in textFields {
|
||||
textField.updateView(size)
|
||||
}
|
||||
}
|
||||
|
||||
public override func setupView() {
|
||||
super.setupView()
|
||||
self.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
guard let textFieldMapList = textFieldMapList else {
|
||||
return
|
||||
}
|
||||
var viewList: [UIView] = []
|
||||
|
||||
for textFieldMap in textFieldMapList {
|
||||
if let textField = MFTextField(map: textFieldMap, bothDelegates: self) {
|
||||
|
||||
if textFieldMap.boolForKey("required") {
|
||||
textFieldsToValidate.append(textField)
|
||||
}
|
||||
|
||||
textFields.append(textField)
|
||||
if let fieldKey = textField.fieldKey {
|
||||
parentViewContoller?.register(textField, forErrorKey: fieldKey as String)
|
||||
}
|
||||
viewList.append(textField)
|
||||
}
|
||||
}
|
||||
|
||||
StackableViewController.populateView(self, withUIArray: viewList) { (viewObject) -> UIEdgeInsets in
|
||||
var edgeInsets = StackableViewController.standardSpaceAroundUIObject()
|
||||
edgeInsets.left = 0
|
||||
edgeInsets.right = 0
|
||||
edgeInsets.top = 0
|
||||
return edgeInsets
|
||||
}
|
||||
|
||||
primaryButton?.handleEnabling(with: textFieldsToValidate)
|
||||
}
|
||||
|
||||
public func addParams(requestParameters: MVMCoreRequestParameters) {
|
||||
requestParameters.add(getTextParamsList())
|
||||
}
|
||||
|
||||
public func getTextParamsList() -> [String: Any] {
|
||||
var extraParam: [String: Any] = [:]
|
||||
for textField in textFields {
|
||||
if let fieldKey = textField.fieldKey {
|
||||
extraParam[fieldKey as String] = textField.text ?? ""
|
||||
}
|
||||
}
|
||||
return extraParam
|
||||
}
|
||||
}
|
||||
|
||||
extension MFTextFieldListView: UITextFieldDelegate, UITextViewDelegate, MFTextFieldDelegate {
|
||||
@objc open func textFieldDidEndEditing(_ textField: UITextField) {
|
||||
parentViewContoller?.textFieldDidEndEditing(textField)
|
||||
primaryButton?.handleEnabling(with: textFieldsToValidate)
|
||||
}
|
||||
|
||||
@objc open func dismissFieldInput(_ sender: Any?) {
|
||||
parentViewContoller?.dismissFieldInput(sender)
|
||||
}
|
||||
|
||||
@objc open func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||
textField.resignFirstResponder()
|
||||
return true
|
||||
}
|
||||
|
||||
@objc open func textFieldDidBeginEditing(_ textField: UITextField) {
|
||||
parentViewContoller?.textFieldDidBeginEditing(textField)
|
||||
}
|
||||
|
||||
@objc open func entryIsValid(_ textfield: MFTextField?) {
|
||||
DispatchQueue.main.async {
|
||||
if self.parentViewContoller?.responds(to: #selector(MFTextFieldDelegate.entryIsValid(_:))) ?? false {
|
||||
self.parentViewContoller?.entryIsValid(textfield)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc open func entryIsInvalid(_ textfield: MFTextField?) {
|
||||
DispatchQueue.main.async {
|
||||
if self.parentViewContoller?.responds(to: #selector(MFTextFieldDelegate.entryIsInvalid(_:))) ?? false {
|
||||
self.parentViewContoller?.entryIsInvalid(textfield)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,7 @@
|
||||
#import "MVMCoreUIViewControllerMappingObject.h"
|
||||
#import <MVMCore/MVMCoreViewControllerProgrammaticMappingObject.h>
|
||||
#import "MVMCoreUILargeHeaderSingleLabelTemplate.h"
|
||||
#import <MVMCoreUI/MVMCoreUI-Swift.h>
|
||||
|
||||
@implementation MVMCoreUIViewControllerMappingObject
|
||||
|
||||
@ -18,7 +19,10 @@
|
||||
static dispatch_once_t onceToken;
|
||||
static NSMutableDictionary *viewControllerMapping;
|
||||
dispatch_once(&onceToken, ^{
|
||||
viewControllerMapping = [@{ @"LargeHeaderSingleLabel": [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MVMCoreUILargeHeaderSingleLabelTemplate class]]} mutableCopy];
|
||||
viewControllerMapping = [@{
|
||||
@"LargeHeaderSingleLabel": [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MVMCoreUILargeHeaderSingleLabelTemplate class]],
|
||||
@"TextFieldListForm" : [[MVMCoreViewControllerProgrammaticMappingObject alloc] initWithClass:[MVMCoreUITextFieldListFormViewController class]]
|
||||
} mutableCopy];
|
||||
});
|
||||
return viewControllerMapping;
|
||||
}
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
//
|
||||
// MVMCoreUITextFormViewController.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Suresh, Kamlesh on 1/24/19.
|
||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class MVMCoreUITextFieldListFormViewController: TopLabelsAndBottomButtonsViewController {
|
||||
|
||||
|
||||
public var textFieldListView: MFTextFieldListView?
|
||||
|
||||
public override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
public override func updateViews() {
|
||||
super.updateViews()
|
||||
}
|
||||
|
||||
public override func newDataBuildScreen() {
|
||||
super.newDataBuildScreen()
|
||||
topLabelsView?.separatorView?.isHidden = true
|
||||
}
|
||||
|
||||
public override func buildViewsBetweenLabelsAndButtons() -> [UIView]? {
|
||||
var viewList: [UIView] = []
|
||||
|
||||
if let textFieldsList = loadObject?.pageJSON?.arrayForKey("textFieldList") as? [[String: Any]] {
|
||||
let textFieldListView = MFTextFieldListView(textFieldMapList: textFieldsList,
|
||||
parentViewContoller: self,
|
||||
primaryButton: self.primaryButton)
|
||||
self.textFieldListView = textFieldListView
|
||||
viewList.append(textFieldListView)
|
||||
}
|
||||
return viewList
|
||||
}
|
||||
|
||||
public override func handleOpenPage(for requestParameters: MVMCoreRequestParameters, actionInformation: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?) {
|
||||
textFieldListView?.addParams(requestParameters: requestParameters)
|
||||
super.handleOpenPage(for: requestParameters, actionInformation: actionInformation, additionalData: additionalData)
|
||||
}
|
||||
|
||||
public override func spaceAboveBetweenView() -> NSNumber? {
|
||||
return PaddingFour as NSNumber
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user