From 649a9361e42bf4db029e1df2db33e508ed87f5f0 Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Fri, 17 Dec 2021 01:59:13 +0530 Subject: [PATCH 1/6] added accessibility text --- MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift | 6 +++++- MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift | 3 +++ .../List/OneColumn/ListOneColumnFullWidthTextBodyText.swift | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift index 04140d6e..9cfb0d54 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift @@ -51,7 +51,11 @@ import UIKit guard let model = model as? LinkModel else { return } setTitle(model.title, for: .normal) - accessibilityLabel = model.title + if let accessibilityText = model.accessibilityIdentifier { + accessibilityLabel = accessibilityText + } else { + accessibilityLabel = model.title + } setTitleColor((model.inverted ? model.enabledColor_inverted : model.enabledColor).uiColor, for: .normal) setTitleColor((model.inverted ? model.disabledColor_inverted : model.disabledColor).uiColor, for: .disabled) isEnabled = model.enabled diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index 1bdf0234..9f048ca4 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -188,6 +188,9 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { guard let model = model as? ButtonModel else { return } setTitle(model.title, for: .normal) + if let accessibilityText = model.accessibilityIdentifier { + accessibilityLabel = accessibilityText + } if let size = model.size { buttonSize = size diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index 7a17dd1b..72b74998 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -63,6 +63,10 @@ import Foundation message += messageLabel } + if let accessibilityLabel = headlineBody.headlineLabel.accessibilityLabel { + message = accessibilityLabel + } + accessibilityLabel = message } } From 694a557c86222f9a1927d02154c2f41c4e0a8b8e Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Fri, 17 Dec 2021 19:41:55 +0530 Subject: [PATCH 2/6] modified code for clarity --- MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift index 9cfb0d54..49e67815 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift @@ -51,11 +51,7 @@ import UIKit guard let model = model as? LinkModel else { return } setTitle(model.title, for: .normal) - if let accessibilityText = model.accessibilityIdentifier { - accessibilityLabel = accessibilityText - } else { - accessibilityLabel = model.title - } + accessibilityLabel = model.accessibilityIdentifier ?? model.title setTitleColor((model.inverted ? model.enabledColor_inverted : model.enabledColor).uiColor, for: .normal) setTitleColor((model.inverted ? model.disabledColor_inverted : model.disabledColor).uiColor, for: .disabled) isEnabled = model.enabled From d35eceb78ca1cb1fbe6823bae12b06f8630d9457 Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Wed, 5 Jan 2022 18:37:21 +0530 Subject: [PATCH 3/6] Added accessibiltyText for pillButton and link --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 4 ++++ MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift | 2 +- MVMCoreUI/Atomic/Atoms/Buttons/Link/LinkModel.swift | 3 +++ MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift | 4 +--- .../List/OneColumn/ListOneColumnFullWidthTextBodyText.swift | 6 +++--- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index a8e004c2..3b72d37c 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -19,6 +19,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat open class var identifier: String { "button" } public var backgroundColor: Color? public var accessibilityIdentifier: String? + public var accessibilityText: String? public var title: String public var action: ActionModelProtocol public var enabled: Bool = true @@ -168,6 +169,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat case moleculeName case backgroundColor case accessibilityIdentifier + case accessibilityText case title case inverted case action @@ -192,6 +194,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier) + accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) title = try typeContainer.decode(String.self, forKey: .title) action = try typeContainer.decodeModel(codingKey: .action) @@ -250,6 +253,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat try container.encodeModel(action, forKey: .action) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier) + try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText) try container.encodeIfPresent(enabledFillColor, forKey: .fillColor) try container.encodeIfPresent(enabledTextColor, forKey: .textColor) try container.encodeIfPresent(enabledBorderColor, forKey: .borderColor) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift index 49e67815..1ae5ca6a 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift @@ -51,7 +51,7 @@ import UIKit guard let model = model as? LinkModel else { return } setTitle(model.title, for: .normal) - accessibilityLabel = model.accessibilityIdentifier ?? model.title + accessibilityLabel = model.accessibilityText ?? model.title setTitleColor((model.inverted ? model.enabledColor_inverted : model.enabledColor).uiColor, for: .normal) setTitleColor((model.inverted ? model.disabledColor_inverted : model.disabledColor).uiColor, for: .disabled) isEnabled = model.enabled diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/Link/LinkModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/LinkModel.swift index f3b48bd4..955601ac 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/Link/LinkModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/Link/LinkModel.swift @@ -19,6 +19,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode public var backgroundColor: Color? public var accessibilityIdentifier: String? public var title: String + public var accessibilityText: String? public var action: ActionModelProtocol public var enabled = true public var enabledColor = Color(uiColor: .mvmBlack) @@ -44,6 +45,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode case moleculeName case backgroundColor case accessibilityIdentifier + case accessibilityText case title case action case enabled @@ -64,6 +66,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier) title = try typeContainer.decode(String.self, forKey: .title) + accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) action = try typeContainer.decodeModel(codingKey: .action) if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index 9f048ca4..f184bf08 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -188,9 +188,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { guard let model = model as? ButtonModel else { return } setTitle(model.title, for: .normal) - if let accessibilityText = model.accessibilityIdentifier { - accessibilityLabel = accessibilityText - } + accessibilityLabel = model.accessibilityText ?? model.title if let size = model.size { buttonSize = size diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index 72b74998..1359c2c0 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -63,9 +63,9 @@ import Foundation message += messageLabel } - if let accessibilityLabel = headlineBody.headlineLabel.accessibilityLabel { - message = accessibilityLabel - } +// if let accessibilityLabel = headlineBody.headlineLabel.accessibilityLabel { +// message = accessibilityLabel +// } accessibilityLabel = message } From 4ed9dcacfd06b2e9f2b01bb844440c7ddb097955 Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Wed, 5 Jan 2022 18:40:58 +0530 Subject: [PATCH 4/6] Update ListOneColumnFullWidthTextBodyText.swift --- .../List/OneColumn/ListOneColumnFullWidthTextBodyText.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index 1359c2c0..7a17dd1b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -63,10 +63,6 @@ import Foundation message += messageLabel } -// if let accessibilityLabel = headlineBody.headlineLabel.accessibilityLabel { -// message = accessibilityLabel -// } - accessibilityLabel = message } } From 631c3a80675c744ae7e09f187aaeffc242347af9 Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Wed, 5 Jan 2022 22:42:08 +0530 Subject: [PATCH 5/6] changed model title --- MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift | 5 ++++- MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift index 1ae5ca6a..07c3215d 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift @@ -51,7 +51,10 @@ import UIKit guard let model = model as? LinkModel else { return } setTitle(model.title, for: .normal) - accessibilityLabel = model.accessibilityText ?? model.title + if let accessibilityText = model.accessibilityText { + accessibilityLabel = accessibilityText + } + // accessibilityLabel = model.accessibilityText ?? model.title setTitleColor((model.inverted ? model.enabledColor_inverted : model.enabledColor).uiColor, for: .normal) setTitleColor((model.inverted ? model.disabledColor_inverted : model.disabledColor).uiColor, for: .disabled) isEnabled = model.enabled diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index f184bf08..5b8f75cb 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -188,7 +188,9 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { guard let model = model as? ButtonModel else { return } setTitle(model.title, for: .normal) - accessibilityLabel = model.accessibilityText ?? model.title + if let accessibilityText = model.accessibilityText { + accessibilityLabel = accessibilityText + } if let size = model.size { buttonSize = size From dc8732e9efb55625682ee68ab6b85ad1b729bb8e Mon Sep 17 00:00:00 2001 From: Nishanth T Date: Wed, 5 Jan 2022 22:48:45 +0530 Subject: [PATCH 6/6] removed unneccessary comment --- MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift index 07c3215d..8e528deb 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift @@ -54,7 +54,6 @@ import UIKit if let accessibilityText = model.accessibilityText { accessibilityLabel = accessibilityText } - // accessibilityLabel = model.accessibilityText ?? model.title setTitleColor((model.inverted ? model.enabledColor_inverted : model.enabledColor).uiColor, for: .normal) setTitleColor((model.inverted ? model.disabledColor_inverted : model.disabledColor).uiColor, for: .disabled) isEnabled = model.enabled