designed accessibility updates
This commit is contained in:
parent
e312e629e7
commit
39a12684a5
@ -80,6 +80,8 @@
|
|||||||
0A6682B5243769C700AD3CA1 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682B3243769C700AD3CA1 /* TextView.swift */; };
|
0A6682B5243769C700AD3CA1 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682B3243769C700AD3CA1 /* TextView.swift */; };
|
||||||
0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */; };
|
0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */; };
|
||||||
0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */; };
|
0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */; };
|
||||||
|
0A775F2624893916009EFB58 /* ThreeHeadlineBodyLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A775F2524893916009EFB58 /* ThreeHeadlineBodyLink.swift */; };
|
||||||
|
0A775F2824893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A775F2724893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift */; };
|
||||||
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; };
|
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; };
|
||||||
0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */; };
|
0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */; };
|
||||||
0A7ECC5D243CE85300C828E8 /* DoughnutChartItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7ECC5C243CE85300C828E8 /* DoughnutChartItemModel.swift */; };
|
0A7ECC5D243CE85300C828E8 /* DoughnutChartItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7ECC5C243CE85300C828E8 /* DoughnutChartItemModel.swift */; };
|
||||||
@ -510,6 +512,8 @@
|
|||||||
0A6682B3243769C700AD3CA1 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
|
0A6682B3243769C700AD3CA1 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
|
||||||
0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyRequiredModel.swift; sourceTree = "<group>"; };
|
0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyRequiredModel.swift; sourceTree = "<group>"; };
|
||||||
0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseDropdownEntryField.swift; sourceTree = "<group>"; };
|
0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseDropdownEntryField.swift; sourceTree = "<group>"; };
|
||||||
|
0A775F2524893916009EFB58 /* ThreeHeadlineBodyLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeHeadlineBodyLink.swift; sourceTree = "<group>"; };
|
||||||
|
0A775F2724893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeHeadlineBodyLinkModel.swift; sourceTree = "<group>"; };
|
||||||
0A7918F423F5E7EA00772FF4 /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = "<group>"; };
|
0A7918F423F5E7EA00772FF4 /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = "<group>"; };
|
||||||
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyButton.swift; sourceTree = "<group>"; };
|
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyButton.swift; sourceTree = "<group>"; };
|
||||||
0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Checkbox.swift; sourceTree = "<group>"; };
|
0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Checkbox.swift; sourceTree = "<group>"; };
|
||||||
@ -1209,6 +1213,8 @@
|
|||||||
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
||||||
EA5124FE2436018E0051A3A4 /* BGImageHeadlineBodyButtonModel.swift */,
|
EA5124FE2436018E0051A3A4 /* BGImageHeadlineBodyButtonModel.swift */,
|
||||||
EA5124FC243601600051A3A4 /* BGImageHeadlineBodyButton.swift */,
|
EA5124FC243601600051A3A4 /* BGImageHeadlineBodyButton.swift */,
|
||||||
|
0A775F2524893916009EFB58 /* ThreeHeadlineBodyLink.swift */,
|
||||||
|
0A775F2724893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift */,
|
||||||
);
|
);
|
||||||
path = VerticalCombinationViews;
|
path = VerticalCombinationViews;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2002,6 +2008,7 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
0A775F2624893916009EFB58 /* ThreeHeadlineBodyLink.swift in Sources */,
|
||||||
AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */,
|
AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */,
|
||||||
5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */,
|
5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */,
|
||||||
AA0A257824766C8A00862F64 /* ListLeftVariableIconWithRightCaretBodyTextModel.swift in Sources */,
|
AA0A257824766C8A00862F64 /* ListLeftVariableIconWithRightCaretBodyTextModel.swift in Sources */,
|
||||||
@ -2189,6 +2196,7 @@
|
|||||||
0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */,
|
0A7EF85D23D8A95600B2AAD1 /* TextEntryFieldModel.swift in Sources */,
|
||||||
BB54C5212434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */,
|
BB54C5212434D92F0038326C /* ListRightVariableButtonAllTextAndLinksModel.swift in Sources */,
|
||||||
D2092349244A51D40044AD09 /* RadioSwatchModel.swift in Sources */,
|
D2092349244A51D40044AD09 /* RadioSwatchModel.swift in Sources */,
|
||||||
|
0A775F2824893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift in Sources */,
|
||||||
8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */,
|
8DD1E370243B3D0500D8F2DF /* ListThreeColumnInternationalData.swift in Sources */,
|
||||||
D23EA802247EBED400D60C34 /* ImageBarButtonItem.swift in Sources */,
|
D23EA802247EBED400D60C34 /* ImageBarButtonItem.swift in Sources */,
|
||||||
D2D6CD4222E78FAB00D701B8 /* ThreeLayerTemplate.swift in Sources */,
|
D2D6CD4222E78FAB00D701B8 /* ThreeLayerTemplate.swift in Sources */,
|
||||||
|
|||||||
@ -101,6 +101,7 @@ import Foundation
|
|||||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self)
|
MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self)
|
||||||
MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self)
|
MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self)
|
||||||
MoleculeObjectMapping.shared()?.register(viewClass: BGImageHeadlineBodyButton.self, viewModelClass: BGImageHeadlineBodyButtonModel.self)
|
MoleculeObjectMapping.shared()?.register(viewClass: BGImageHeadlineBodyButton.self, viewModelClass: BGImageHeadlineBodyButtonModel.self)
|
||||||
|
MoleculeObjectMapping.shared()?.register(viewClass: ThreeHeadlineBodyLink.self, viewModelClass: ThreeHeadlineBodyLinkModel.self)
|
||||||
|
|
||||||
// Left Right Molecules
|
// Left Right Molecules
|
||||||
MoleculeObjectMapping.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self)
|
MoleculeObjectMapping.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self)
|
||||||
|
|||||||
@ -14,16 +14,8 @@ import Foundation
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
|
||||||
let leftHeadline1 = Label.createLabelBoldBodySmall(true)
|
let leftHeadlineBodyLink = ThreeHeadlineBodyLink()
|
||||||
let leftHeadline2 = Label.createLabelBoldBodySmall(true)
|
let rightHeadlineBodyLink = ThreeHeadlineBodyLink()
|
||||||
let leftHeadline3 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let leftBody = Label.createLabelRegularBodySmall(true)
|
|
||||||
let leftLink = Link()
|
|
||||||
let rightHeadline1 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let rightHeadline2 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let rightHeadline3 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let rightBody = Label.createLabelRegularBodySmall(true)
|
|
||||||
let rightLink = Link()
|
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -37,26 +29,11 @@ import Foundation
|
|||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
let stackHeadline1 = Stack<StackModel>.createStack(with: [(view: leftHeadline1, model: StackItemModel(percent: 50, verticalAlignment: .leading)),
|
let stackHeadline1 = Stack<StackModel>.createStack(with: [(view: leftHeadlineBodyLink, model: StackItemModel(percent: 50, verticalAlignment: .leading)),
|
||||||
(view: rightHeadline1, model: StackItemModel(percent: 50, verticalAlignment: .leading))],
|
(view: rightHeadlineBodyLink, model: StackItemModel(percent: 50, verticalAlignment: .leading))],
|
||||||
axis: .horizontal)
|
axis: .horizontal)
|
||||||
let stackHeadline2 = Stack<StackModel>.createStack(with: [(view: leftHeadline2, model: StackItemModel(percent: 50, verticalAlignment: .leading)),
|
|
||||||
(view: rightHeadline2, model: StackItemModel(percent: 50, verticalAlignment: .leading))],
|
containingStack = Stack<StackModel>.createStack(with: [stackHeadline1], spacing: 0)
|
||||||
axis: .horizontal)
|
|
||||||
let stackHeadline3 = Stack<StackModel>.createStack(with: [(view: leftHeadline3, model: StackItemModel(percent: 50, verticalAlignment: .leading)),
|
|
||||||
(view: rightHeadline3, model: StackItemModel(percent: 50, verticalAlignment: .leading))],
|
|
||||||
axis: .horizontal)
|
|
||||||
let stackBody = Stack<StackModel>.createStack(with: [(view: leftBody, model: StackItemModel(percent: 50, verticalAlignment: .leading)),
|
|
||||||
(view: rightBody, model: StackItemModel(percent: 50, verticalAlignment: .leading))],
|
|
||||||
axis: .horizontal)
|
|
||||||
let stackLink = Stack<StackModel>.createStack(with: [(view: leftLink, model: StackItemModel(percent: 50, verticalAlignment: .leading)),
|
|
||||||
(view: rightLink, model: StackItemModel(percent: 50, verticalAlignment: .leading))],
|
|
||||||
axis: .horizontal)
|
|
||||||
containingStack = Stack<StackModel>.createStack(with: [stackHeadline1, stackHeadline2, stackHeadline3, stackBody, stackLink],
|
|
||||||
spacing: 0)
|
|
||||||
containingStack.stackModel?.molecules[1].spacing = 5
|
|
||||||
containingStack.stackModel?.molecules[2].spacing = 5
|
|
||||||
containingStack.stackModel?.molecules[4].spacing = 5
|
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +54,7 @@ import Foundation
|
|||||||
((molecule as? StackItem)?.view as? Stack<StackModel>)?.restack()
|
((molecule as? StackItem)?.view as? Stack<StackModel>)?.restack()
|
||||||
}
|
}
|
||||||
containingStack.restack()
|
containingStack.restack()
|
||||||
updateAccessibilityLabel()
|
isAccessibilityElement = false
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
@ -89,132 +66,34 @@ import Foundation
|
|||||||
|
|
||||||
guard let model = model as? ListTwoColumnCompareChangesModel else { return }
|
guard let model = model as? ListTwoColumnCompareChangesModel else { return }
|
||||||
|
|
||||||
leftHeadline1.set(with: model.leftHeadline1, delegateObject, additionalData)
|
leftHeadlineBodyLink.headline1.set(with: model.leftHeadline1, delegateObject, additionalData)
|
||||||
leftHeadline2.set(with: model.leftHeadline2, delegateObject, additionalData)
|
leftHeadlineBodyLink.headline2.set(with: model.leftHeadline2, delegateObject, additionalData)
|
||||||
leftHeadline3.set(with: model.leftHeadline3, delegateObject, additionalData)
|
leftHeadlineBodyLink.headline3.set(with: model.leftHeadline3, delegateObject, additionalData)
|
||||||
leftBody.set(with: model.leftBody, delegateObject, additionalData)
|
leftHeadlineBodyLink.body.set(with: model.leftBody, delegateObject, additionalData)
|
||||||
leftLink.set(with: model.leftLink, delegateObject, additionalData)
|
leftHeadlineBodyLink.link.set(with: model.leftLink, delegateObject, additionalData)
|
||||||
rightHeadline1.set(with: model.rightHeadline1, delegateObject, additionalData)
|
leftHeadlineBodyLink.updateAccessibilityLabel()
|
||||||
rightHeadline2.set(with: model.rightHeadline2, delegateObject, additionalData)
|
|
||||||
rightHeadline3.set(with: model.rightHeadline3, delegateObject, additionalData)
|
rightHeadlineBodyLink.headline1.set(with: model.rightHeadline1, delegateObject, additionalData)
|
||||||
rightBody.set(with: model.rightBody, delegateObject, additionalData)
|
rightHeadlineBodyLink.headline2.set(with: model.rightHeadline2, delegateObject, additionalData)
|
||||||
rightLink.set(with: model.rightLink, delegateObject, additionalData)
|
rightHeadlineBodyLink.headline3.set(with: model.rightHeadline3, delegateObject, additionalData)
|
||||||
updateAccessibilityLabel()
|
rightHeadlineBodyLink.body.set(with: model.rightBody, delegateObject, additionalData)
|
||||||
|
rightHeadlineBodyLink.link.set(with: model.rightLink, delegateObject, additionalData)
|
||||||
|
rightHeadlineBodyLink.updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
leftHeadline1.styleBoldBodySmall(true)
|
leftHeadlineBodyLink.headline1.styleBoldBodySmall(true)
|
||||||
leftHeadline2.styleBoldBodySmall(true)
|
leftHeadlineBodyLink.headline2.styleBoldBodySmall(true)
|
||||||
leftHeadline3.styleBoldBodySmall(true)
|
leftHeadlineBodyLink.headline3.styleBoldBodySmall(true)
|
||||||
leftBody.styleRegularBodySmall(true)
|
leftHeadlineBodyLink.body.styleRegularBodySmall(true)
|
||||||
rightHeadline1.styleBoldBodySmall(true)
|
rightHeadlineBodyLink.headline1.styleBoldBodySmall(true)
|
||||||
rightHeadline2.styleBoldBodySmall(true)
|
rightHeadlineBodyLink.headline2.styleBoldBodySmall(true)
|
||||||
rightHeadline3.styleBoldBodySmall(true)
|
rightHeadlineBodyLink.headline3.styleBoldBodySmall(true)
|
||||||
rightBody.styleRegularBodySmall(true)
|
rightHeadlineBodyLink.body.styleRegularBodySmall(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
return 121
|
return 121
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Accessibility
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
|
||||||
|
|
||||||
let leftHeadline1 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let leftHeadline2 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let leftHeadline3 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let leftBody = Label.createLabelRegularBodySmall(true)
|
|
||||||
let leftLink = Link()
|
|
||||||
|
|
||||||
let rightHeadline1 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let rightHeadline2 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let rightHeadline3 = Label.createLabelBoldBodySmall(true)
|
|
||||||
let rightBody = Label.createLabelRegularBodySmall(true)
|
|
||||||
let rightLink = Link()
|
|
||||||
|
|
||||||
var message = ""
|
|
||||||
|
|
||||||
if let eyebrowText = eyebrow.text, !eyebrowText.isEmpty {
|
|
||||||
message += eyebrowText + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
if let headlineText = headline.text, !headlineText.isEmpty {
|
|
||||||
message += headlineText + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
if let bodyText = body.text, !bodyText.isEmpty {
|
|
||||||
message += bodyText + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
if let body2Text = body2.text, !body2Text.isEmpty {
|
|
||||||
message += body2Text + ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
if let rightImageLabel = rightImage.accessibilityLabel {
|
|
||||||
message += rightImageLabel
|
|
||||||
}
|
|
||||||
|
|
||||||
let leftLinkIsDisplayed = !twoLinkView.leftLink.isHidden
|
|
||||||
let rightLinkIsDisplayed = !twoLinkView.rightLink.isHidden
|
|
||||||
|
|
||||||
// Both links are displayed
|
|
||||||
if leftLinkIsDisplayed && rightLinkIsDisplayed {
|
|
||||||
isAccessibilityElement = false
|
|
||||||
var views = [UIView]()
|
|
||||||
|
|
||||||
if let eyebrowText = eyebrow.text, !eyebrowText.isEmpty {
|
|
||||||
views.append(eyebrow)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let headlineText = headline.text, !headlineText.isEmpty {
|
|
||||||
views.append(headline)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let bodyText = body.text, !bodyText.isEmpty {
|
|
||||||
views.append(body)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let body2Text = body2.text, !body2Text.isEmpty {
|
|
||||||
views.append(body2)
|
|
||||||
}
|
|
||||||
|
|
||||||
views.append(twoLinkView.leftLink)
|
|
||||||
views.append(twoLinkView.rightLink)
|
|
||||||
|
|
||||||
accessibilityElements = views
|
|
||||||
return
|
|
||||||
|
|
||||||
} else if leftLinkIsDisplayed {
|
|
||||||
accessibilityHint = twoLinkView.leftLink.accessibilityHint
|
|
||||||
accessibilityTraits = twoLinkView.leftLink.accessibilityTraits
|
|
||||||
message += twoLinkView.leftLink.accessibilityLabel ?? ""
|
|
||||||
|
|
||||||
} else if rightLinkIsDisplayed {
|
|
||||||
accessibilityHint = twoLinkView.rightLink.accessibilityHint
|
|
||||||
accessibilityTraits = twoLinkView.rightLink.accessibilityTraits
|
|
||||||
message += twoLinkView.rightLink.accessibilityLabel ?? ""
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
isAccessibilityElement = true
|
|
||||||
accessibilityLabel = message
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func accessibilityActivate() -> Bool {
|
|
||||||
|
|
||||||
if isAccessibilityElement {
|
|
||||||
if !twoLinkView.leftLink.isHidden {
|
|
||||||
return twoLinkView.leftLink.accessibilityActivate()
|
|
||||||
} else if !twoLinkView.rightLink.isHidden {
|
|
||||||
return twoLinkView.rightLink.accessibilityActivate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,8 +14,8 @@ import UIKit
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
let headlineBody = HeadlineBody(frame: .zero)
|
let headlineBody = HeadlineBody()
|
||||||
let button = PillButton(frame: .zero)
|
let button = PillButton()
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -52,8 +52,6 @@ import UIKit
|
|||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
guard subviews.isEmpty else { return }
|
|
||||||
|
|
||||||
defaultState()
|
defaultState()
|
||||||
|
|
||||||
addSubview(headlineBody)
|
addSubview(headlineBody)
|
||||||
@ -82,8 +80,8 @@ import UIKit
|
|||||||
|
|
||||||
private func defaultState() {
|
private func defaultState() {
|
||||||
|
|
||||||
headlineBody.headlineLabel.font = MFStyler.fontBoldTitleMedium()
|
headlineBody.headlineLabel.font = Styler.Font.BoldTitleMedium.getFont()
|
||||||
headlineBody.messageLabel.font = MFStyler.fontRegularMicro()
|
headlineBody.messageLabel.font = Styler.Font.RegularMicro.getFont()
|
||||||
button.styleSecondary()
|
button.styleSecondary()
|
||||||
button.isHidden = false
|
button.isHidden = false
|
||||||
buttonHeadlinePadding = PaddingTwo
|
buttonHeadlinePadding = PaddingTwo
|
||||||
@ -101,14 +99,19 @@ import UIKit
|
|||||||
defaultState()
|
defaultState()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- MoleculeViewProtocol
|
//------------------------------------------------------
|
||||||
|
// MARK: - MoleculeViewProtocol
|
||||||
|
//------------------------------------------------------
|
||||||
|
|
||||||
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 320
|
return 320
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? HeadlineBodyButtonModel else { return }
|
guard let model = model as? HeadlineBodyButtonModel else { return }
|
||||||
|
|
||||||
buttonHeadlinePadding = model.buttonHeadlinePadding
|
buttonHeadlinePadding = model.buttonHeadlinePadding
|
||||||
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||||
button.set(with: model.button, delegateObject, additionalData)
|
button.set(with: model.button, delegateObject, additionalData)
|
||||||
|
|||||||
@ -8,7 +8,12 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class HeadlineBodyButtonModel: MoleculeModelProtocol {
|
public class HeadlineBodyButtonModel: MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "headlineBodyButton"
|
public static var identifier: String = "headlineBodyButton"
|
||||||
public var moleculeName: String = HeadlineBodyButtonModel.identifier
|
public var moleculeName: String = HeadlineBodyButtonModel.identifier
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|||||||
@ -0,0 +1,148 @@
|
|||||||
|
//
|
||||||
|
// ThreeHeadlineBodyLink.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Kevin Christiano on 6/4/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
|
open class ThreeHeadlineBodyLink: View {
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// MARK: - Outlets
|
||||||
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
public let headline1 = Label.createLabelBoldBodySmall(true)
|
||||||
|
public let headline2 = Label.createLabelBoldBodySmall(true)
|
||||||
|
public let headline3 = Label.createLabelBoldBodySmall(true)
|
||||||
|
public let body = Label.createLabelRegularBodySmall(true)
|
||||||
|
public let link = Link()
|
||||||
|
|
||||||
|
//------------------------------------------------------
|
||||||
|
// MARK: - Initialization
|
||||||
|
//------------------------------------------------------
|
||||||
|
|
||||||
|
public convenience init() {
|
||||||
|
self.init(frame: .zero)
|
||||||
|
}
|
||||||
|
|
||||||
|
public override init(frame: CGRect) {
|
||||||
|
super.init(frame: frame)
|
||||||
|
}
|
||||||
|
|
||||||
|
required public init?(coder aDecoder: NSCoder) {
|
||||||
|
super.init(coder: aDecoder)
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------
|
||||||
|
// MARK: - Lifecycle
|
||||||
|
//------------------------------------------------------
|
||||||
|
|
||||||
|
override open func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
|
||||||
|
addSubview(headline1)
|
||||||
|
addSubview(headline2)
|
||||||
|
addSubview(headline3)
|
||||||
|
addSubview(body)
|
||||||
|
addSubview(link)
|
||||||
|
|
||||||
|
link.titleLabel?.font = Styler.Font.RegularBodySmall.getFont()
|
||||||
|
|
||||||
|
headline1.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
||||||
|
headline1.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
||||||
|
trailingAnchor.constraint(equalTo: headline1.trailingAnchor).isActive = true
|
||||||
|
|
||||||
|
headline2.topAnchor.constraint(equalTo: headline1.bottomAnchor, constant: 5).isActive = true
|
||||||
|
headline2.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
||||||
|
trailingAnchor.constraint(equalTo: headline2.trailingAnchor).isActive = true
|
||||||
|
|
||||||
|
headline3.topAnchor.constraint(equalTo: headline2.bottomAnchor, constant: 5).isActive = true
|
||||||
|
headline3.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
||||||
|
trailingAnchor.constraint(equalTo: headline3.trailingAnchor).isActive = true
|
||||||
|
|
||||||
|
body.topAnchor.constraint(equalTo: headline3.bottomAnchor, constant: 5).isActive = true
|
||||||
|
body.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
||||||
|
trailingAnchor.constraint(equalTo: body.trailingAnchor).isActive = true
|
||||||
|
|
||||||
|
link.topAnchor.constraint(equalTo: body.bottomAnchor, constant: Padding.Two).isActive = true
|
||||||
|
link.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
||||||
|
trailingAnchor.constraint(equalTo: link.trailingAnchor).isActive = true
|
||||||
|
bottomAnchor.constraint(equalTo: link.bottomAnchor).isActive = true
|
||||||
|
|
||||||
|
isAccessibilityElement = true
|
||||||
|
accessibilityTraits = link.accessibilityTraits
|
||||||
|
accessibilityHint = link.accessibilityHint
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
}
|
||||||
|
|
||||||
|
override open func reset() {
|
||||||
|
super.reset()
|
||||||
|
|
||||||
|
headline1.reset()
|
||||||
|
headline2.reset()
|
||||||
|
headline3.reset()
|
||||||
|
body.reset()
|
||||||
|
link.reset()
|
||||||
|
link.titleLabel?.font = Styler.Font.RegularBodySmall.getFont()
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------
|
||||||
|
// MARK: - MoleculeViewProtocol
|
||||||
|
//------------------------------------------------------
|
||||||
|
|
||||||
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
return 320
|
||||||
|
}
|
||||||
|
|
||||||
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
|
guard let model = model as? ThreeHeadlineBodyLinkModel else { return }
|
||||||
|
|
||||||
|
headline1.set(with: model.headline1, delegateObject, additionalData)
|
||||||
|
headline2.set(with: model.headline2, delegateObject, additionalData)
|
||||||
|
headline3.set(with: model.headline3, delegateObject, additionalData)
|
||||||
|
body.set(with: model.body, delegateObject, additionalData)
|
||||||
|
link.set(with: model.link, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
// MARK: - Accessibility
|
||||||
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let headline1Text = headline1.text, !headline1Text.isEmpty {
|
||||||
|
message += headline1Text + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headline2Text = headline2.text, !headline2Text.isEmpty {
|
||||||
|
message += headline2Text + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headline3Text = headline3.text, !headline3Text.isEmpty {
|
||||||
|
message += headline3Text + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let bodyText = body.text, !bodyText.isEmpty {
|
||||||
|
message += bodyText + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let linkLabel = link.accessibilityLabel, !linkLabel.isEmpty {
|
||||||
|
message += linkLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func accessibilityActivate() -> Bool {
|
||||||
|
|
||||||
|
return link.accessibilityActivate()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
//
|
||||||
|
// ThreeHeadlineBodyLinkModel.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Kevin Christiano on 6/4/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
public class ThreeHeadlineBodyLinkModel: MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public static var identifier: String = "threeHeadlineBodyLink"
|
||||||
|
public var moleculeName: String = ThreeHeadlineBodyLinkModel.identifier
|
||||||
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
|
public var headline1: LabelModel
|
||||||
|
public var headline2: LabelModel
|
||||||
|
public var headline3: LabelModel
|
||||||
|
public var body: LabelModel
|
||||||
|
public var link: LinkModel
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public init(headline1: LabelModel, headline2: LabelModel, headline3: LabelModel, body: LabelModel, link: LinkModel) {
|
||||||
|
self.headline1 = headline1
|
||||||
|
self.headline2 = headline2
|
||||||
|
self.headline3 = headline3
|
||||||
|
self.body = body
|
||||||
|
self.link = link
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case moleculeName
|
||||||
|
case backgroundColor
|
||||||
|
case headline1
|
||||||
|
case headline2
|
||||||
|
case headline3
|
||||||
|
case body
|
||||||
|
case link
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
required public init(from decoder: Decoder) throws {
|
||||||
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
headline1 = try typeContainer.decode(LabelModel.self, forKey: .headline1)
|
||||||
|
headline2 = try typeContainer.decode(LabelModel.self, forKey: .headline2)
|
||||||
|
headline3 = try typeContainer.decode(LabelModel.self, forKey: .headline3)
|
||||||
|
body = try typeContainer.decode(LabelModel.self, forKey: .body)
|
||||||
|
link = try typeContainer.decode(LinkModel.self, forKey: .link)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
try container.encode(headline1, forKey: .headline1)
|
||||||
|
try container.encode(headline2, forKey: .headline2)
|
||||||
|
try container.encode(headline3, forKey: .headline3)
|
||||||
|
try container.encode(body, forKey: .body)
|
||||||
|
try container.encode(link, forKey: .link)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user