This commit is contained in:
Suresh, Kamlesh 2020-03-10 15:25:49 -04:00
parent c1047d42b8
commit 7965c4ac6a
9 changed files with 23 additions and 191 deletions

View File

@ -10,7 +10,6 @@
01004F3022721C3800991ECC /* RadioButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01004F2F22721C3800991ECC /* RadioButton.swift */; };
0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */; };
0105618D224BBE7700E1557D /* FormValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618A224BBE7700E1557D /* FormValidator.swift */; };
0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */; };
0116A4E5228B19640094F3ED /* RadioButtonSelectionHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0116A4E4228B19640094F3ED /* RadioButtonSelectionHelper.swift */; };
011B58F023A2AA980085F53C /* ListItemModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011B58EF23A2AA980085F53C /* ListItemModelProtocol.swift */; };
011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011B58F123A2AE2C0085F53C /* DropDownListItemModel.swift */; };
@ -40,7 +39,6 @@
012A88DB238ED45900FE3DA1 /* CarouselModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88AE238C626E00FE3DA1 /* CarouselModel.swift */; };
012A88EC238F084D00FE3DA1 /* FooterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88EB238F084D00FE3DA1 /* FooterModel.swift */; };
012A88F123985E0100FE3DA1 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88F023985E0100FE3DA1 /* Color.swift */; };
012CA99A2384A687003F810F /* MFTextField+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA9992384A687003F810F /* MFTextField+ModelExtension.swift */; };
012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */; };
013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 013F801823FB4A8E00AD8013 /* UIContentMode+Extension.swift */; };
014AA72423C501E2006F3E93 /* MoleculeContainerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AA72123C501E2006F3E93 /* MoleculeContainerModel.swift */; };
@ -383,7 +381,6 @@
01004F2F22721C3800991ECC /* RadioButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButton.swift; sourceTree = "<group>"; };
0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyToggleModel.swift; sourceTree = "<group>"; };
0105618A224BBE7700E1557D /* FormValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidator.swift; sourceTree = "<group>"; };
0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+TextFields.swift"; sourceTree = "<group>"; };
0116A4E4228B19640094F3ED /* RadioButtonSelectionHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonSelectionHelper.swift; sourceTree = "<group>"; };
011B58EF23A2AA980085F53C /* ListItemModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListItemModelProtocol.swift; sourceTree = "<group>"; };
011B58F123A2AE2C0085F53C /* DropDownListItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropDownListItemModel.swift; sourceTree = "<group>"; };
@ -413,7 +410,6 @@
012A88C7238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelMoleculeDelegateProtocol.swift; sourceTree = "<group>"; };
012A88EB238F084D00FE3DA1 /* FooterModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterModel.swift; sourceTree = "<group>"; };
012A88F023985E0100FE3DA1 /* Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
012CA9992384A687003F810F /* MFTextField+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFTextField+ModelExtension.swift"; sourceTree = "<group>"; };
012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFView+ModelExtension.swift"; sourceTree = "<group>"; };
013F801823FB4A8E00AD8013 /* UIContentMode+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIContentMode+Extension.swift"; sourceTree = "<group>"; };
014AA72123C501E2006F3E93 /* MoleculeContainerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoleculeContainerModel.swift; sourceTree = "<group>"; };
@ -832,7 +828,6 @@
children = (
011D9583240422BF000E3791 /* New */,
0105618A224BBE7700E1557D /* FormValidator.swift */,
0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */,
);
path = FormUIHelpers;
sourceTree = "<group>";
@ -1457,7 +1452,6 @@
0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */,
0ABD1370237DB0450081388D /* ItemDropdownEntryField.swift */,
017BEB3F23620A230024EF95 /* TextFieldModel.swift */,
012CA9992384A687003F810F /* MFTextField+ModelExtension.swift */,
);
path = TextFields;
sourceTree = "<group>";
@ -1910,7 +1904,6 @@
D2D6CD4222E78FAB00D701B8 /* ThreeLayerTemplate.swift in Sources */,
01EB368F23609801006832FA /* LabelModel.swift in Sources */,
942C378E2412F5B60066E45E /* ModalMoleculeStackTemplate.swift in Sources */,
0105618F224BBE7700E1557D /* FormValidator+FormParams.swift in Sources */,
01F2A03223A4498200D954D8 /* CaretLinkModel.swift in Sources */,
0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */,
011B58F023A2AA980085F53C /* ListItemModelProtocol.swift in Sources */,
@ -1976,7 +1969,6 @@
D29DF17B21E69E1F003B2FB9 /* PrimaryButton.m in Sources */,
017BEB4A236235BA0024EF95 /* ModelMoleculeViewProtocol.swift in Sources */,
C695A68123C9830D00BFB94E /* NumberedListModel.swift in Sources */,
012CA99A2384A687003F810F /* MFTextField+ModelExtension.swift in Sources */,
01EB3684236097C0006832FA /* MoleculeModelProtocol.swift in Sources */,
D27CD4102339057800C1DC07 /* EyebrowHeadlineBodyLink.swift in Sources */,
D29DF11D21E684A9003B2FB9 /* MVMCoreUISplitViewController.m in Sources */,
@ -2028,7 +2020,6 @@
C7192E7D23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift in Sources */,
D29DF13221E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.m in Sources */,
D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */,
0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */,
0A7EF86323D8AFA000B2AAD1 /* BaseDropdownEntryFieldModel.swift in Sources */,
0A1214A022C11A18007C7030 /* ActionDetailWithImage.swift in Sources */,
D2B18B922361E65A00A9AEDC /* CoreUIObject.swift in Sources */,
@ -2056,7 +2047,6 @@
D29DF2CB21E7BFCC003B2FB9 /* MFSizeThreshold.m in Sources */,
011D959F240453A1000E3791 /* RuleAllValueChangedModel.swift in Sources */,
011D95AD2406BB57000E3791 /* FormHolderProtocol.swift in Sources */,
946EE1BA237B66D80036751F /* MoleculeModelHelper.swift in Sources */,
01509D932327ECFB00EF99AA /* ProgressBar.swift in Sources */,
D260106523D0CEA700764D80 /* StackModel.swift in Sources */,
D29770F521F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m in Sources */,

View File

@ -16,11 +16,6 @@ extension PrimaryButton: ModelMoleculeViewProtocol {
setTitle(model.title, for: .normal)
backgroundColor = model.backgroundColor?.uiColor
// if self.validationRequired,
// let selfForm = self as? FormValidationEnableDisableProtocol {
// FormValidator.setupValidation(molecule: selfForm, delegate: delegateObject?.formValidationProtocol)
// }
if let style = model.style {
switch style {
case .primary:

View File

@ -1,79 +0,0 @@
//
// MFTextField+ModelExtension.swift
// MVMCoreUI
//
// Created by Suresh, Kamlesh on 11/19/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
enum TextType: String {
case dropDown = "dropDown"
case password = "password"
case number = "number"
case email = "email"
}
extension MFTextField: ModelMoleculeViewProtocol {
//
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
// //TODO: Need to create setWithModel in ViewConstraining View
// #warning("This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.")
// //TODO: This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.
// setUpDefaultWithModel(model, delegateObject, additionalData)
//
// guard let textFieldModel = model as? TextFieldModel,
// let delegateObject = delegateObject else {
// return
// }
//
// if let delegate = delegateObject.formValidationProtocol {
// let formValidator = FormValidator.getFormValidatorFor(delegate: delegate)
// mfTextFieldDelegate = formValidator
// uiTextFieldDelegate = delegateObject.uiTextFieldDelegate
// if let textField = textField {
// MVMCoreUICommonViewsUtility.addDismissToolbar(textField, delegate: uiTextFieldDelegate)
// }
// }
//
// formText = textFieldModel.label as NSString?
// text = textFieldModel.value as NSString?
// if let disabled = textFieldModel.disabled {
// enable(disabled)
// }
// errMessage = textFieldModel.errorMsg
// fieldKey = textFieldModel.fieldKey
// groupName = textFieldModel.groupName
//
//
// switch textFieldModel.type {
// case TextType.dropDown.rawValue:
// dropDownCarrotLabel?.isHidden = true
// hasDropDown = true
// break
// case TextType.password.rawValue:
// textField?.isSecureTextEntry = true
// break
// case TextType.number.rawValue:
// textField?.keyboardType = .numberPad
// break
// case TextType.email.rawValue:
// textField?.keyboardType = .emailAddress
// break
// default:
// print("default")
// }
//
// if let regex = textFieldModel.regex {
// validationBlock = {(enteredValue: String?) -> Bool in
// if let enteredValue = enteredValue {
// return MVMCoreUIUtility.validate(enteredValue, withRegularExpression: regex)
// }
// return true
// }
// } else {
// setDefaultValidationBlock()
// }
}
}

View File

@ -97,25 +97,25 @@ import MVMCore
return MVMCoreUIUtility.validateInternationalMDNString(MDN)
}
@objc public override func validateTextField() {
@objc public func validateMDNTextField() -> Bool {
// guard !shouldValidateMDN, let MDN = mdn, !MDN.isEmpty else {
// isValid = true
// return true
// }
//
// let isValid = hasValidMDN()
//
// if isValid {
// showError = false
//
// } else {
// errorMessage = errorMessage ?? MVMCoreUIUtility.hardcodedString(withKey: "textfield_phone_format_error_message")
// showError = true
// UIAccessibility.post(notification: .layoutChanged, argument: textField)
// }
//
// return isValid
guard !shouldValidateMDN, let MDN = mdn, !MDN.isEmpty else {
isValid = true
return true
}
let isValid = hasValidMDN()
if isValid {
showError = false
} else {
errorMessage = errorMessage ?? MVMCoreUIUtility.hardcodedString(withKey: "textfield_phone_format_error_message")
showError = true
UIAccessibility.post(notification: .layoutChanged, argument: textField)
}
return isValid
}
@objc public func getContacts(_ sender: Any?) {
@ -186,9 +186,9 @@ import MVMCore
proprietorTextDelegate?.textFieldDidEndEditing?(textField)
// if validateTextField() && isNationalMDN {
// textField.text = MVMCoreUIUtility.formatMdn(textField.text)
// }
if validateMDNTextField() && isNationalMDN {
textField.text = MVMCoreUIUtility.formatMdn(textField.text)
}
}
@objc public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {

View File

@ -1,69 +0,0 @@
//
// MVMCoreUIFormValidator+TextFields.swift
// MVMCoreUI
//
// Created by Suresh, Kamlesh on 3/21/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import Foundation
//@objc extension FormValidator: MFTextFieldDelegate {
//
// public func dismissFieldInput(_ sender: Any?) {
//
// if let delegate = delegate as? MFTextFieldDelegate {
// delegate.dismissFieldInput?(sender)
// }
// }
//
// public func entryIsValid(_ textfield: MFTextField?) {
//
// MVMCoreDispatchUtility.performBlock(onMainThread: {
// self.enableByValidation()
// if let delegate = self.delegate as? MFTextFieldDelegate {
// delegate.entryIsValid?(textfield)
// }
// })
// }
//
// public func entryIsInvalid(_ textfield: MFTextField?) {
//
// MVMCoreDispatchUtility.performBlock(onMainThread: {
// self.enableByValidation()
// if let delegate = self.delegate as? MFTextFieldDelegate {
// delegate.entryIsInvalid?(textfield)
// }
// })
// }
//}
//
// Temporary: Looking to either combine or separate entirely with MFTextFieldDelegate.
//extension FormValidator: ObservingTextFieldDelegate {
//
// public func dismissField(_ sender: Any?) {
// if let delegate = delegate as? MFTextFieldDelegate {
// delegate.dismissFieldInput?(sender)
// }
// }
//
// @nonobjc public func isValid(_ textfield: MFTextField?) {
//
// MVMCoreDispatchUtility.performBlock(onMainThread: {
// self.enableByValidation()
// if let delegate = self.delegate as? MFTextFieldDelegate {
// delegate.entryIsValid?(textfield)
// }
// })
// }
//
// public func isInvalid(_ textfield: MFTextField?) {
//
// MVMCoreDispatchUtility.performBlock(onMainThread: {
// self.enableByValidation()
// if let delegate = self.delegate as? MFTextFieldDelegate {
// delegate.entryIsInvalid?(textfield)
// }
// })
// }
//}

View File

@ -59,9 +59,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
}
- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
// [FormValidator setupValidationWithMolecule:self delegate:delegateObject.formValidationProtocol];
self.delegateObject = delegateObject;
self.fieldKey = [json stringForKey:KeyFieldKey];
self.isRequired = [json boolForKey:KeyRequired];

View File

@ -147,8 +147,6 @@ const CGFloat SwitchShakeIntensity = 2;
self.json = json;
self.delegate = delegateObject;
// [FormValidator setupValidationWithMolecule:self delegate:delegateObject.formValidationProtocol];
NSString *color = [json string:@"onTintColor"];
if (color) {
self.onTintColor = [UIColor mfGetColorForHex:color];

View File

@ -671,7 +671,6 @@
self.validationRequired = [json boolForKey:@"required"];
self.requiredGroupsList = [json array:@"requiredGroups"];
// [FormValidator setupValidationWithMolecule:self delegate:delegateObject.formValidationProtocol];
self.primaryButtonType = PrimaryButtonTypeCustom;
NSString *style = [json string:@"style"];

View File

@ -15,7 +15,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
public var formValidator: FormValidator?
public func validate() {
// Can override
}
public var moleculesInfo: [(identifier: String, class: AnyClass, molecule: (ListItemModelProtocol & MoleculeModelProtocol))]?