diff --git a/MVMCoreUI/Atomic/Atoms/Views/Arrow.swift b/MVMCoreUI/Atomic/Atoms/Views/Arrow.swift index a437f9d8..13c4ff36 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Arrow.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Arrow.swift @@ -164,5 +164,6 @@ open class Arrow: View { guard let model = model as? ArrowModel else { return } isEnabled = model.enabled + pinHeightAndWidth(constant: max(model.height, model.width)) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift index 8455a5bf..f0876ec1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItem.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers public class ListFourColumnDataUsageListItem: TableViewCell { //----------------------------------------------------- @@ -19,7 +17,7 @@ import Foundation let label2 = Label(fontStyle: .RegularBodySmall) let label3 = Label(fontStyle: .RegularBodySmall) let label4 = Label(fontStyle: .RegularBodySmall) - let arrow = Arrow(frame: .zero) + let arrow = Arrow() let arrowAndLabel2Stack: Stack //----------------------------------------------------- @@ -90,6 +88,7 @@ import Foundation //----------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItemModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItemModel.swift index dbd66ccd..f30efa6b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/FourColumn/ListFourColumnDataUsageListItemModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListFourColumnDataUsageListItemModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift index ff625e8b..1b5b0697 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListLeftVariableCheckboxAllTextAndLinks: TableViewCell { //-------------------------------------------------- @@ -55,6 +53,7 @@ import Foundation observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() } + updateAccessibilityLabel() } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift index 8c2e9761..1033ca33 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - open class ListLeftVariableCheckboxAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- @@ -17,6 +15,7 @@ open class ListLeftVariableCheckboxAllTextAndLinksModel: ListItemModel, Molecule open class var identifier: String { return "listLVCB" } + public var checkbox: CheckboxModel public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift index 69ad2156..83f0469f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyText.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListLeftVariableCheckboxBodyText: TableViewCell { //----------------------------------------------------- @@ -55,6 +53,7 @@ import Foundation observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() } + updateAccessibilityLabel() } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyTextModel.swift index 2d7301b3..16d75035 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyTextModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxBodyTextModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - open class ListLeftVariableCheckboxBodyTextModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- @@ -21,6 +19,7 @@ open class ListLeftVariableCheckboxBodyTextModel: ListItemModel, MoleculeModelPr //-------------------------------------------------- // MARK: - Initializer //-------------------------------------------------- + public init(checkbox: CheckboxModel, headlineBody: HeadlineBodyModel) { self.checkbox = checkbox self.headlineBody = headlineBody diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index f8153305..728d8464 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListLeftVariableIconAllTextLinks: TableViewCell { //-------------------------------------------------- @@ -63,12 +61,15 @@ import Foundation } func getAccessibilityMessage() -> String? { + guard let leftImageLabel = leftImage.imageView.accessibilityLabel else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { return leftImageLabel } + return leftImageLabel + ", " + label } @@ -76,7 +77,8 @@ import Foundation let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() @@ -87,12 +89,15 @@ import Foundation } else { // Only link. Manually add accessibility elements to ensure they are read in the right order. var elements: [Any] = [] + if let leftImageLabel = leftImage.imageView.accessibilityLabel, !leftImageLabel.isEmpty { elements.append(leftImage.imageView) } + if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() { elements.append(otherElements) } + accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinksModel.swift index 0c3c8f5b..8581deb1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinksModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListLeftVariableIconAllTextLinksModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index 2ebe1c98..8ffbf06c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import UIKit - @objcMembers open class ListLeftVariableIconWithRightCaret: TableViewCell { //-------------------------------------------------- @@ -76,6 +74,7 @@ import UIKit } func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index c69bebb2..4685cafd 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListLeftVariableIconWithRightCaretBodyText: TableViewCell { //-------------------------------------------------- @@ -91,6 +89,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyTextModel.swift index 81632b05..891f37f5 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyTextModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyTextModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListLeftVariableIconWithRightCaretBodyTextModel: ListItemModel, MoleculeModelProtocol { //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretModel.swift index d53faa5e..479ebadb 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListLeftVariableIconWithRightCaretModel: ListItemModel, MoleculeModelProtocol { //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index 1ec68330..75096854 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -6,15 +6,14 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListLeftVariableNumberedListAllTextAndLinks: TableViewCell { //-------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- + public let leftLabel = Label(fontStyle: .Title2XLarge) - public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() public var stack: Stack //-------------------------------------------------- @@ -72,12 +71,15 @@ import Foundation //-------------------------------------------------- func getAccessibilityMessage() -> String? { + guard let leftLabel = leftLabel.text else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { return leftLabel } + return leftLabel + ", " + label } @@ -86,6 +88,7 @@ import Foundation let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() @@ -96,12 +99,15 @@ import Foundation } else { // Only link. Manually add accessibility elements to ensure they are read in the right order. var elements: [Any] = [] + if let leftLabelText = leftLabel.text, !leftLabelText.isEmpty { elements.append(leftLabel) } + if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() { elements.append(otherElements) } + accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinksModel.swift index b2271f3c..2763fdd2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinksModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListLeftVariableNumberedListAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift index a0a7a462..1fff77d1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -6,12 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation @objcMembers open class ListLeftVariableNumberedListBodyText: TableViewCell { //-------------------------------------------------- // MARK: - Outlets - //----------------------------------------------------- + //---------------------------------------------------- + public let leftLabel = Label(fontStyle: .Title2XLarge) public let headlineBody = HeadlineBody() public var stack: Stack diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyTextModel.swift index 372bab32..ac605283 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyTextModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyTextModel.swift @@ -6,7 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation public class ListLeftVariableNumberedListBodyTextModel: ListItemModel, MoleculeModelProtocol { //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift index e5e9e178..730f988f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinks.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListLeftVariableRadioButtonAllTextAndLinks: TableViewCell { //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinksModel.swift index f682037e..253280ad 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAllTextAndLinksModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - open class ListLeftVariableRadioButtonAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift index e14e91e2..48e3c49c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -57,6 +57,7 @@ import UIKit observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in self?.updateAccessibilityLabel() } + updateAccessibilityLabel() } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift index 551ce585..1cd46a81 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift index a30f3f9e..dc3a582a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyText.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import UIKit - open class ListLeftVariableRadioButtonBodyText: TableViewCell { //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift index bb8e7ded..6d8881e4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonBodyTextModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - open class ListLeftVariableRadioButtonBodyTextModel: ListItemModel, MoleculeModelProtocol { //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift index 4e0eb83a..9f469d28 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListProgressBarThin: TableViewCell { //-------------------------------------------------- @@ -113,6 +111,7 @@ import Foundation //------------------------------------------------------ func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThinModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThinModel.swift index b74c64b3..5309ebe1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThinModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThinModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index 58b9ada0..46c11747 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -6,10 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListRVWheel: TableViewCell { + //----------------------------------------------------- + // MARK: - Properties + //----------------------------------------------------- + let wheel = Wheel(frame: .zero) let leftLabel = Label(fontStyle: .BoldBodySmall) let rightLabel = Label(fontStyle: .RegularBodySmall) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheelModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheelModel.swift index 1da9d9bb..d8911993 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheelModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheelModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListRVWheelModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index f0d5cdbf..bca4696a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListRightVariableButtonAllTextAndLinks: TableViewCell { //----------------------------------------------------- @@ -75,17 +73,22 @@ import Foundation //---------------------------------------------------- func getAccessibilityMessage() -> String? { + guard let buttonText = button.titleLabel?.text else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { return buttonText } + return label + ", " + buttonText } func updateAccessibilityLabel() { + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 + if !linkShowing && accessoryView == nil { // Make whole cell focusable if one action isAccessibilityElement = true @@ -94,16 +97,20 @@ import Foundation // Make buttons focusable. isAccessibilityElement = false var elements: [Any] = [] + if let accessoryView = accessoryView { accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage() elements.append(accessoryView) } else { button.accessibilityLabel = getAccessibilityMessage() } + elements.append(button) + if linkShowing { elements.append(eyebrowHeadlineBodyLink.link) } + accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift index ff41a2b0..db093a9a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinksModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListRightVariableButtonAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index f6526e10..ae482d8d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -6,13 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListRightVariablePayments: TableViewCell { //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- + let leftLabel = Label(fontStyle: .BoldBodySmall) let rightImage = LoadImageView(pinnedEdges: .all) var stack: Stack @@ -20,6 +19,7 @@ import Foundation //----------------------------------------------------- // MARK: - Initializers //----------------------------------------------------- + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .leading)), (view: rightImage, model: StackItemModel(horizontalAlignment: .fill))], @@ -70,6 +70,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 5cfd64f8..46aa7f09 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index 2364117b..426f3ba7 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListRightVariablePriceChangeAllTextAndLinks: TableViewCell { //----------------------------------------------------- @@ -88,19 +86,24 @@ import Foundation // MARK: - Accessibility //-------------------------------------------------- func getAccessibilityMessage() -> String? { + guard let rightLabelText = rightLabel.text else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { return rightLabelText } + return label + ", " + rightLabelText } func updateAccessibilityLabel() { + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() @@ -111,12 +114,15 @@ import Foundation } else { // Only link. Manually add accessibility elements to ensure they are read in the right order. var elements: [Any] = [] + if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() { elements.append(otherElements) } + if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty { elements.append(rightLabel) } + accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinksModel.swift index 2b2a569b..7b1e065a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinksModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListRightVariablePriceChangeAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift index 8428dccc..87f975b0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListRightVariablePriceChangeBodyText: TableViewCell { //----------------------------------------------------- @@ -85,6 +83,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyTextModel.swift index fd3f865d..e3b325b6 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyTextModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyTextModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListRightVariablePriceChangeBodyTextModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index e7ba4f45..b05098d4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -6,12 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation + @objcMembers open class ListRightVariableRightCaretAllTextAndLinks: TableViewCell { - //-------------------------------------------------- // MARK: - Outlets //-------------------------------------------------- + public let rightLabel = Label(fontStyle: .RegularBodySmall) public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() public var stack: Stack @@ -19,6 +19,7 @@ import Foundation //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) @@ -31,6 +32,7 @@ import Foundation //----------------------------------------------------- // MARK: - Lifecycle //----------------------------------------------------- + open override func setupView() { super.setupView() rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) @@ -54,9 +56,12 @@ import Foundation //-------------------------------------------------- // MARK: - Molecular //-------------------------------------------------- + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableRightCaretAllTextAndLinksModel else { return } + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) updateAccessibilityLabel() @@ -75,19 +80,24 @@ import Foundation // MARK: - Accessibility //-------------------------------------------------- func getAccessibilityMessage() -> String? { + guard let rightLabelText = rightLabel.text else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { return rightLabelText } + return label + ", " + rightLabelText } func updateAccessibilityLabel() { + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() @@ -98,12 +108,15 @@ import Foundation } else { // Only link. Manually add accessibility elements to ensure they are read in the right order. var elements: [Any] = [] + if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() { elements.append(otherElements) } + if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty { elements.append(rightLabel) } + accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift index 025e808f..d3725ed1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift @@ -6,13 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation public class ListRightVariableRightCaretAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { - //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- + public static var identifier: String = "listRVCaretAll" public var rightLabel: LabelModel public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel @@ -20,6 +19,7 @@ public class ListRightVariableRightCaretAllTextAndLinksModel: ListItemModel, Mol //-------------------------------------------------- // MARK: - Initializer //-------------------------------------------------- + public init(rightLabel: LabelModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { self.rightLabel = rightLabel self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink @@ -29,6 +29,7 @@ public class ListRightVariableRightCaretAllTextAndLinksModel: ListItemModel, Mol //-------------------------------------------------- // MARK: - Keys //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { case moleculeName case rightLabel @@ -38,6 +39,7 @@ public class ListRightVariableRightCaretAllTextAndLinksModel: ListItemModel, Mol //-------------------------------------------------- // MARK: - Codec //-------------------------------------------------- + required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift index 2c2f25bc..059a637f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListRightVariableTextLinkAllTextAndLinks: TableViewCell { //-------------------------------------------------- @@ -72,18 +70,23 @@ import Foundation //-------------------------------------------------- func getAccessibilityMessage() -> String? { + guard let linkText = link.titleLabel?.text else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { return linkText } + return label + ", " + linkText } func updateAccessibilityLabel() { + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 accessibilityTraits = .button + if !linkShowing && accessoryView == nil { // Make whole cell focusable if one action isAccessibilityElement = true @@ -92,16 +95,20 @@ import Foundation // Make buttons focusable. isAccessibilityElement = false var elements: [Any] = [] + if let accessoryView = accessoryView { accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage() elements.append(accessoryView) } else { link.accessibilityLabel = getAccessibilityMessage() } + elements.append(link) + if linkShowing { elements.append(eyebrowHeadlineBodyLink.link) } + accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift index 9e49eda0..9aecaf4a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinksModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListRightVariableTextLinkAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift index a631616b..c63b7081 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinks.swift @@ -6,7 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation @objcMembers open class ListRightVariableToggleAllTextAndLinks: TableViewCell { //----------------------------------------------------- @@ -54,7 +53,9 @@ import Foundation open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableToggleAllTextAndLinksModel else { return } + toggle.set(with: model.toggle, delegateObject, additionalData) eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) updateAccessibilityLabel() @@ -69,20 +70,25 @@ import Foundation //---------------------------------------------------- func getAccessibilityMessage() -> String? { + guard let toggleMessage = toggle.accessibilityLabel else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { return toggleMessage } + return label + ", " + toggleMessage } func updateAccessibilityLabel() { + accessibilityHint = toggle.accessibilityHint accessibilityTraits = toggle.accessibilityTraits accessibilityValue = toggle.accessibilityValue let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 + if !linkShowing && accessoryView == nil { // Make whole cell focusable if one action isAccessibilityElement = true @@ -91,6 +97,7 @@ import Foundation // Make buttons focusable. isAccessibilityElement = false var elements: [Any] = [] + if let accessoryView = accessoryView { accessoryView.accessibilityLabel = eyebrowHeadlineBodyLink.getAccessibilityMessage() elements.append(accessoryView) @@ -102,6 +109,7 @@ import Foundation if linkShowing { elements.append(eyebrowHeadlineBodyLink.link) } + accessibilityElements = elements } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift index 9fdc16ca..44015fe0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableToggleAllTextAndLinksModel.swift @@ -6,7 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation public class ListRightVariableToggleAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift index fe2c8a24..a749041a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListRightVariableTotalData: TableViewCell { //----------------------------------------------------- @@ -84,6 +82,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalDataModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalDataModel.swift index 806cd602..cebaeb34 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalDataModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalDataModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- @@ -27,6 +25,7 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc super.setDefaults() rightLabel.hero = 0 bar.type = .heavy + if bar.backgroundColor == nil { bar.backgroundColor = Color(uiColor: .mvmBlue) } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift index ac100a24..c9368057 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChanges.swift @@ -6,12 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation @objcMembers open class ListThreeColumnBillChanges: TableViewCell { //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- + public let leftLabel = Label(fontStyle: .RegularBodySmall) public let centerLabel = Label(fontStyle: .RegularBodySmall) public let rightLabel = Label(fontStyle: .RegularBodySmall) @@ -75,6 +75,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift index a9b5f9d0..00bf689c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillChangesModel.swift @@ -6,7 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation public class ListThreeColumnBillChangesModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillHistory.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillHistory.swift index 936288e3..98ec315a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillHistory.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillHistory.swift @@ -6,12 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation @objcMembers open class ListThreeColumnBillHistory: TableViewCell { //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- + public let leftLabel = Label(fontStyle: .RegularBodySmall) public let centerLabel = Label(fontStyle: .RegularBodySmall) public let rightLabel = Label(fontStyle: .RegularBodySmall) @@ -35,6 +35,7 @@ import Foundation //------------------------------------------------------ // MARK: - Lifecycle //------------------------------------------------------ + open override func setupView() { super.setupView() addMolecule(stack) @@ -44,6 +45,7 @@ import Foundation //-------------------------------------------------- // MARK: - ModelMoleculeViewProtocol //-------------------------------------------------- + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListThreeColumnBillHistoryModel else { return } @@ -67,18 +69,24 @@ import Foundation //-------------------------------------------------- // MARK: - Accessibility //-------------------------------------------------- + func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" + if let leftText = leftLabel.text, !leftText.isEmpty { message += leftText + ", " } + if let centerText = centerLabel.text, !centerText.isEmpty { message += centerText + ", " } + if let rightText = rightLabel.text, !rightText.isEmpty { message += rightText } + accessibilityLabel = message } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillHistoryModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillHistoryModel.swift index 2c74dd3f..d9723ee9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillHistoryModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnBillHistoryModel.swift @@ -6,12 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation public class ListThreeColumnBillHistoryModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- + public static var identifier: String = "list3CBillHst" public var leftLabel: LabelModel public var centerLabel: LabelModel @@ -20,6 +20,7 @@ public class ListThreeColumnBillHistoryModel: ListItemModel, MoleculeModelProtoc //-------------------------------------------------- // MARK: - Initializer //-------------------------------------------------- + public init(leftLabel: LabelModel, centerLabel: LabelModel, rightLabel: LabelModel) { self.leftLabel = leftLabel self.centerLabel = centerLabel @@ -30,6 +31,7 @@ public class ListThreeColumnBillHistoryModel: ListItemModel, MoleculeModelProtoc //-------------------------------------------------- // MARK: - Keys //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { case moleculeName case leftLabel @@ -40,6 +42,7 @@ public class ListThreeColumnBillHistoryModel: ListItemModel, MoleculeModelProtoc //-------------------------------------------------- // MARK: - Codec //-------------------------------------------------- + required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift index 6e0013d1..24da6877 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsage.swift @@ -6,13 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListThreeColumnDataUsage: TableViewCell { //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- + public let leftLabel = Label(fontStyle: .RegularBodySmall) public let centerLabel = Label(fontStyle: .RegularBodySmall) public let rightLabel = Label(fontStyle: .RegularBodySmall) @@ -75,6 +74,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsageModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsageModel.swift index 7f49779a..92484dcb 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsageModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnDataUsageModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListThreeColumnDataUsageModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift index c8aaef83..db464998 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalData.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers public class ListThreeColumnInternationalData: TableViewCell { @@ -19,7 +17,7 @@ import Foundation public let leftLabel = Label(fontStyle: .RegularBodySmall) public let centerLabel = Label(fontStyle: .RegularBodySmall) public let rightLabel = Label(fontStyle: .RegularBodySmall) - public let arrow = Arrow(frame: .zero) + public let arrow = Arrow() public let arrowAndLabel2Stack: Stack //----------------------------------------------------- @@ -85,6 +83,7 @@ import Foundation //-------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift index 01a2d3f5..f97165a7 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnInternationalDataModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListThreeColumnInternationalDataModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift index 28feb481..ba7c8794 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift @@ -6,12 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation @objcMembers open class ListThreeColumnSpeedTest: TableViewCell { //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- + public var title = Label(fontStyle: .RegularMicro) public var topLeftHeadlineBody = HeadlineBody() public var topCenterHeadlineBody = HeadlineBody() @@ -26,6 +26,7 @@ import Foundation //------------------------------------------------------ // MARK: - Initializers //------------------------------------------------------ + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { topHorizontalStack = Stack.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: topCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: topRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal) bottomHorizontalStack = Stack.createStack(with: [(view: bottomLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: bottomCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: bottomRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal) @@ -51,9 +52,12 @@ import Foundation //-------------------------------------------------- // MARK: - ModelMoleculeViewProtocol //-------------------------------------------------- + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListThreeColumnSpeedTestModel else { return } + title.set(with: model.title, delegateObject, additionalData) topHorizontalStack.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.topCenterHeadlineBody, model.topRightHeadlineBody], delegateObject, additionalData) bottomHorizontalStack.updateContainedMolecules(with: [model.bottomLeftHeadlineBody, model.bottomCenterHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData) @@ -78,41 +82,55 @@ import Foundation //-------------------------------------------------- // MARK: - Accessibility //-------------------------------------------------- + func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" + if let title = title.text, !title.isEmpty { message += title + ", " } + if let topLeftHeadlineBodyText = accessibilityTextOfHeadlineBody(topLeftHeadlineBody), !topLeftHeadlineBodyText.isEmpty { message += topLeftHeadlineBodyText + ", " } + if let topCenterHeadlineBodyText = accessibilityTextOfHeadlineBody(topCenterHeadlineBody), !topCenterHeadlineBodyText.isEmpty { message += topCenterHeadlineBodyText + ", " } + if let topRightHeadlineBodyText = accessibilityTextOfHeadlineBody(topRightHeadlineBody), !topRightHeadlineBodyText.isEmpty { message += topRightHeadlineBodyText + ", " } + if let bottomLeftHeadlineBodyText = accessibilityTextOfHeadlineBody(bottomLeftHeadlineBody), !bottomLeftHeadlineBodyText.isEmpty { message += bottomLeftHeadlineBodyText + ", " } + if let bottomCenterHeadlineBodyText = accessibilityTextOfHeadlineBody(bottomCenterHeadlineBody), !bottomCenterHeadlineBodyText.isEmpty { message += bottomCenterHeadlineBodyText + ", " } + if let bottomRightHeadlineBodyText = accessibilityTextOfHeadlineBody(bottomRightHeadlineBody), !bottomRightHeadlineBodyText.isEmpty { message += bottomRightHeadlineBodyText } + accessibilityLabel = message } func accessibilityTextOfHeadlineBody(_ headlineBody: HeadlineBody) -> String? { + var message = "" + if let headlineLabel = headlineBody.headlineLabel.text { message += headlineLabel + ", " } + if let messageLabel = headlineBody.messageLabel.text { message += messageLabel } + return message } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift index 45a9af13..596ad73f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift @@ -6,12 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- + public static var identifier: String = "list3CSpdTst" public var title: LabelModel public var topLeftHeadlineBody: HeadlineBodyModel @@ -24,6 +24,7 @@ public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol //-------------------------------------------------- // MARK: - Initializer //-------------------------------------------------- + public init(title: LabelModel, topLeftHeadlineBody: HeadlineBodyModel, topCenterHeadlineBody: HeadlineBodyModel, topRightHeadlineBody: HeadlineBodyModel, bottomLeftHeadlineBody: HeadlineBodyModel, bottomCenterHeadlineBody: HeadlineBodyModel, bottomRightHeadlineBody: HeadlineBodyModel) { self.title = title self.topLeftHeadlineBody = topLeftHeadlineBody @@ -38,6 +39,7 @@ public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol //------------------------------------------------------ // MARK: - Method //------------------------------------------------------ + override public func setDefaults() { styleHeadlineBody(topLeftHeadlineBody, true) styleHeadlineBody(bottomLeftHeadlineBody, false) @@ -50,8 +52,10 @@ public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol //Method to style headline and body of HeadlineBody func styleHeadlineBody(_ headlineBodyModel: HeadlineBodyModel, _ isBodyMicro: Bool) { + headlineBodyModel.headline?.fontStyle = .RegularMicro headlineBodyModel.headline?.textColor = Color(uiColor: .mvmCoolGray6) + if isBodyMicro { headlineBodyModel.body?.fontStyle = .RegularMicro headlineBodyModel.body?.textColor = Color(uiColor: .mvmCoolGray6) @@ -63,6 +67,7 @@ public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol //-------------------------------------------------- // MARK: - Keys //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { case moleculeName case title @@ -77,6 +82,7 @@ public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol //-------------------------------------------------- // MARK: - Codec //-------------------------------------------------- + required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) title = try typeContainer.decode(LabelModel.self, forKey: .title) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift index 62048a71..10c4511f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListTwoColumnCompareChanges: TableViewCell { //------------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChangesModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChangesModel.swift index c38ee508..0b8ee8a6 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChangesModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChangesModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListTwoColumnCompareChangesModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectors.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectors.swift index d4de25de..6b77e709 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectors.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectors.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers public class ListTwoColumnDropdownSelectors: TableViewCell { //------------------------------------------------------- @@ -60,4 +58,3 @@ import Foundation return 121 } } - diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectorsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectorsModel.swift index 312b2e15..b4209ccd 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectorsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnDropdownSelectorsModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListTwoColumnDropdownSelectorsModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift index 472c522d..c083e457 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift @@ -6,13 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListTwoColumnPriceDescription: TableViewCell { //----------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- + public let leftHeadline = Label(fontStyle: .BoldBodySmall) public let leftBody = Label(fontStyle: .RegularBodySmall) public let rightLabel = Label(fontStyle: .RegularBodySmall) @@ -33,6 +32,7 @@ import Foundation rightVerticalStack = UIStackView(arrangedSubviews: [rightLabel, rightSubLabel]) rightVerticalStack.axis = .vertical rightVerticalStack.alignment = .trailing + rightVerticalStack.setContentCompressionResistancePriority(.required, for: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -48,6 +48,16 @@ import Foundation super.updateView(size) leftVerticalStack.updateView(size) rightVerticalStack.updateView(size) + + // Resolves text layout issues found between both dynamically sized labels, number is not exact but performs as required. + if leftBody.hasText && (rightLabel.hasText || rightSubLabel.hasText) { + let padding = MFStyler.defaultHorizontalPadding(forSize: size) * 2 + let maximumTextWidth = (size - (padding + Padding.Four)) * 0.9 // This percent determines available width. + // Subtracting 10 resolves issues of SE and iPad + leftBody.preferredMaxLayoutWidth = round(maximumTextWidth) - 10 + } else { + leftBody.preferredMaxLayoutWidth = 0 + } } override open func setupView() { @@ -104,7 +114,9 @@ import Foundation //---------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true + var message = "" if let leftHeadline = leftHeadline.text, !leftHeadline.isEmpty { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift index 6e935742..822b5074 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- @@ -85,6 +83,3 @@ public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelPro try container.encode(rightSubLabel, forKey: .rightSubLabel) } } - - - diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift index cc59a15a..95b512b0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import UIKit - @objcMembers open class ListTwoColumnPriceDetails: TableViewCell { //-------------------------------------------------- @@ -70,6 +68,7 @@ import UIKit //---------------------------------------------------- func updateAccessibilityLabel() { + isAccessibilityElement = true var message = "" diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift index 97582574..21ce8da8 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtocol { //--------------------------------------------------