From d7c472b667d9bb0eb3d6f9d193e4c7651e628a6c Mon Sep 17 00:00:00 2001 From: Krishna Kishore Bandaru Date: Fri, 15 Sep 2023 01:07:20 +0530 Subject: [PATCH 01/24] added accessibilitytraits, value, label dynamically from modelJSON --- .../Device/ListDeviceComplexButtonMedium.swift | 1 + .../Device/ListDeviceComplexButtonSmall.swift | 1 + .../ListLeftVariableIconAllTextLinks.swift | 2 +- .../ListLeftVariableIconWithRightCaret.swift | 2 +- ...ariableIconWithRightCaretAllTextLinks.swift | 2 +- ...eftVariableIconWithRightCaretBodyText.swift | 2 +- ...ftVariableNumberedListAllTextAndLinks.swift | 2 +- .../ListLeftVariableNumberedListBodyText.swift | 2 +- .../List/ListProgressBarThin.swift | 2 +- .../List/Miscellaneous/ListStoreLocator.swift | 2 +- ...OneColumnFullWidthTextAllTextAndLinks.swift | 2 +- .../ListOneColumnFullWidthTextBodyText.swift | 2 +- .../List/RightVariable/ListRVWheel.swift | 2 +- ...istRightVariableButtonAllTextAndLinks.swift | 2 +- .../ListRightVariablePayments.swift | 2 +- ...ghtVariablePriceChangeAllTextAndLinks.swift | 2 +- .../ListRightVariablePriceChangeBodyText.swift | 2 +- ...ightVariableRightCaretAlltextAndLinks.swift | 4 ++-- ...tRightVariableTextLinkAllTextAndLinks.swift | 2 +- .../ListRightVariableTotalData.swift | 2 +- .../Atomic/Molecules/Items/ListItemModel.swift | 14 +++++++++++++- .../AccessibilityModelProtocol.swift | 18 ++++++++++++++++++ .../ModelProtocols/ListItemModelProtocol.swift | 2 +- MVMCoreUI/BaseClasses/TableViewCell.swift | 9 +++++++++ 24 files changed, 62 insertions(+), 21 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift index 7a9e8b7e..3dae857d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonMedium.swift @@ -75,6 +75,7 @@ import Foundation delegateObject, additionalData) rightImageView.set(with: model.image, delegateObject, additionalData) updateAccessibilityLabel() + accessibilityTraits.update(with: model.accessibilityTraits ?? button.accessibilityTraits) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift index 7f47929f..b2981158 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexButtonSmall.swift @@ -73,6 +73,7 @@ delegateObject, additionalData) rightImageView.set(with: model.image, delegateObject, additionalData) updateAccessibilityLabel() + accessibilityTraits.update(with: model.accessibilityTraits ?? button.accessibilityTraits) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index 728d8464..ac3d2681 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -77,7 +77,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index 8ffbf06c..2edda50e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift index 0c09e9e3..e062fa53 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift @@ -99,7 +99,7 @@ func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index 6174fc4b..d050574c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -109,6 +109,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index 75096854..d133b035 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -87,7 +87,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift index 1fff77d1..1cad67b4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -89,7 +89,7 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift index 9b85dc4f..d612ef48 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift @@ -131,6 +131,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift index 1e271e87..47f37250 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift @@ -147,7 +147,7 @@ override public var accessibilityTraits: UIAccessibilityTraits { get { if (accessoryView != nil) { - return .button + return listItemModel?.accessibilityTraits ?? .button } else if (!(horizontalStack.stackModel?.molecules[1].gone ?? true)) { return heart.accessibilityTraits } else { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 6e5a7245..bc715483 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -95,7 +95,7 @@ import Foundation // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return (accessoryView != nil) ? .button : .none + return (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index 7a17dd1b..764a60f2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -46,7 +46,7 @@ import Foundation /// Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return (accessoryView != nil) ? .button : .none + return (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index 46c11747..0c08b71b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift index bca4696a..999f2e40 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableButtonAllTextAndLinks.swift @@ -47,7 +47,7 @@ stack.restack() accessibilityValue = button.accessibilityValue accessibilityHint = button.accessibilityHint - accessibilityTraits = .button + accessibilityTraits = (listItemModel?.accessibilityTraits ?? .button) } //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index ae482d8d..565b5c4d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -83,6 +83,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index d0b2ff70..e5de7b41 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -100,7 +100,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift index a03b676d..d7f90345 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift @@ -98,6 +98,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 12f11b9e..51fd0378 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -97,8 +97,8 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none - + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + if !linkShowing { // Make whole cell focusable if no link. accessibilityLabel = getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift index e47cae46..d7851519 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTextLinkAllTextAndLinks.swift @@ -89,7 +89,7 @@ func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 - accessibilityTraits = .button + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing && accessoryView == nil { // Make whole cell focusable if one action diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift index a749041a..407eeacf 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift @@ -95,6 +95,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? .button : .none + accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none } } diff --git a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift index a5320ad2..177550d2 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift @@ -18,7 +18,10 @@ public var hideArrow: Bool? public var line: LineModel? public var style: ListItemStyle? - + public var accessibilityTraits: UIAccessibilityTraits? + public var accessibilityText: String? + public var accessibilityValue: String? + //-------------------------------------------------- // MARK: - Keys //-------------------------------------------------- @@ -29,6 +32,9 @@ case hideArrow case line case style + case accessibilityTraits + case accessibilityText + case accessibilityValue } //-------------------------------------------------- @@ -102,6 +108,9 @@ hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) style = try typeContainer.decodeIfPresent(ListItemStyle.self, forKey: .style) + accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) + accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) + accessibilityValue = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityValue) try super.init(from: decoder) } @@ -113,5 +122,8 @@ try container.encodeIfPresent(hideArrow, forKey: .hideArrow) try container.encodeIfPresent(line, forKey: .line) try container.encodeIfPresent(style, forKey: .style) + try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) + try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText) + try container.encodeIfPresent(accessibilityValue, forKey: .accessibilityValue) } } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift index a7508e39..809334d8 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift @@ -12,6 +12,9 @@ import Foundation public protocol AccessibilityModelProtocol { var accessibilityIdentifier: String? { get set } + var accessibilityTraits: UIAccessibilityTraits? { get set } + var accessibilityText: String? { get set } + var accessibilityValue: String? { get set } } public extension AccessibilityModelProtocol { @@ -20,4 +23,19 @@ public extension AccessibilityModelProtocol { get { nil } set { } } + + var accessibilityTraits: UIAccessibilityTraits? { + get { nil } + set { } + } + + var accessibilityText: String? { + get { nil } + set { } + } + + var accessibilityValue: String? { + get { nil } + set { } + } } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift index 3c64fdb4..b3b7be7e 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift @@ -15,7 +15,7 @@ public enum ListItemStyle: String, Codable { case none } -public protocol ListItemModelProtocol: ContainerModelProtocol { +public protocol ListItemModelProtocol: ContainerModelProtocol, AccessibilityModelProtocol { var line: LineModel? { get set } var action: ActionModelProtocol? { get set } var hideArrow: Bool? { get set } diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index c21e2c49..f5bb8bf1 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -163,6 +163,15 @@ import UIKit // align if needed. containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol) + + if let traits = model.accessibilityTraits { + accessibilityTraits.update(with: traits) + } + if let accessibilityText = model.accessibilityText { + accessibilityLabel = accessibilityText + isAccessibilityElement = true + } + accessibilityValue = model.accessibilityValue } open func reset() { From eb9ec0086618709faf73c85268ace4eeb092ca8a Mon Sep 17 00:00:00 2001 From: Krishna Kishore Bandaru Date: Fri, 15 Sep 2023 01:17:53 +0530 Subject: [PATCH 02/24] updated button traits dynamically --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 4 ++++ MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift | 4 +++- MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift | 6 ++++-- MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index 08afefde..ce5a846e 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -73,6 +73,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat _backgroundColor = newValue } } + public var accessibilityTraits: UIAccessibilityTraits? //-------------------------------------------------- // MARK: - Methods @@ -195,6 +196,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat case disabledTextColor case disabledBorderColor case width + case accessibilityTraits } //-------------------------------------------------- @@ -263,6 +265,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width) + accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) } open func encode(to encoder: Encoder) throws { @@ -286,5 +289,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat try container.encodeIfPresent(size, forKey: .size) try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(width, forKey: .width) + try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift index 323236a7..394f7d86 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift @@ -33,7 +33,9 @@ import Foundation super.set(with: model, delegateObject, additionalData) FormValidator.setupValidation(for: castModel, delegate: delegateObject?.formHolderDelegate) - + if let traits = model.accessibilityTraits { + accessibilityTraits = traits + } } public func setState() { diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift index a61ec150..75b6c923 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift @@ -24,7 +24,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro public var enabled: Bool = true public var enabledTintColor: Color? public var disabledTintColor: Color? - + public var accessibilityTraits: UIAccessibilityTraits? public var groupName: String = "" public var updateUI: ActionBlock? @@ -45,6 +45,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro case groupName case enabledTintColor case disabledTintColor + case accessibilityTraits } //-------------------------------------------------- @@ -59,7 +60,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) action = try typeContainer.decodeModel(codingKey: .action) - + accessibilityTraits = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityTraits) if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { self.enabled = enabled } @@ -90,5 +91,6 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(enabledTintColor, forKey: .enabledTintColor) try container.encodeIfPresent(disabledTintColor, forKey: .disabledTintColor) + try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index e578fa51..71d5c332 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -173,6 +173,9 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { } FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) + if let traits = model.accessibilityTraits { + accessibilityTraits = traits + } } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { From 14ac43d0eaedcf3f478e7936fe33dc7664f7e089 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Fri, 15 Sep 2023 16:34:28 +0530 Subject: [PATCH 03/24] Update ImageButtonModel.swift --- MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift index 75b6c923..74325d85 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift @@ -60,7 +60,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) action = try typeContainer.decodeModel(codingKey: .action) - accessibilityTraits = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityTraits) + accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { self.enabled = enabled } From c972597a117a01bc333b138f3e7f4df2041e3d5a Mon Sep 17 00:00:00 2001 From: Keerthy Date: Fri, 13 Oct 2023 23:31:18 +0530 Subject: [PATCH 04/24] Addressed review comments --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 8 ++++++++ MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift | 2 +- MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift | 8 ++++---- .../LeftVariable/ListLeftVariableIconWithRightCaret.swift | 2 +- .../ListLeftVariableIconWithRightCaretAllTextLinks.swift | 2 +- .../ListLeftVariableIconWithRightCaretBodyText.swift | 2 +- .../ListLeftVariableNumberedListAllTextAndLinks.swift | 2 +- .../ListLeftVariableNumberedListBodyText.swift | 2 +- .../DesignedComponents/List/ListProgressBarThin.swift | 2 +- .../ListOneColumnFullWidthTextAllTextAndLinks.swift | 2 +- .../OneColumn/ListOneColumnFullWidthTextBodyText.swift | 2 +- .../List/RightVariable/ListRVWheel.swift | 2 +- .../List/RightVariable/ListRightVariablePayments.swift | 2 +- .../ListRightVariablePriceChangeAllTextAndLinks.swift | 2 +- .../ListRightVariablePriceChangeBodyText.swift | 2 +- .../ListRightVariableRightCaretAlltextAndLinks.swift | 2 +- .../List/RightVariable/ListRightVariableTotalData.swift | 2 +- 17 files changed, 27 insertions(+), 19 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index ce5a846e..e455589b 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -74,6 +74,8 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat } } public var accessibilityTraits: UIAccessibilityTraits? + public var disabledAccessibilityTraits: UIAccessibilityTraits? + public var isAccessibilityElement: Bool? //-------------------------------------------------- // MARK: - Methods @@ -197,6 +199,8 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat case disabledBorderColor case width case accessibilityTraits + case disabledAccessibilityTraits + case isAccessibilityElement } //-------------------------------------------------- @@ -266,6 +270,8 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width) accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) + disabledAccessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .disabledAccessibilityTraits) + isAccessibilityElement = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAccessibilityElement) } open func encode(to encoder: Encoder) throws { @@ -290,5 +296,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(width, forKey: .width) try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) + try container.encodeIfPresent(disabledAccessibilityTraits, forKey: .disabledAccessibilityTraits) + try container.encodeIfPresent(isAccessibilityElement, forKey: .isAccessibilityElement) } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift index 74325d85..8f4bb522 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift @@ -60,7 +60,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) action = try typeContainer.decodeModel(codingKey: .action) - accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) + accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) ?? .button if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { self.enabled = enabled } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index 71d5c332..f4b3e257 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -101,7 +101,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { #if DEBUG // Useful to detect with isHittable when performing UI testing. - isAccessibilityElement = isEnabled + isAccessibilityElement = model?.isAccessibilityElement ?? isEnabled #endif if isEnabled { @@ -134,6 +134,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { case .standard: verticalPadding = Padding.Three horizontalPadding = Padding.Five + break case .small: verticalPadding = Padding.Two @@ -173,9 +174,8 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { } FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) - if let traits = model.accessibilityTraits { - accessibilityTraits = traits - } + accessibilityTraits = isEnabled ? (model.accessibilityTraits ?? .button) : (model.disabledAccessibilityTraits ?? .none) + } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index 2edda50e..2a2adb27 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift index e062fa53..d65e35e5 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift @@ -99,7 +99,7 @@ func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index d050574c..70c8ea60 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -109,6 +109,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index d133b035..cf119b33 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -87,7 +87,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift index 1cad67b4..4a6667df 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -89,7 +89,7 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift index d612ef48..ab8eee78 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift @@ -131,6 +131,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index bc715483..0fece30a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -95,7 +95,7 @@ import Foundation // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + return listItemModel?.accessibilityTraits ?? .button } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index da77d173..e62ce891 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -46,7 +46,7 @@ import Foundation /// Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + return listItemModel?.accessibilityTraits ?? .button } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index 0c08b71b..cbd9741d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 565b5c4d..eeb09ee5 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -83,6 +83,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index e5de7b41..6ed847a9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -100,7 +100,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift index d7f90345..7fafd3f0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift @@ -98,6 +98,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 51fd0378..6b059dbc 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -97,7 +97,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift index 407eeacf..cd7a6db9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift @@ -95,6 +95,6 @@ } accessibilityLabel = message - accessibilityTraits = (accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = listItemModel?.accessibilityTraits ?? .button } } From fb760bf91e84f4519923995ba18895f7f60999da Mon Sep 17 00:00:00 2001 From: Keerthy Date: Fri, 20 Oct 2023 00:18:29 +0530 Subject: [PATCH 05/24] Added dynamic trait for ListStoreLocator --- .../List/Miscellaneous/ListStoreLocator.swift | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift index 47f37250..3c69d6a4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift @@ -146,13 +146,7 @@ // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - if (accessoryView != nil) { - return listItemModel?.accessibilityTraits ?? .button - } else if (!(horizontalStack.stackModel?.molecules[1].gone ?? true)) { - return heart.accessibilityTraits - } else { - return .none - } + return listItemModel?.accessibilityTraits ?? .button } set { } } From 43f1c64151005291522509a570ad5489739a48bd Mon Sep 17 00:00:00 2001 From: Keerthy Date: Thu, 26 Oct 2023 18:44:51 +0530 Subject: [PATCH 06/24] updated logic --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 4 ---- MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift | 6 +++--- MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift | 4 ++-- .../LeftVariable/ListLeftVariableIconAllTextLinks.swift | 2 +- .../LeftVariable/ListLeftVariableIconWithRightCaret.swift | 2 +- .../ListLeftVariableIconWithRightCaretAllTextLinks.swift | 2 +- .../ListLeftVariableIconWithRightCaretBodyText.swift | 2 +- .../ListLeftVariableNumberedListAllTextAndLinks.swift | 2 +- .../LeftVariable/ListLeftVariableNumberedListBodyText.swift | 2 +- .../DesignedComponents/List/ListProgressBarThin.swift | 2 +- .../List/Miscellaneous/ListStoreLocator.swift | 2 +- .../ListOneColumnFullWidthTextAllTextAndLinks.swift | 3 ++- .../List/OneColumn/ListOneColumnFullWidthTextBodyText.swift | 2 +- .../DesignedComponents/List/RightVariable/ListRVWheel.swift | 2 +- .../List/RightVariable/ListRightVariablePayments.swift | 2 +- .../ListRightVariablePriceChangeAllTextAndLinks.swift | 2 +- .../ListRightVariablePriceChangeBodyText.swift | 2 +- .../ListRightVariableRightCaretAlltextAndLinks.swift | 2 +- .../List/RightVariable/ListRightVariableTotalData.swift | 2 +- .../NavigationController/NavigationController.swift | 4 ++++ .../MVMCoreUISplitViewController+Extension.swift | 4 ++++ MVMCoreUI/Managers/SubNav/SubNavManagerController.swift | 4 ++++ 22 files changed, 34 insertions(+), 25 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index e455589b..c06d31fc 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -75,7 +75,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat } public var accessibilityTraits: UIAccessibilityTraits? public var disabledAccessibilityTraits: UIAccessibilityTraits? - public var isAccessibilityElement: Bool? //-------------------------------------------------- // MARK: - Methods @@ -200,7 +199,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat case width case accessibilityTraits case disabledAccessibilityTraits - case isAccessibilityElement } //-------------------------------------------------- @@ -271,7 +269,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width) accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) disabledAccessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .disabledAccessibilityTraits) - isAccessibilityElement = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAccessibilityElement) } open func encode(to encoder: Encoder) throws { @@ -297,6 +294,5 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat try container.encodeIfPresent(width, forKey: .width) try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits) try container.encodeIfPresent(disabledAccessibilityTraits, forKey: .disabledAccessibilityTraits) - try container.encodeIfPresent(isAccessibilityElement, forKey: .isAccessibilityElement) } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift index 394f7d86..f3dc2798 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift @@ -33,9 +33,6 @@ import Foundation super.set(with: model, delegateObject, additionalData) FormValidator.setupValidation(for: castModel, delegate: delegateObject?.formHolderDelegate) - if let traits = model.accessibilityTraits { - accessibilityTraits = traits - } } public func setState() { @@ -49,6 +46,9 @@ import Foundation } else if let disabledTintColor = castModel.disabledTintColor { image.imageView.tintColor = disabledTintColor.uiColor } + if let traits = model?.accessibilityTraits { + accessibilityTraits = traits + } } diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index f4b3e257..579236e9 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -101,7 +101,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { #if DEBUG // Useful to detect with isHittable when performing UI testing. - isAccessibilityElement = model?.isAccessibilityElement ?? isEnabled + isAccessibilityElement = isEnabled #endif if isEnabled { @@ -121,6 +121,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { self.borderColor = borderColor } } + accessibilityTraits = isEnabled ? (model?.accessibilityTraits ?? .button) : (model?.disabledAccessibilityTraits ?? .none) } private func getInnerPadding() -> CGFloat { @@ -174,7 +175,6 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { } FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate) - accessibilityTraits = isEnabled ? (model.accessibilityTraits ?? .button) : (model.disabledAccessibilityTraits ?? .none) } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift index ac3d2681..b9d234bb 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconAllTextLinks.swift @@ -77,7 +77,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? (listItemModel?.accessibilityTraits ?? .button) : .none + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift index 2a2adb27..cd1b20d9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift index d65e35e5..48d4affe 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretAllTextLinks.swift @@ -99,7 +99,7 @@ func updateAccessibilityLabel() { let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift index 70c8ea60..cf83dcd9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretBodyText.swift @@ -109,6 +109,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index cf119b33..d4e9b6ce 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -87,7 +87,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift index 4a6667df..ea81bc55 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -89,7 +89,7 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift index ab8eee78..b3861703 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift @@ -131,6 +131,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift index 3c69d6a4..d1ccd921 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift @@ -146,7 +146,7 @@ // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return listItemModel?.accessibilityTraits ?? .button + return (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } set { } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift index 0fece30a..d2177ede 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift @@ -95,7 +95,8 @@ import Foundation // Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return listItemModel?.accessibilityTraits ?? .button + return (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) + } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index e62ce891..ff14df7f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -46,7 +46,7 @@ import Foundation /// Ensures voice over does not read "selected" after user triggers action on cell. override public var accessibilityTraits: UIAccessibilityTraits { get { - return listItemModel?.accessibilityTraits ?? .button + return (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } set {} } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index cbd9741d..be3f7370 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -91,6 +91,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index eeb09ee5..a662a587 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -83,6 +83,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index 6ed847a9..f11c7278 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -100,7 +100,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift index 7fafd3f0..b13a389e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeBodyText.swift @@ -98,6 +98,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 6b059dbc..37af1350 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -97,7 +97,7 @@ let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 isAccessibilityElement = !linkShowing - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none) if !linkShowing { // Make whole cell focusable if no link. diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift index cd7a6db9..345feca1 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift @@ -95,6 +95,6 @@ } accessibilityLabel = message - accessibilityTraits = listItemModel?.accessibilityTraits ?? .button + accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none) } } diff --git a/MVMCoreUI/Containers/NavigationController/NavigationController.swift b/MVMCoreUI/Containers/NavigationController/NavigationController.swift index 8f72a792..5226ee87 100644 --- a/MVMCoreUI/Containers/NavigationController/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController/NavigationController.swift @@ -83,6 +83,10 @@ import Combine } extension NavigationController: MVMCoreViewManagerProtocol { + public func getAccessibilityElements() -> [Any]? { + return [] + } + public func getCurrentViewController() -> UIViewController? { guard let topViewController = topViewController else { return nil } return MVMCoreUIUtility.getViewControllerTraversingManagers(topViewController) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index 20f4449c..b15a90aa 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -249,6 +249,10 @@ public extension MVMCoreUISplitViewController { } extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol { + public func getAccessibilityElements() -> [Any]? { + return [] + } + public func getCurrentViewController() -> UIViewController? { navigationController?.getCurrentViewController() } diff --git a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift index 458c0169..32ded335 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift @@ -10,6 +10,10 @@ import Foundation import MVMCore open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, TabsDelegate, MVMCorePresentationDelegateProtocol, SubNavSwipeNavigationProtocol { + public func getAccessibilityElements() -> [Any]? { + return [] + } + /// The current managed view controller private var viewController: UIViewController From 1e5578a66cfc7934066f0a3482977287146a9372 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Thu, 26 Oct 2023 22:06:55 +0530 Subject: [PATCH 07/24] discarded unwanted changes --- MVMCoreUI/Managers/SubNav/SubNavManagerController.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift index 32ded335..458c0169 100644 --- a/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift +++ b/MVMCoreUI/Managers/SubNav/SubNavManagerController.swift @@ -10,10 +10,6 @@ import Foundation import MVMCore open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, TabsDelegate, MVMCorePresentationDelegateProtocol, SubNavSwipeNavigationProtocol { - public func getAccessibilityElements() -> [Any]? { - return [] - } - /// The current managed view controller private var viewController: UIViewController From d65df06934ac1726ae6bba899af3f34859b52f60 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Wed, 22 Nov 2023 18:07:13 +0530 Subject: [PATCH 08/24] Updated textView to have label text for accessibility behavior --- .../Atoms/FormFields/TextFields/TextViewEntryField.swift | 7 ++++++- MVMCoreUI/BaseClasses/TextView.swift | 1 - .../SupportingFiles/Strings/en.lproj/Localizable.strings | 1 + .../Strings/es-MX.lproj/Localizable.strings | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift index 3221f043..e92e7127 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift @@ -281,6 +281,11 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele if model.hideBorders { adjustMarginConstraints(constant: 0) } - + setAccessibilityString(model.title) + } + + override func setAccessibilityString(_ accessibilityString: String?) { + let accessibilityString = accessibilityString ?? "" + textView.accessibilityLabel = "\(String(describing: accessibilityString)) \(self.textView.isEnabled ? "" : MVMCoreUIUtility.hardcodedString(withKey: "textfield_disabled_state") ?? "")" } } diff --git a/MVMCoreUI/BaseClasses/TextView.swift b/MVMCoreUI/BaseClasses/TextView.swift index 8d09ca35..5e4f1c07 100644 --- a/MVMCoreUI/BaseClasses/TextView.swift +++ b/MVMCoreUI/BaseClasses/TextView.swift @@ -98,7 +98,6 @@ import UIKit smartInsertDeleteType = .no inputAccessoryView = nil isAccessibilityElement = true - accessibilityTraits = .staticText font = fontStyle.getFont() keyboardType = .default isEditable = true diff --git a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings index 0b736bf9..05cadbf5 100644 --- a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings @@ -27,6 +27,7 @@ // MARK: Textfield "textfield_today_string" = "Today"; "textfield_error_message" = "%@.\n The error message.\n %@"; +"textView_error_message" = "%@.\n The error message.\n %@"; "textfield_picker_item" = " picker item"; "textfield_regular" = " regular"; "textfield_disabled_state" = "disabled"; diff --git a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings index b279ccdb..60cc1677 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings @@ -23,6 +23,7 @@ // Textfield "textfield_today_string" = "Hoy"; "textfield_error_message" = "%@.\n El mensaje de error.\n %@"; +"textView_error_message" = "%@.\n El mensaje de error.\n %@"; "textfield_picker_item" = " artículo de selector"; "textfield_regular" = " regular"; "textfield_disabled_state" = "inactivo"; From 8de78987f88a851cea33a75500841496e0d9df3a Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Fri, 1 Dec 2023 14:32:44 +0530 Subject: [PATCH 09/24] Setting accessibility label if available before text for eyebrow, headline, body labels in EyebrowHeadlineBodyLink molecule's accessibility label --- .../VerticalCombinationViews/EyebrowHeadlineBodyLink.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index a25426d7..da5e959e 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -88,15 +88,15 @@ var message = "" - if let eyebrowLabel = eyebrow.text { + if let eyebrowLabel = eyebrow.accessibilityLabel ?? eyebrow.text { message += eyebrowLabel + ", " } - if let headlineLabel = headline.text { + if let headlineLabel = headline.accessibilityLabel ?? headline.text { message += headlineLabel + ", " } - if let bodyLabel = body.text { + if let bodyLabel = body.accessibilityLabel ?? body.text { message += bodyLabel } From 6e5980af64c51c1e0998b06d5d8e1b2b56c1b9c9 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Fri, 1 Dec 2023 14:12:04 -0500 Subject: [PATCH 10/24] Index check before switching tabs. --- .../HorizontalCombinationViews/TabBar.swift | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index 605acc3d..01e71db8 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -84,16 +84,22 @@ import VDSColorTokens // MARK: - TabBarProtocol @MainActor public func highlightTab(at index: Int) { - guard let newSelectedItem = items?[index] else { return } + guard let items = items, index < items.count else { + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available (\(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + return + } tabModel.selectedTab = index - selectedItem = newSelectedItem + selectedItem = items[index] } @MainActor public func selectTab(at index: Int) { - guard let newSelectedItem = items?[index] else { return } - selectedItem = newSelectedItem - tabBar(self, didSelect: newSelectedItem) + guard let items = items, index < items.count else { + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available (\(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + return + } + selectedItem = items[index] + tabBar(self, didSelect: items[index]) } public func currentTabIndex() -> Int { tabModel.selectedTab } From 21f24b2c9b339e8d5232383caedbd0ffc67694b9 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Fri, 1 Dec 2023 14:16:00 -0500 Subject: [PATCH 11/24] remove extra paranthesis --- .../Atomic/Molecules/HorizontalCombinationViews/TabBar.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index 01e71db8..d0252419 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -85,7 +85,7 @@ import VDSColorTokens @MainActor public func highlightTab(at index: Int) { guard let items = items, index < items.count else { - MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available (\(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) return } tabModel.selectedTab = index @@ -95,7 +95,7 @@ import VDSColorTokens @MainActor public func selectTab(at index: Int) { guard let items = items, index < items.count else { - MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available (\(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) return } selectedItem = items[index] From 8b64b2b52a458fb7ed7d23bb0de24e353dbb85a9 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Fri, 1 Dec 2023 14:32:33 -0500 Subject: [PATCH 12/24] Ensure index > 0 for those tricky ones. --- .../Molecules/HorizontalCombinationViews/TabBar.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift index d0252419..65b116f5 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabBar.swift @@ -84,8 +84,8 @@ import VDSColorTokens // MARK: - TabBarProtocol @MainActor public func highlightTab(at index: Int) { - guard let items = items, index < items.count else { - MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + guard let items = items, index >= 0, index < items.count else { + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Invalid tab index \(index). \(items?.count ?? 0) tabs available .", code: 0, domain: ErrorDomainSystem, location: #function)!) return } tabModel.selectedTab = index @@ -94,8 +94,8 @@ import VDSColorTokens @MainActor public func selectTab(at index: Int) { - guard let items = items, index < items.count else { - MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Tab index \(index) is greater than the number of tabs available \(items?.count ?? 0).", code: 0, domain: ErrorDomainSystem, location: #function)!) + guard let items = items, index >= 0, index < items.count else { + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Invalid tab index \(index). \(items?.count ?? 0) tabs available.", code: 0, domain: ErrorDomainSystem, location: #function)!) return } selectedItem = items[index] From 9f2a1cb6d1f8a68c401f662b4eb4a03b2725fe87 Mon Sep 17 00:00:00 2001 From: Sureshkumar Ramachandran Date: Fri, 8 Dec 2023 14:42:50 +0530 Subject: [PATCH 13/24] Hamberg menu fix --- .../MVMCoreUISplitViewController+Extension.swift | 2 +- .../SplitViewController/MVMCoreUISplitViewController.h | 2 +- .../SplitViewController/MVMCoreUISplitViewController.m | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index 55e1071c..d407fdc3 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -263,7 +263,7 @@ extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol { } public func willDisplay(_ viewController: UIViewController) { - setupPanels() + setupPanels(viewController) updateState(with: viewController) } diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index a5c1577f..ac057f10 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -99,7 +99,7 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { - (void)setNavigationIconColor:(nullable UIColor *)color; /// Updates the panels that are used. -- (void)setupPanels; +- (void)setupPanels:(nullable UIViewController*)viewController; /// Returns if the left panel is staying extended (usually do to screen size threshold) - (BOOL)leftPanelStaysExtended; diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index c43d17d9..462bb6af 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -723,9 +723,9 @@ CGFloat const PanelAnimationDuration = 0.2; [panel removeFromParentViewController]; } -- (void)setupLeftPanel { +- (void)setupLeftPanel:(nullable UIViewController*)viewController { UIViewController *panel = nil; - UIViewController *currentViewController = [self getCurrentDetailViewController]; + UIViewController *currentViewController = viewController ? viewController : [self getCurrentDetailViewController]; if ([currentViewController respondsToSelector:@selector(overrideLeftPanel)]) { panel = [((UIViewController *)currentViewController) overrideLeftPanel]; } else { @@ -795,9 +795,9 @@ CGFloat const PanelAnimationDuration = 0.2; } } -- (void)setupPanels { +- (void)setupPanels:(nullable UIViewController*)viewController { [self forceHideBothDrawers]; - [self setupLeftPanel]; + [self setupLeftPanel:viewController]; [self setupRightPanel]; self.explictlyShowingPanel = nil; [self.view layoutIfNeeded]; @@ -968,7 +968,7 @@ CGFloat const PanelAnimationDuration = 0.2; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:coverView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; - [self setupPanels]; + [self setupPanels:nil]; } - (void)viewDidLoad { From fed441360678cea38d9b6b8e008b59780d06472f Mon Sep 17 00:00:00 2001 From: Sureshkumar Ramachandran Date: Fri, 8 Dec 2023 17:33:44 +0530 Subject: [PATCH 14/24] To avoid display on the hamberg menu at discover screen(Homescreen) --- .../SplitViewController/MVMCoreUISplitViewController.m | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 462bb6af..79c81b8d 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -735,6 +735,7 @@ CGFloat const PanelAnimationDuration = 0.2; if (!panel) { [self removePanel:self.leftPanel]; + self.leftPanel = nil; } else if (panel && panel != self.leftPanel) { [self removePanel:self.leftPanel]; [self addPanel:panel]; From cac849fadc48c192761d0656b21ae0ac4e4cdbba Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Mon, 11 Dec 2023 10:48:37 -0500 Subject: [PATCH 15/24] text field Spanish localization for optional --- MVMCoreUI/Atomic/Atoms/Views/Label/FormLabelModel.swift | 2 +- MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings | 2 +- .../SupportingFiles/Strings/es-MX.lproj/Localizable.strings | 1 + MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/FormLabelModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/FormLabelModel.swift index c7552047..aee432e8 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/FormLabelModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/FormLabelModel.swift @@ -64,7 +64,7 @@ public class FormLabelModel: EnableableModelProtocol { if enabled { required.attributes = [LabelAttributeColorModel(FormLabelModel.defaultRequiredTextColor, model.text.count + 1, 8)] } - required.text = "\(model.text) Optional" + required.text = "\(model.text) \(MVMCoreUIUtility.hardcodedString(withKey: "textfield_optional") ?? "")" return required } diff --git a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings index 0b736bf9..c5b9478e 100644 --- a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings @@ -30,7 +30,7 @@ "textfield_picker_item" = " picker item"; "textfield_regular" = " regular"; "textfield_disabled_state" = "disabled"; - +"textfield_optional" = "Optional"; // MARK: MDNTextfield "textfield_contacts_barbutton" = "My Contacts"; diff --git a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings index b279ccdb..b68dd624 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es-MX.lproj/Localizable.strings @@ -26,6 +26,7 @@ "textfield_picker_item" = " artículo de selector"; "textfield_regular" = " regular"; "textfield_disabled_state" = "inactivo"; +"textfield_optional" = "Opcional"; //MDNTextfield "textfield_contacts_barbutton" = "Mis contactos"; "textfield_phone_format_error_message" = "Formato de número de teléfono inválido."; diff --git a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings index 150ac167..7eb53fa7 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings @@ -26,6 +26,7 @@ "textfield_picker_item" = " artículo de selector"; "textfield_regular" = " regular"; "textfield_disabled_state" = "inactivo"; +"textfield_optional" = "Opcional"; //MDNTextfield "textfield_contacts_barbutton" = "Mis contactos"; "textfield_phone_format_error_message" = "Formato de número de teléfono inválido."; From ad48df224219425fee72b33c3dad483aec756b01 Mon Sep 17 00:00:00 2001 From: "Rajendran, Nandhini" Date: Thu, 21 Dec 2023 16:28:22 +0000 Subject: [PATCH 16/24] story: ONEAPP-4156 LoggingHandler Swift migration --- MVMCoreUI.xcodeproj/project.pbxproj | 14 +++++------ .../Atomic/Atoms/Views/Label/Label.swift | 10 +++----- .../Atomic/Atoms/Views/Video/Video.swift | 2 +- .../OtherContainers/ModuleMolecule.swift | 2 +- .../Protocols/MoleculeViewProtocol.swift | 2 +- .../BaseControllers/ViewController.swift | 2 +- .../PageBehaviorHandlerProtocol.swift | 2 +- MVMCoreUI/FormUIHelpers/FormValidator.swift | 2 +- MVMCoreUI/MVMCoreUI.h | 1 - .../Notification/NotificationHandler.swift | 2 +- .../OtherHandlers/MVMCoreUILoggingHandler.h | 24 ------------------- .../OtherHandlers/MVMCoreUILoggingHandler.m | 23 ------------------ .../MVMCoreUILoggingHandler.swift | 21 ++++++++++++++++ MVMCoreUI/Utility/MFFonts.m | 7 ++++-- 14 files changed, 42 insertions(+), 72 deletions(-) delete mode 100644 MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h delete mode 100644 MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m create mode 100644 MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 8619ce46..e8c2d064 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -168,8 +168,10 @@ 526A265E240D200500B0D828 /* ListTwoColumnCompareChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */; }; 52B201D224081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B201D024081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift */; }; 52B201D324081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B201D124081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift */; }; + 608211282AC6B57E00C3FC39 /* MVMCoreUILoggingHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 608211262AC6AF8200C3FC39 /* MVMCoreUILoggingHandler.swift */; }; 7199C8162A4F3A64001568B7 /* AccessibilityHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7199C8152A4F3A64001568B7 /* AccessibilityHandler.swift */; }; 71BE969E2AD96BE6000B5DB7 /* RotorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71BE969D2AD96BE6000B5DB7 /* RotorHandler.swift */; }; + 608211282AC6B57E00C3FC39 /* MVMCoreUILoggingHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 608211262AC6AF8200C3FC39 /* MVMCoreUILoggingHandler.swift */; }; 8D070BB0241B56530099AC56 /* ListRightVariableTotalDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D070BAF241B56530099AC56 /* ListRightVariableTotalDataModel.swift */; }; 8D070BB2241B56AD0099AC56 /* ListRightVariableTotalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D070BB1241B56AD0099AC56 /* ListRightVariableTotalData.swift */; }; 8D084AD02410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */; }; @@ -473,8 +475,6 @@ D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF26921E6AA0B003B2FB9 /* FLAnimatedImageView.m */; }; D29DF26E21E6AA0B003B2FB9 /* FLAnimatedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF26A21E6AA0B003B2FB9 /* FLAnimatedImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29DF26F21E6AA0B003B2FB9 /* FLAnimatedImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF26B21E6AA0B003B2FB9 /* FLAnimatedImageView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D29DF27521E79E81003B2FB9 /* MVMCoreUILoggingHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF27321E79E81003B2FB9 /* MVMCoreUILoggingHandler.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D29DF27621E79E81003B2FB9 /* MVMCoreUILoggingHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF27421E79E81003B2FB9 /* MVMCoreUILoggingHandler.m */; }; D29DF27921E7A533003B2FB9 /* MVMCoreUISession.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF27721E7A533003B2FB9 /* MVMCoreUISession.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */ = {isa = PBXBuildFile; fileRef = D29DF27821E7A533003B2FB9 /* MVMCoreUISession.m */; }; D29DF28021E7AA51003B2FB9 /* MVMCoreUIDetailViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D29DF27F21E7AA50003B2FB9 /* MVMCoreUIDetailViewProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -760,8 +760,10 @@ 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnCompareChanges.swift; sourceTree = ""; }; 52B201D024081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAndPaymentMethod.swift; sourceTree = ""; }; 52B201D124081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAndPaymentMethodModel.swift; sourceTree = ""; }; + 608211262AC6AF8200C3FC39 /* MVMCoreUILoggingHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUILoggingHandler.swift; sourceTree = ""; }; 7199C8152A4F3A64001568B7 /* AccessibilityHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityHandler.swift; sourceTree = ""; }; 71BE969D2AD96BE6000B5DB7 /* RotorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RotorHandler.swift; sourceTree = ""; }; + 608211262AC6AF8200C3FC39 /* MVMCoreUILoggingHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMCoreUILoggingHandler.swift; sourceTree = ""; }; 8D070BAF241B56530099AC56 /* ListRightVariableTotalDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableTotalDataModel.swift; sourceTree = ""; }; 8D070BB1241B56AD0099AC56 /* ListRightVariableTotalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableTotalData.swift; sourceTree = ""; }; 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextBodyTextModel.swift; sourceTree = ""; }; @@ -1073,8 +1075,6 @@ D29DF26921E6AA0B003B2FB9 /* FLAnimatedImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLAnimatedImageView.m; sourceTree = ""; }; D29DF26A21E6AA0B003B2FB9 /* FLAnimatedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLAnimatedImage.h; sourceTree = ""; }; D29DF26B21E6AA0B003B2FB9 /* FLAnimatedImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLAnimatedImageView.h; sourceTree = ""; }; - D29DF27321E79E81003B2FB9 /* MVMCoreUILoggingHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUILoggingHandler.h; sourceTree = ""; }; - D29DF27421E79E81003B2FB9 /* MVMCoreUILoggingHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUILoggingHandler.m; sourceTree = ""; }; D29DF27721E7A533003B2FB9 /* MVMCoreUISession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUISession.h; sourceTree = ""; }; D29DF27821E7A533003B2FB9 /* MVMCoreUISession.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUISession.m; sourceTree = ""; }; D29DF27F21E7AA50003B2FB9 /* MVMCoreUIDetailViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIDetailViewProtocol.h; sourceTree = ""; }; @@ -2291,8 +2291,7 @@ D2B18B912361E65A00A9AEDC /* CoreUIObject.swift */, D29DF27721E7A533003B2FB9 /* MVMCoreUISession.h */, D29DF27821E7A533003B2FB9 /* MVMCoreUISession.m */, - D29DF27321E79E81003B2FB9 /* MVMCoreUILoggingHandler.h */, - D29DF27421E79E81003B2FB9 /* MVMCoreUILoggingHandler.m */, + 608211262AC6AF8200C3FC39 /* MVMCoreUILoggingHandler.swift */, AFA4933E29E874F0001A9663 /* MVMCoreUILoggingDelegateProtocol.swift */, D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */, D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */, @@ -2530,7 +2529,6 @@ D29DF25921E6A22D003B2FB9 /* MFButtonProtocol.h in Headers */, D29DF28421E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.h in Headers */, D29DF2CE21E7C104003B2FB9 /* MFLoadingViewController.h in Headers */, - D29DF27521E79E81003B2FB9 /* MVMCoreUILoggingHandler.h in Headers */, D29DF2B321E7B76D003B2FB9 /* MFLoadingSpinner.h in Headers */, D20492A424329A2800A5EED6 /* MVMCoreUIPagingProtocol.h in Headers */, D296E14722A5984C0051EBE7 /* MVMCoreUIViewConstrainingProtocol.h in Headers */, @@ -2755,6 +2753,7 @@ D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */, D28A837B23C928DA00DFE4FC /* MoleculeListCellProtocol.swift in Sources */, D28BA74D248589C800B75CB8 /* TabPageModelProtocol.swift in Sources */, + 608211282AC6B57E00C3FC39 /* MVMCoreUILoggingHandler.swift in Sources */, 014AA72F23C5059B006F3E93 /* ThreeLayerPageTemplateModel.swift in Sources */, 0A21DB91235E0EDB00C160A2 /* DigitBox.swift in Sources */, BBAA4F04243D8E3B005AAD5F /* RadioBoxModel.swift in Sources */, @@ -2762,7 +2761,6 @@ D21B7F71243BAC1600051ABF /* CollectionViewCell.swift in Sources */, AAA905E124D1759A00D1EFAB /* ListThreeColumnBillHistory.swift in Sources */, C7F8012323E846C300396FBD /* ListRVWheelModel.swift in Sources */, - D29DF27621E79E81003B2FB9 /* MVMCoreUILoggingHandler.m in Sources */, D2ED27EC254B0CE700A1C293 /* UIAlertControllerStyle+Extension.swift in Sources */, C695A69623C990BC00BFB94E /* DoughnutChart.swift in Sources */, 014AA72D23C5059B006F3E93 /* StackPageTemplateModel.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 9af907e1..59611756 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -231,7 +231,7 @@ public typealias ActionBlock = () -> () documentAttributes: nil) } catch { if let coreErrorObject = MVMCoreErrorObject.createErrorObject(for: error, location: "LabelHTMLParse") { - MVMCoreUILoggingHandler.addError(toLog: coreErrorObject) + MVMCoreUILoggingHandler.shared()?.addError(toLog: coreErrorObject) } } } @@ -1013,17 +1013,13 @@ extension Label { func validateAttribute(range: NSRange, in string: NSAttributedString, type: String = "") -> NSRange? { guard range.location >= 0 && range.location <= string.length else { - if let loggingHandler = MVMCoreLoggingHandler.shared(), loggingHandler.responds(to: #selector(MVMCoreLoggingHandler.addError(toLog:))) { - loggingHandler.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Attribute starting location \(range.lowerBound) is out of bounds for '\(string.string)'. Attribute is discarded.", code: ErrorCode.default.rawValue, domain: ErrorDomainNative, location: "\(#file): \(#function)")!) - } + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Attribute starting location \(range.lowerBound) is out of bounds for '\(string.string)'. Attribute is discarded.", code: ErrorCode.default.rawValue, domain: ErrorDomainNative, location: "\(#file): \(#function)")!) return nil } if type != "image" && range.upperBound > string.length { let newRange = NSRange(location: range.location, length: string.length - range.location) - if let loggingHandler = MVMCoreLoggingHandler.shared(), loggingHandler.responds(to: #selector(MVMCoreLoggingHandler.addError(toLog:))) { - loggingHandler.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Attribute ending location \(range.upperBound) is out of bounds for '\(string)'. Adjusting to \(newRange.upperBound).", code: ErrorCode.default.rawValue, domain: ErrorDomainNative, location: "\(#file): \(#function)")!) - } + MVMCoreLoggingHandler.shared()?.addError(toLog: MVMCoreErrorObject(title: nil, messageToLog: "Attribute ending location \(range.upperBound) is out of bounds for '\(string)'. Adjusting to \(newRange.upperBound).", code: ErrorCode.default.rawValue, domain: ErrorDomainNative, location: "\(#file): \(#function)")!) return newRange } diff --git a/MVMCoreUI/Atomic/Atoms/Views/Video/Video.swift b/MVMCoreUI/Atomic/Atoms/Views/Video/Video.swift index a378b854..baee04f6 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Video/Video.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Video/Video.swift @@ -89,7 +89,7 @@ open class Video: View { }) case .failed: if let errorObject = item.loadFailedError { - MVMCoreLoggingHandler.addError(toLog: errorObject) + MVMCoreLoggingHandler.shared()?.addError(toLog: errorObject) } default: break diff --git a/MVMCoreUI/Atomic/Molecules/OtherContainers/ModuleMolecule.swift b/MVMCoreUI/Atomic/Molecules/OtherContainers/ModuleMolecule.swift index 6083ac5e..ce76d379 100644 --- a/MVMCoreUI/Atomic/Molecules/OtherContainers/ModuleMolecule.swift +++ b/MVMCoreUI/Atomic/Molecules/OtherContainers/ModuleMolecule.swift @@ -75,7 +75,7 @@ open class ModuleMolecule: Container { let _ = delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) else { if let errorObject = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), code: CoreUIErrorCode.ErrorCodeModuleMolecule.rawValue, domain: ErrorDomainNative, location: String(describing: self)) { error?.pointee = errorObject - MVMCoreUILoggingHandler.addError(toLog: errorObject) + MVMCoreUILoggingHandler.shared()?.addError(toLog: errorObject) } return nil } diff --git a/MVMCoreUI/Atomic/Protocols/MoleculeViewProtocol.swift b/MVMCoreUI/Atomic/Protocols/MoleculeViewProtocol.swift index 7dd4fa26..c3c07b6a 100644 --- a/MVMCoreUI/Atomic/Protocols/MoleculeViewProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/MoleculeViewProtocol.swift @@ -77,7 +77,7 @@ public extension ModelRegistry { return type } catch { if let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: #function) { - MVMCoreLoggingHandler.addError(toLog: errorObject) + MVMCoreLoggingHandler.shared()?.addError(toLog: errorObject) } return nil } diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index d91e776e..d3d7c3c0 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -115,7 +115,7 @@ import MVMCore }) } catch { if let coreError = MVMCoreErrorObject.createErrorObject(for: error, location: "updateJSON for pageType: \(String(describing: pageType))") { - MVMCoreLoggingHandler.addError(toLog: coreError) + MVMCoreLoggingHandler.shared()?.addError(toLog: coreError) } } } diff --git a/MVMCoreUI/Behaviors/Protocols/PageBehaviorHandlerProtocol.swift b/MVMCoreUI/Behaviors/Protocols/PageBehaviorHandlerProtocol.swift index 9e5c6a6d..325f8927 100644 --- a/MVMCoreUI/Behaviors/Protocols/PageBehaviorHandlerProtocol.swift +++ b/MVMCoreUI/Behaviors/Protocols/PageBehaviorHandlerProtocol.swift @@ -33,7 +33,7 @@ public extension PageBehaviorHandlerProtocol { behaviors.append(behavior) } catch { if let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: #function) { - MVMCoreLoggingHandler.addError(toLog: errorObject) + MVMCoreLoggingHandler.shared()?.addError(toLog: errorObject) } } } diff --git a/MVMCoreUI/FormUIHelpers/FormValidator.swift b/MVMCoreUI/FormUIHelpers/FormValidator.swift index ec06542c..3aa50030 100644 --- a/MVMCoreUI/FormUIHelpers/FormValidator.swift +++ b/MVMCoreUI/FormUIHelpers/FormValidator.swift @@ -95,7 +95,7 @@ import MVMCore groupValid = try validateGroup(group) } catch { if let err = MVMCoreErrorObject.createErrorObject(for: error, location: "FormValidator"){ - MVMCoreLoggingHandler.addError(toLog: err) + MVMCoreLoggingHandler.shared()?.addError(toLog: err) fatalError(err.description) } } diff --git a/MVMCoreUI/MVMCoreUI.h b/MVMCoreUI/MVMCoreUI.h index fa2aaf0b..23e40209 100644 --- a/MVMCoreUI/MVMCoreUI.h +++ b/MVMCoreUI/MVMCoreUI.h @@ -17,7 +17,6 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import #pragma mark - OtherHandlers #import -#import #import #import diff --git a/MVMCoreUI/Notification/NotificationHandler.swift b/MVMCoreUI/Notification/NotificationHandler.swift index 9ecc2efb..1c7504ee 100644 --- a/MVMCoreUI/Notification/NotificationHandler.swift +++ b/MVMCoreUI/Notification/NotificationHandler.swift @@ -399,7 +399,7 @@ open class NotificationHandler { try await showNotification(for: json, delegateObject: delegateObject) } catch { if let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: "\(self)") { - MVMCoreUILoggingHandler.addError(toLog: errorObject) + MVMCoreUILoggingHandler.shared()?.addError(toLog: errorObject) } } } diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h deleted file mode 100644 index a4b66ef9..00000000 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// MVMCoreUILoggingHandler.h -// MVMCoreUI -// -// Created by Scott Pfeil on 1/10/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -@import MVMCore.MVMCoreLoggingHandler; - -NS_ASSUME_NONNULL_BEGIN - -@interface MVMCoreUILoggingHandler : MVMCoreLoggingHandler - -// Page State Logging -- (void)defaultLogPageStateForController:(nonnull id )controller; - -// Action Logging -- (void)defaultLogActionForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; -- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; - -@end - -NS_ASSUME_NONNULL_END diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m deleted file mode 100644 index 45a13acf..00000000 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// MVMCoreUILoggingHandler.m -// MVMCoreUI -// -// Created by Scott Pfeil on 1/10/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -#import "MVMCoreUILoggingHandler.h" - -@implementation MVMCoreUILoggingHandler - -- (void)defaultLogPageStateForController:(nonnull id )controller { -} - -- (void)defaultLogActionForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { -} - -- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { - return nil; -} - -@end diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.swift b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.swift new file mode 100644 index 00000000..edad1b5d --- /dev/null +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.swift @@ -0,0 +1,21 @@ +// +// MVMCoreUILoggingHandler.swift +// MVMCoreUI +// +// Created by Nandhini Rajendran on 29/09/23. +// Copyright © 2023 Verizon Wireless. All rights reserved. +// + +@objc open class MVMCoreUILoggingHandler: MVMCoreLoggingHandler { + + // Page State Logging + @objc open func defaultLogPageState(forController controller: MVMCoreViewControllerProtocol) { } + + // Action Logging + @objc open func defaultLogAction(forController controller: MVMCoreViewControllerProtocol?, actionInformation: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?) { } + + @objc open func defaultGetActionTrackDataDictionary(forController controller: MVMCoreViewControllerProtocol?, actionInformation: NSDictionary?, additionalData: NSDictionary?) -> NSDictionary? { + return nil + } +} + diff --git a/MVMCoreUI/Utility/MFFonts.m b/MVMCoreUI/Utility/MFFonts.m index d16f15ec..30ee68f0 100644 --- a/MVMCoreUI/Utility/MFFonts.m +++ b/MVMCoreUI/Utility/MFFonts.m @@ -9,8 +9,11 @@ #import "MFFonts.h" #import #import "MVMCoreUIUtility.h" -@import MVMCore.MVMCoreLoggingHandler; +#import +@import MVMCore.Swift; @import MVMCore.MVMCoreErrorConstants; +@import MVMCore.MVMCoreLoadHandler; +@import MVMCore.MVMCoreErrorObject; NSString * const DSBold = @"VerizonNHGeDS-Bold"; NSString * const DSRegular = @"VerizonNHGeDS-Regular"; @@ -108,7 +111,7 @@ NSString * const TXRegular = @"VerizonNHGeTX-Regular"; + (void)validFont:(UIFont *)font fontName:(NSString *)fontName { if (font == nil) { MVMCoreErrorObject *errorObject = [[MVMCoreErrorObject alloc] initWithTitle:@"font can not load" message:[NSString stringWithFormat:@"missing font name is %@", fontName] code:ErrorCodeFontNotFound domain:ErrorDomainNative location:@"MFStyler"]; - [MVMCoreLoggingHandler addErrorToLog:errorObject]; + [[MVMCoreLoggingHandler sharedLoggingHandler]addErrorToLog:errorObject]; } } @end From 72358966bc1cee9fd46df39dd6fe4c299a5c4739 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Thu, 21 Dec 2023 12:32:08 -0500 Subject: [PATCH 17/24] Remove unused stub. --- MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.swift b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.swift index edad1b5d..e74bc580 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.swift +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.swift @@ -13,9 +13,4 @@ // Action Logging @objc open func defaultLogAction(forController controller: MVMCoreViewControllerProtocol?, actionInformation: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?) { } - - @objc open func defaultGetActionTrackDataDictionary(forController controller: MVMCoreViewControllerProtocol?, actionInformation: NSDictionary?, additionalData: NSDictionary?) -> NSDictionary? { - return nil - } } - From 8306f901bdc095a20c602a87cd66ade936902915 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Thu, 21 Dec 2023 22:19:45 -0500 Subject: [PATCH 18/24] Open up progress bar atom for subclassing. --- MVMCoreUI/Atomic/Atoms/Views/ProgressBar.swift | 4 ++-- MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/ProgressBar.swift b/MVMCoreUI/Atomic/Atoms/Views/ProgressBar.swift index a68cdc99..c806ce4b 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/ProgressBar.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/ProgressBar.swift @@ -54,7 +54,7 @@ import Foundation // MARK: - Lifecycle //-------------------------------------------------- - public func setupView() { + open func setupView() { clipsToBounds = true translatesAutoresizingMaskIntoConstraints = false @@ -70,7 +70,7 @@ import Foundation // MARK: - MVMCoreViewProtocol //-------------------------------------------------- - public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let progressBarModel = model as? ProgressBarModel else { return } diff --git a/MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift b/MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift index 439fad3d..c69e73e4 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift @@ -8,8 +8,8 @@ import Foundation -@objcMembers public class ProgressBarModel: MoleculeModelProtocol { - public static var identifier: String = "progressBar" +@objcMembers open class ProgressBarModel: MoleculeModelProtocol { + open class var identifier: String { "progressBar" } public var id: String = UUID().uuidString @Percent public var percent: CGFloat From c2c4e0f1f4cebb8ea1f844e1c4843050f59d2f3b Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Tue, 2 Jan 2024 17:24:42 -0500 Subject: [PATCH 19/24] indexing safety --- MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift | 2 +- MVMCoreUI/Atomic/Organisms/Carousel/CarouselModel.swift | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift index 6b360120..2ad92343 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel/Carousel.swift @@ -87,7 +87,7 @@ open class Carousel: View { showPeaking(false) // Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled. - guard let model = model as? CarouselModel, + guard let model = model as? CarouselModel, !model.molecules.isEmpty, (model.paging == true || loop == true) else { return } DispatchQueue.main.async { self.collectionView.scrollToItem(at: IndexPath(row: self.currentIndex, section: 0), at: self.itemAlignment, animated: false) diff --git a/MVMCoreUI/Atomic/Organisms/Carousel/CarouselModel.swift b/MVMCoreUI/Atomic/Organisms/Carousel/CarouselModel.swift index 5bfd8d0f..04e98287 100644 --- a/MVMCoreUI/Atomic/Organisms/Carousel/CarouselModel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel/CarouselModel.swift @@ -8,7 +8,6 @@ import UIKit - @objcMembers public class CarouselModel: ParentMoleculeModelProtocol, FormFieldProtocol { //-------------------------------------------------- @@ -57,14 +56,14 @@ import UIKit guard selectable else { // Use visible item value, else index - if let fieldValue = molecules[index].formFieldValue() { + if let fieldValue = molecules[safe: index]?.formFieldValue() { return fieldValue } return index } // Use selected item value, else index guard let selectedIndex = selectedIndex else { return nil } - guard let fieldValue = molecules[selectedIndex].formFieldValue() else { return selectedIndex } + guard let fieldValue = molecules[safe: selectedIndex]?.formFieldValue() else { return selectedIndex } return fieldValue } From 8a62065ade07030bc19dd092818ec309360a99a2 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Thu, 11 Jan 2024 18:17:06 -0500 Subject: [PATCH 20/24] open encoder --- MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift b/MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift index c69e73e4..5e6a42c1 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift @@ -46,7 +46,7 @@ import Foundation thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness) } - public func encode(to encoder: Encoder) throws { + open func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(moleculeName, forKey: .moleculeName) From eb5d3593228cc556ee48af6bdf84ae9c23c1c661 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Mon, 22 Jan 2024 23:29:47 +0530 Subject: [PATCH 21/24] Addressed review comments Added accessibilityHint to AccessibilityModelProtocol --- .../ModelProtocols/AccessibilityModelProtocol.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift index 809334d8..b233c71d 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/AccessibilityModelProtocol.swift @@ -15,6 +15,7 @@ public protocol AccessibilityModelProtocol { var accessibilityTraits: UIAccessibilityTraits? { get set } var accessibilityText: String? { get set } var accessibilityValue: String? { get set } + var accessibilityHint: String? { get set } } public extension AccessibilityModelProtocol { @@ -38,4 +39,9 @@ public extension AccessibilityModelProtocol { get { nil } set { } } + + var accessibilityHint: String? { + get { nil } + set {} + } } From d1ee6e7f3ae2323ada0f1d630c75f51397c6e40c Mon Sep 17 00:00:00 2001 From: Keerthy Date: Wed, 24 Jan 2024 16:18:35 +0530 Subject: [PATCH 22/24] Addressed code review comments --- .../TextFields/TextViewEntryField.swift | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift index e92e7127..46e4e233 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/TextViewEntryField.swift @@ -161,7 +161,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele bottomConstraint?.isActive = true heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0) - accessibilityElements = [titleLabel, textView, feedbackLabel] + accessibilityElements = [textView] } open override func updateView(_ size: CGFloat) { @@ -281,11 +281,25 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele if model.hideBorders { adjustMarginConstraints(constant: 0) } - setAccessibilityString(model.title) + updateAccessibility(model: model) } - override func setAccessibilityString(_ accessibilityString: String?) { - let accessibilityString = accessibilityString ?? "" - textView.accessibilityLabel = "\(String(describing: accessibilityString)) \(self.textView.isEnabled ? "" : MVMCoreUIUtility.hardcodedString(withKey: "textfield_disabled_state") ?? "")" + func updateAccessibility(model: TextViewEntryFieldModel) { + + var message = "" + + if let titleText = model.accessibilityText ?? model.title { + message += "\(titleText) \( model.enabled ? String(format: (MVMCoreUIUtility.hardcodedString(withKey: "textfield_optional")) ?? "") : "" ) \(self.textView.isEnabled ? "" : MVMCoreUIUtility.hardcodedString(withKey: "textfield_disabled_state") ?? "")" + } + + if let feedback = model.feedback { + message += ", " + feedback + } + + if let errorMessage = errorLabel.text { + message += ", " + errorMessage + } + + textView.accessibilityLabel = message } } From 648bfdc76bd6d7f21e16db160b0896abf94f560c Mon Sep 17 00:00:00 2001 From: Keerthy Date: Wed, 24 Jan 2024 21:41:46 +0530 Subject: [PATCH 23/24] Missed file --- MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings index 7eb53fa7..24a6d8db 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings @@ -23,6 +23,7 @@ // Textfield "textfield_today_string" = "Hoy"; "textfield_error_message" = "%@.\n El mensaje de error.\n %@"; +"textView_error_message" = "%@.\n El mensaje de error.\n %@"; "textfield_picker_item" = " artículo de selector"; "textfield_regular" = " regular"; "textfield_disabled_state" = "inactivo"; From 75729fd4141d7357106d46ced4e75c62df577e32 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Wed, 24 Jan 2024 23:33:57 +0530 Subject: [PATCH 24/24] defect: CXTDT-458975 Removing button text in the accessibility label. --- MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings index b42f7d92..52a718df 100644 --- a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings @@ -63,7 +63,7 @@ // MARK: Switch / Toggle "mfswitch_buttonlabel" = "Switch Button"; -"Toggle_buttonlabel" = "Toggle Button"; +"Toggle_buttonlabel" = "Toggle"; "AccOn" = "on"; "AccOff" = "off"; "AccToggleHint" = "double tap to toggle";