changes to test

This commit is contained in:
Pfeil, Scott Robert 2019-10-23 10:36:32 -04:00
parent 5ee34fb027
commit 7563269680
6 changed files with 160 additions and 42 deletions

View File

@ -182,6 +182,8 @@
D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A638FC22CA98280052ED1F /* HeadlineBody.swift */; };
D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A6390022CBB1820052ED1F /* Carousel.swift */; };
D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */; };
D2B18B7F2360913400A9AEDC /* Control.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2B18B7E2360913400A9AEDC /* Control.swift */; };
D2B18B812360945C00A9AEDC /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2B18B802360945C00A9AEDC /* View.swift */; };
D2B1E3E522F37D6A0065F95C /* ImageHeadlineBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2B1E3E422F37D6A0065F95C /* ImageHeadlineBody.swift */; };
D2C5001821F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h in Headers */ = {isa = PBXBuildFile; fileRef = D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */; };
@ -377,6 +379,8 @@
D2A638FC22CA98280052ED1F /* HeadlineBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBody.swift; sourceTree = "<group>"; };
D2A6390022CBB1820052ED1F /* Carousel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Carousel.swift; sourceTree = "<group>"; };
D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeCollectionViewCell.swift; sourceTree = "<group>"; };
D2B18B7E2360913400A9AEDC /* Control.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Control.swift; sourceTree = "<group>"; };
D2B18B802360945C00A9AEDC /* View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = "<group>"; };
D2B1E3E422F37D6A0065F95C /* ImageHeadlineBody.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageHeadlineBody.swift; sourceTree = "<group>"; };
D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewControllerMappingObject.h; sourceTree = "<group>"; };
D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIViewControllerMappingObject.m; sourceTree = "<group>"; };
@ -508,6 +512,7 @@
D29DF0CE21E404D4003B2FB9 /* MVMCoreUI */ = {
isa = PBXGroup;
children = (
D2B18B7D236090D500A9AEDC /* BaseClasses */,
01C74D87224298E2009C25A3 /* FormUIHelpers */,
D29DF31421ECECA7003B2FB9 /* SupportingFiles */,
D29DF27021E79B2C003B2FB9 /* OtherHandlers */,
@ -574,7 +579,6 @@
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */,
D2A514662213885800345BFB /* StandardHeaderView.swift */,
D274CA322236A78900B01B62 /* StandardFooterView.swift */,
01004F2F22721C3800991ECC /* RadioButton.swift */,
01FC09E2235E246D003AC9B3 /* RadioButtonWithLabel.swift */,
0116A4E4228B19640094F3ED /* RadioButtonModel.swift */,
D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */,
@ -740,6 +744,7 @@
0198F7A22256A80A0066C936 /* MFRadioButton.m */,
0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */,
0A7BAFA2232BE63400FB8E22 /* CheckboxWithLabelView.swift */,
01004F2F22721C3800991ECC /* RadioButton.swift */,
);
path = Views;
sourceTree = "<group>";
@ -858,6 +863,15 @@
path = Strings;
sourceTree = "<group>";
};
D2B18B7D236090D500A9AEDC /* BaseClasses */ = {
isa = PBXGroup;
children = (
D2B18B7E2360913400A9AEDC /* Control.swift */,
D2B18B802360945C00A9AEDC /* View.swift */,
);
path = BaseClasses;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -1033,6 +1047,7 @@
D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */,
D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */,
D29DF25321E6A177003B2FB9 /* MFDigitTextField.m in Sources */,
D2B18B7F2360913400A9AEDC /* Control.swift in Sources */,
D29DF12F21E6851E003B2FB9 /* MVMCoreUITopAlertMainView.m in Sources */,
DBC4392122491730001AB423 /* LabelWithInternalButton.swift in Sources */,
D224798C231450C8003FCCF9 /* HeadlineBodySwitch.swift in Sources */,
@ -1059,6 +1074,7 @@
D28B4F8B21FF967C00712C7A /* MVMCoreUIObject.m in Sources */,
0A1B4A96233BB18F005B3FB4 /* CheckboxWithLabelView.swift in Sources */,
D260D7B222D65BDD007E7233 /* MVMCoreUIPageControl.m in Sources */,
D2B18B812360945C00A9AEDC /* View.swift in Sources */,
D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */,
D29DF2EF21ECEAE1003B2FB9 /* MFFonts.m in Sources */,
D22479942316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift in Sources */,

View File

@ -8,9 +8,12 @@
import UIKit
@objcMembers open class RadioButton: ViewConstrainingView, FormValidationFormFieldProtocol {
@objcMembers public class RadioButton: Control, FormValidationFormFieldProtocol {
var diameter = 30
var enabledColor = UIColor.black
var disabledColor = UIColor.mfSilver()
public let radioButton = MFRadioButton()
var delegateObject: MVMCoreUIDelegateObject?
var fieldKey: String?
@ -32,50 +35,25 @@ import UIKit
}
}()
open override func draw(_ rect: CGRect) {
guard let context = UIGraphicsGetCurrentContext() else { return }
context.addEllipse(in: CGRect(x: bounds.width*0.2, y: bounds.height*0.2, width: bounds.width*0.6, height: bounds.height*0.6))
context.setFillColor(isUserInteractionEnabled ? enabledColor.cgColor : disabledColor.cgColor)
context.fillPath()
}
// MARK: - Inits
public init() {
super.init(frame: .zero)
}
public override init(frame: CGRect) {
super.init(frame: frame)
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
open override func setupView() {
super.setupView()
guard subviews.count == 0 else {
return
}
translatesAutoresizingMaskIntoConstraints = false
radioButton.translatesAutoresizingMaskIntoConstraints = false
addSubview(radioButton)
isAccessibilityElement = true
accessibilityTraits = .none
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
NSLayoutConstraint.constraintPinSubview(toSuperview: radioButton)
radioButton.performActionForCheck = { [weak self] in
self?.tapAction()
}
}
func tapAction() {
if let radioButtonModel = radioButtonModel {
radioButtonModel.selected(self)
} else {
radioButton.isSelected = !radioButton.isSelected
isSelected = !isSelected
}
FormValidator.enableByValidationWith(delegate: delegateObject?.formValidationProtocol)
}
public func isValidField() -> Bool {
return radioButton.isSelected
return isSelected
}
public func formFieldName() -> String? {
@ -87,7 +65,27 @@ import UIKit
}
public func formFieldValue() -> Any? {
return radioButton.isSelected
return isSelected
}
// MARK: - MVMViewProtocol
open override func setupView() {
super.setupView()
guard subviews.count == 0 else {
return
}
/*translatesAutoresizingMaskIntoConstraints = false
addSubview(radioButton)
isAccessibilityElement = true
accessibilityTraits = .none
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
NSLayoutConstraint.constraintPinSubview(toSuperview: radioButton)
radioButton.performActionForCheck = { [weak self] in
self?.tapAction()
}*/
}
}

View File

@ -0,0 +1,52 @@
//
// Control.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 10/23/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
public class Control: UIControl {
var json: [AnyHashable: Any]?
public override init(frame: CGRect) {
super.init(frame: .zero)
setupView()
}
init() {
super.init(frame: .zero)
setupView()
}
public required init?(coder: NSCoder) {
super.init(coder: coder)
setupView()
}
}
extension Control: MVMCoreViewProtocol {
public func updateView(_ size: CGFloat) {
}
public func setupView() {
translatesAutoresizingMaskIntoConstraints = false
insetsLayoutMarginsFromSafeArea = false
}
}
extension Control: MVMCoreUIMoleculeViewProtocol {
public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
self.json = json
if let backgroundColorString = json?.optionalStringForKey(KeyBackgroundColor) {
backgroundColor = UIColor.mfGet(forHex: backgroundColorString)
}
}
public func reset() {
backgroundColor = .clear
}
}

View File

@ -0,0 +1,52 @@
//
// View.swift
// MVMCoreUI
//
// Created by Scott Pfeil on 10/23/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
public class View: UIView {
var json: [AnyHashable: Any]?
public override init(frame: CGRect) {
super.init(frame: .zero)
setupView()
}
init() {
super.init(frame: .zero)
setupView()
}
public required init?(coder: NSCoder) {
super.init(coder: coder)
setupView()
}
}
extension View: MVMCoreViewProtocol {
public func updateView(_ size: CGFloat) {
}
public func setupView() {
translatesAutoresizingMaskIntoConstraints = false
insetsLayoutMarginsFromSafeArea = false
}
}
extension View: MVMCoreUIMoleculeViewProtocol {
public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
self.json = json
if let backgroundColorString = json?.optionalStringForKey(KeyBackgroundColor) {
backgroundColor = UIColor.mfGet(forHex: backgroundColorString)
}
}
public func reset() {
backgroundColor = .clear
}
}

View File

@ -27,9 +27,9 @@ import UIKit
}
public func selected(_ radioButton: RadioButton) {
selectedRadioButton?.radioButton.isSelected = false
selectedRadioButton?.isSelected = false
selectedRadioButton = radioButton
selectedRadioButton?.radioButton.isSelected = true
selectedRadioButton?.isSelected = true
}
}

View File

@ -8,7 +8,7 @@
import UIKit
@objcMembers open class RadioButtonWithLabel: ViewConstrainingView {
@objcMembers public class RadioButtonWithLabel: ViewConstrainingView {
public let radioButton = RadioButton()
var delegateObject: MVMCoreUIDelegateObject?
@ -108,7 +108,7 @@ extension RadioButtonWithLabel {
// MARK: Accessibility
extension RadioButtonWithLabel {
func changeAccessibilityLabel() {
let stateString = radioButton.radioButton.isSelected ? "radio_selected_state" : "radio_not_selected_state"
let stateString = radioButton.isSelected ? "radio_selected_state" : "radio_not_selected_state"
let localizedStringState = MVMCoreUIUtility.hardcodedString(withKey: stateString) ?? ""
let accebilityString = (label.accessibilityLabel ?? (json?.optionalStringForKey("accessibilityText") ?? ""))
+ (MVMCoreUIUtility.hardcodedString(withKey: "radio_desc_state") ?? "") + localizedStringState