Merge remote-tracking branch 'origin/develop' into feature/molecule_replacement_behavior
This commit is contained in:
commit
14ccfe61be
@ -31,6 +31,8 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
public var size: VDS.Button.Size = .large
|
public var size: VDS.Button.Size = .large
|
||||||
public var groupName: String = ""
|
public var groupName: String = ""
|
||||||
public var inverted: Bool = false
|
public var inverted: Bool = false
|
||||||
|
public var accessibilityTraits: UIAccessibilityTraits?
|
||||||
|
public var disabledAccessibilityTraits: UIAccessibilityTraits?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -77,6 +79,8 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
case size
|
case size
|
||||||
case groupName
|
case groupName
|
||||||
case width
|
case width
|
||||||
|
case accessibilityTraits
|
||||||
|
case disabledAccessibilityTraits
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -118,6 +122,10 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
} else {
|
} else {
|
||||||
try setInverted(deprecatedFrom: decoder)
|
try setInverted(deprecatedFrom: decoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits)
|
||||||
|
|
||||||
|
disabledAccessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .disabledAccessibilityTraits)
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum DeprecatedCodingKeys: String, CodingKey {
|
private enum DeprecatedCodingKeys: String, CodingKey {
|
||||||
@ -158,6 +166,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
self.inverted = !backgroundColor.uiColor.isDark()
|
self.inverted = !backgroundColor.uiColor.isDark()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
@ -174,5 +183,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
try container.encode(size, forKey: .size)
|
try container.encode(size, forKey: .size)
|
||||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||||
try container.encodeIfPresent(width, forKey: .width)
|
try container.encodeIfPresent(width, forKey: .width)
|
||||||
|
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
||||||
|
try container.encodeIfPresent(disabledAccessibilityTraits, forKey: .disabledAccessibilityTraits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,6 +47,9 @@ import Foundation
|
|||||||
} else if let disabledTintColor = castModel.disabledTintColor {
|
} else if let disabledTintColor = castModel.disabledTintColor {
|
||||||
image.imageView.tintColor = disabledTintColor.uiColor
|
image.imageView.tintColor = disabledTintColor.uiColor
|
||||||
}
|
}
|
||||||
|
if let traits = model?.accessibilityTraits {
|
||||||
|
accessibilityTraits = traits
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
public var enabled: Bool = true
|
public var enabled: Bool = true
|
||||||
public var enabledTintColor: Color?
|
public var enabledTintColor: Color?
|
||||||
public var disabledTintColor: Color?
|
public var disabledTintColor: Color?
|
||||||
|
public var accessibilityTraits: UIAccessibilityTraits?
|
||||||
public var groupName: String = ""
|
public var groupName: String = ""
|
||||||
|
|
||||||
public var updateUI: ActionBlock?
|
public var updateUI: ActionBlock?
|
||||||
@ -53,6 +53,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
case groupName
|
case groupName
|
||||||
case enabledTintColor
|
case enabledTintColor
|
||||||
case disabledTintColor
|
case disabledTintColor
|
||||||
|
case accessibilityTraits
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -67,7 +68,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image)
|
image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image)
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
|
accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits) ?? .button
|
||||||
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
|
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
|
||||||
self.enabled = enabled
|
self.enabled = enabled
|
||||||
}
|
}
|
||||||
@ -98,5 +99,6 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||||
try container.encodeIfPresent(enabledTintColor, forKey: .enabledTintColor)
|
try container.encodeIfPresent(enabledTintColor, forKey: .enabledTintColor)
|
||||||
try container.encodeIfPresent(disabledTintColor, forKey: .disabledTintColor)
|
try container.encodeIfPresent(disabledTintColor, forKey: .disabledTintColor)
|
||||||
|
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,9 @@ open class PillButton: VDS.Button, MVMCoreUIViewConstrainingProtocol, MFButtonPr
|
|||||||
if let accessibilityText = viewModel.accessibilityText {
|
if let accessibilityText = viewModel.accessibilityText {
|
||||||
accessibilityLabel = accessibilityText
|
accessibilityLabel = accessibilityText
|
||||||
}
|
}
|
||||||
|
|
||||||
|
accessibilityTraits = isEnabled ? (viewModel?.accessibilityTraits ?? .button) : (viewModel?.disabledAccessibilityTraits ?? .none)
|
||||||
|
|
||||||
set(with: viewModel.action, delegateObject: delegateObject, additionalData: additionalData)
|
set(with: viewModel.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
|
||||||
viewModel.updateUI = { [weak self] in
|
viewModel.updateUI = { [weak self] in
|
||||||
@ -58,8 +60,10 @@ open class PillButton: VDS.Button, MVMCoreUIViewConstrainingProtocol, MFButtonPr
|
|||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return (model as? ButtonModel)?.size.height
|
return (model as? ButtonModel)?.size.height
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open func updateView(_ size: CGFloat) {}
|
open func updateView(_ size: CGFloat) {}
|
||||||
|
|||||||
@ -161,7 +161,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
bottomConstraint?.isActive = true
|
bottomConstraint?.isActive = true
|
||||||
|
|
||||||
heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0)
|
heightConstraint = textView.heightAnchor.constraint(equalToConstant: 0)
|
||||||
accessibilityElements = [titleLabel, textView, feedbackLabel]
|
accessibilityElements = [textView]
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
@ -281,6 +281,25 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
if model.hideBorders {
|
if model.hideBorders {
|
||||||
adjustMarginConstraints(constant: 0)
|
adjustMarginConstraints(constant: 0)
|
||||||
}
|
}
|
||||||
|
updateAccessibility(model: model)
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,6 +75,7 @@ import Foundation
|
|||||||
delegateObject, additionalData)
|
delegateObject, additionalData)
|
||||||
rightImageView.set(with: model.image, delegateObject, additionalData)
|
rightImageView.set(with: model.image, delegateObject, additionalData)
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
|
accessibilityTraits.update(with: model.accessibilityTraits ?? button.accessibilityTraits)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
|||||||
@ -73,6 +73,7 @@
|
|||||||
delegateObject, additionalData)
|
delegateObject, additionalData)
|
||||||
rightImageView.set(with: model.image, delegateObject, additionalData)
|
rightImageView.set(with: model.image, delegateObject, additionalData)
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
|
accessibilityTraits.update(with: model.accessibilityTraits ?? button.accessibilityTraits)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
|||||||
@ -79,7 +79,7 @@
|
|||||||
|
|
||||||
let linkShowing = (model as? ListLeftVariableIconAllTextLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
let linkShowing = (model as? ListLeftVariableIconAllTextLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
||||||
isAccessibilityElement = !linkShowing
|
isAccessibilityElement = !linkShowing
|
||||||
accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none)
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
|
|||||||
@ -91,6 +91,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,7 +100,7 @@
|
|||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
let linkShowing = (model as? ListLeftVariableIconWithRightCaretAllTextLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
let linkShowing = (model as? ListLeftVariableIconWithRightCaretAllTextLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
||||||
isAccessibilityElement = !linkShowing
|
isAccessibilityElement = !linkShowing
|
||||||
accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none)
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
|
|||||||
@ -109,6 +109,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
let linkShowing = (model as? ListLeftVariableNumberedListAllTextAndLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
let linkShowing = (model as? ListLeftVariableNumberedListAllTextAndLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
||||||
isAccessibilityElement = !linkShowing
|
isAccessibilityElement = !linkShowing
|
||||||
accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none)
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
|
|||||||
@ -89,7 +89,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -134,6 +134,6 @@ open class ListProgressBarThin: TableViewCell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,11 +70,7 @@
|
|||||||
|
|
||||||
override public var accessibilityTraits: UIAccessibilityTraits {
|
override public var accessibilityTraits: UIAccessibilityTraits {
|
||||||
get {
|
get {
|
||||||
if (accessoryView != nil) {
|
return (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
return .button
|
|
||||||
} else {
|
|
||||||
return .none
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,8 @@ import Foundation
|
|||||||
// Ensures voice over does not read "selected" after user triggers action on cell.
|
// Ensures voice over does not read "selected" after user triggers action on cell.
|
||||||
override public var accessibilityTraits: UIAccessibilityTraits {
|
override public var accessibilityTraits: UIAccessibilityTraits {
|
||||||
get {
|
get {
|
||||||
return (accessoryView != nil) ? .button : .none
|
return (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
|
|
||||||
}
|
}
|
||||||
set {}
|
set {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ import Foundation
|
|||||||
/// Ensures voice over does not read "selected" after user triggers action on cell.
|
/// Ensures voice over does not read "selected" after user triggers action on cell.
|
||||||
override public var accessibilityTraits: UIAccessibilityTraits {
|
override public var accessibilityTraits: UIAccessibilityTraits {
|
||||||
get {
|
get {
|
||||||
return (accessoryView != nil) ? .button : .none
|
return (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
}
|
}
|
||||||
set {}
|
set {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,6 +91,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@
|
|||||||
stack.restack()
|
stack.restack()
|
||||||
accessibilityValue = button.accessibilityValue
|
accessibilityValue = button.accessibilityValue
|
||||||
accessibilityHint = button.accessibilityHint
|
accessibilityHint = button.accessibilityHint
|
||||||
accessibilityTraits = .button
|
accessibilityTraits = (listItemModel?.accessibilityTraits ?? .button)
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|||||||
@ -83,6 +83,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -102,7 +102,7 @@
|
|||||||
|
|
||||||
let linkShowing = (model as? ListRightVariablePriceChangeAllTextAndLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
let linkShowing = (model as? ListRightVariablePriceChangeAllTextAndLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
||||||
isAccessibilityElement = !linkShowing
|
isAccessibilityElement = !linkShowing
|
||||||
accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none)
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
|
|||||||
@ -98,6 +98,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,8 +99,8 @@
|
|||||||
|
|
||||||
let linkShowing = (model as? ListRightVariableRightCaretAllTextAndLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
let linkShowing = (model as? ListRightVariableRightCaretAllTextAndLinksModel)?.eyebrowHeadlineBodyLink.link?.title != nil
|
||||||
isAccessibilityElement = !linkShowing
|
isAccessibilityElement = !linkShowing
|
||||||
accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((isAccessibilityElement && accessoryView != nil) ? .button : .none)
|
||||||
|
|
||||||
if !linkShowing {
|
if !linkShowing {
|
||||||
// Make whole cell focusable if no link.
|
// Make whole cell focusable if no link.
|
||||||
accessibilityLabel = getAccessibilityMessage()
|
accessibilityLabel = getAccessibilityMessage()
|
||||||
|
|||||||
@ -89,7 +89,7 @@
|
|||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
accessibilityTraits = .button
|
accessibilityTraits = listItemModel?.accessibilityTraits ?? .button
|
||||||
|
|
||||||
if !linkShowing && accessoryView == nil {
|
if !linkShowing && accessoryView == nil {
|
||||||
// Make whole cell focusable if one action
|
// Make whole cell focusable if one action
|
||||||
|
|||||||
@ -103,6 +103,6 @@ open class ListRightVariableTotalData: TableViewCell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
accessibilityLabel = message
|
accessibilityLabel = message
|
||||||
accessibilityTraits = (accessoryView != nil) ? .button : .none
|
accessibilityTraits = (listItemModel?.accessibilityTraits) ?? ((accessoryView != nil) ? .button : .none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,9 @@
|
|||||||
public var hideArrow: Bool?
|
public var hideArrow: Bool?
|
||||||
public var line: LineModel?
|
public var line: LineModel?
|
||||||
public var style: ListItemStyle?
|
public var style: ListItemStyle?
|
||||||
|
public var accessibilityTraits: UIAccessibilityTraits?
|
||||||
|
public var accessibilityValue: String?
|
||||||
public var accessibilityText: String?
|
public var accessibilityText: String?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -30,6 +31,8 @@
|
|||||||
case hideArrow
|
case hideArrow
|
||||||
case line
|
case line
|
||||||
case style
|
case style
|
||||||
|
case accessibilityTraits
|
||||||
|
case accessibilityValue
|
||||||
case accessibilityText
|
case accessibilityText
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +107,8 @@
|
|||||||
hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow)
|
hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow)
|
||||||
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
||||||
style = try typeContainer.decodeIfPresent(ListItemStyle.self, forKey: .style)
|
style = try typeContainer.decodeIfPresent(ListItemStyle.self, forKey: .style)
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits)
|
||||||
|
accessibilityValue = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityValue)
|
||||||
try super.init(from: decoder)
|
try super.init(from: decoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,6 +120,8 @@
|
|||||||
try container.encodeIfPresent(hideArrow, forKey: .hideArrow)
|
try container.encodeIfPresent(hideArrow, forKey: .hideArrow)
|
||||||
try container.encodeIfPresent(line, forKey: .line)
|
try container.encodeIfPresent(line, forKey: .line)
|
||||||
try container.encodeIfPresent(style, forKey: .style)
|
try container.encodeIfPresent(style, forKey: .style)
|
||||||
|
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
||||||
|
try container.encodeIfPresent(accessibilityValue, forKey: .accessibilityValue)
|
||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ public protocol AccessibilityModelProtocol {
|
|||||||
var accessibilityTraits: UIAccessibilityTraits? { get set }
|
var accessibilityTraits: UIAccessibilityTraits? { get set }
|
||||||
var accessibilityText: String? { get set }
|
var accessibilityText: String? { get set }
|
||||||
var accessibilityValue: String? { get set }
|
var accessibilityValue: String? { get set }
|
||||||
|
var accessibilityHint: String? { get set }
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension AccessibilityModelProtocol {
|
public extension AccessibilityModelProtocol {
|
||||||
@ -38,4 +39,9 @@ public extension AccessibilityModelProtocol {
|
|||||||
get { nil }
|
get { nil }
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var accessibilityHint: String? {
|
||||||
|
get { nil }
|
||||||
|
set {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ public enum ListItemStyle: String, Codable {
|
|||||||
case none
|
case none
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol ListItemModelProtocol: ContainerModelProtocol {
|
public protocol ListItemModelProtocol: ContainerModelProtocol, AccessibilityModelProtocol {
|
||||||
var line: LineModel? { get set }
|
var line: LineModel? { get set }
|
||||||
var action: ActionModelProtocol? { get set }
|
var action: ActionModelProtocol? { get set }
|
||||||
var hideArrow: Bool? { get set }
|
var hideArrow: Bool? { get set }
|
||||||
|
|||||||
@ -163,6 +163,15 @@ import UIKit
|
|||||||
|
|
||||||
// align if needed.
|
// align if needed.
|
||||||
containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol)
|
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() {
|
open func reset() {
|
||||||
|
|||||||
@ -98,7 +98,6 @@ import UIKit
|
|||||||
smartInsertDeleteType = .no
|
smartInsertDeleteType = .no
|
||||||
inputAccessoryView = nil
|
inputAccessoryView = nil
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .staticText
|
|
||||||
font = fontStyle.getFont()
|
font = fontStyle.getFont()
|
||||||
keyboardType = .default
|
keyboardType = .default
|
||||||
isEditable = true
|
isEditable = true
|
||||||
|
|||||||
@ -83,7 +83,6 @@ import Combine
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension NavigationController: MVMCoreViewManagerProtocol {
|
extension NavigationController: MVMCoreViewManagerProtocol {
|
||||||
|
|
||||||
public func getAccessibilityElements() -> [Any]? {
|
public func getAccessibilityElements() -> [Any]? {
|
||||||
nil
|
nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -249,7 +249,6 @@ public extension MVMCoreUISplitViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol {
|
extension MVMCoreUISplitViewController: MVMCoreViewManagerProtocol {
|
||||||
|
|
||||||
public func getAccessibilityElements() -> [Any]? {
|
public func getAccessibilityElements() -> [Any]? {
|
||||||
nil
|
nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
// MARK: Textfield
|
// MARK: Textfield
|
||||||
"textfield_today_string" = "Today";
|
"textfield_today_string" = "Today";
|
||||||
"textfield_error_message" = "%@.\n The error message.\n %@";
|
"textfield_error_message" = "%@.\n The error message.\n %@";
|
||||||
|
"textView_error_message" = "%@.\n The error message.\n %@";
|
||||||
"textfield_picker_item" = " picker item";
|
"textfield_picker_item" = " picker item";
|
||||||
"textfield_regular" = " regular";
|
"textfield_regular" = " regular";
|
||||||
"textfield_disabled_state" = "disabled";
|
"textfield_disabled_state" = "disabled";
|
||||||
@ -62,7 +63,7 @@
|
|||||||
|
|
||||||
// MARK: Switch / Toggle
|
// MARK: Switch / Toggle
|
||||||
"mfswitch_buttonlabel" = "Switch Button";
|
"mfswitch_buttonlabel" = "Switch Button";
|
||||||
"Toggle_buttonlabel" = "Toggle Button";
|
"Toggle_buttonlabel" = "Toggle";
|
||||||
"AccOn" = "on";
|
"AccOn" = "on";
|
||||||
"AccOff" = "off";
|
"AccOff" = "off";
|
||||||
"AccToggleHint" = "double tap to toggle";
|
"AccToggleHint" = "double tap to toggle";
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
// Textfield
|
// Textfield
|
||||||
"textfield_today_string" = "Hoy";
|
"textfield_today_string" = "Hoy";
|
||||||
"textfield_error_message" = "%@.\n El mensaje de error.\n %@";
|
"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_picker_item" = " artículo de selector";
|
||||||
"textfield_regular" = " regular";
|
"textfield_regular" = " regular";
|
||||||
"textfield_disabled_state" = "inactivo";
|
"textfield_disabled_state" = "inactivo";
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
// Textfield
|
// Textfield
|
||||||
"textfield_today_string" = "Hoy";
|
"textfield_today_string" = "Hoy";
|
||||||
"textfield_error_message" = "%@.\n El mensaje de error.\n %@";
|
"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_picker_item" = " artículo de selector";
|
||||||
"textfield_regular" = " regular";
|
"textfield_regular" = " regular";
|
||||||
"textfield_disabled_state" = "inactivo";
|
"textfield_disabled_state" = "inactivo";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user