Added missing accessibility identifier
This commit is contained in:
parent
ce038458dc
commit
bb2fbe4bdd
@ -39,6 +39,9 @@ open class ButtonGroup: VDS.ButtonGroup, VDSMoleculeViewProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
isEnabled = viewModel.enabled
|
isEnabled = viewModel.enabled
|
||||||
alignment = viewModel.alignment
|
alignment = viewModel.alignment
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import MVMCore
|
||||||
import VDS
|
import VDS
|
||||||
|
|
||||||
public class ButtonGroupModel: ParentMoleculeModelProtocol {
|
public class ButtonGroupModel: ParentMoleculeModelProtocol {
|
||||||
@ -17,6 +18,7 @@ public class ButtonGroupModel: ParentMoleculeModelProtocol {
|
|||||||
|
|
||||||
public static var identifier: String = "buttonGroup"
|
public static var identifier: String = "buttonGroup"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var children: [MoleculeModelProtocol] { buttons }
|
public var children: [MoleculeModelProtocol] { buttons }
|
||||||
|
|
||||||
@ -38,6 +40,7 @@ public class ButtonGroupModel: ParentMoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case buttons
|
case buttons
|
||||||
case alignment
|
case alignment
|
||||||
@ -56,6 +59,7 @@ public class ButtonGroupModel: ParentMoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
surface = try typeContainer.decodeIfPresent(Surface.self, forKey: .surface) ?? .light
|
surface = try typeContainer.decodeIfPresent(Surface.self, forKey: .surface) ?? .light
|
||||||
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
|
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
|
||||||
buttons = try typeContainer.decodeModels(codingKey: .buttons)
|
buttons = try typeContainer.decodeModels(codingKey: .buttons)
|
||||||
@ -70,6 +74,7 @@ public class ButtonGroupModel: ParentMoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(surface, forKey: .surface)
|
try container.encode(surface, forKey: .surface)
|
||||||
try container.encode(enabled, forKey: .enabled)
|
try container.encode(enabled, forKey: .enabled)
|
||||||
try container.encodeModels(buttons, forKey: .buttons)
|
try container.encodeModels(buttons, forKey: .buttons)
|
||||||
|
|||||||
@ -15,6 +15,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
|
|
||||||
public static var identifier: String = "imageButton"
|
public static var identifier: String = "imageButton"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var image: ImageViewModel?
|
public var image: ImageViewModel?
|
||||||
@ -45,6 +46,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case image
|
case image
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case accessibilityText
|
case accessibilityText
|
||||||
@ -64,6 +66,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
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)
|
||||||
@ -91,6 +94,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(image, forKey: .image)
|
try container.encodeIfPresent(image, forKey: .image)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import MVMCore
|
|||||||
@objcMembers public class TagModel: MoleculeModelProtocol {
|
@objcMembers public class TagModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "tag"
|
public static var identifier: String = "tag"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var label: LabelModel
|
public var label: LabelModel
|
||||||
public var action: ActionModelProtocol?
|
public var action: ActionModelProtocol?
|
||||||
@ -19,6 +20,7 @@ import MVMCore
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case label
|
case label
|
||||||
case action
|
case action
|
||||||
@ -42,6 +44,7 @@ import MVMCore
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
label = try typeContainer.decode(LabelModel.self, forKey: .label)
|
label = try typeContainer.decode(LabelModel.self, forKey: .label)
|
||||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
@ -50,6 +53,7 @@ import MVMCore
|
|||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(label, forKey: .label)
|
try container.encode(label, forKey: .label)
|
||||||
try container.encodeModelIfPresent(action, forKey: .action)
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
|
|||||||
@ -12,12 +12,14 @@ import MVMCore
|
|||||||
@objcMembers public class TagsModel: MoleculeModelProtocol {
|
@objcMembers public class TagsModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "tags"
|
public static var identifier: String = "tags"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var tags: [TagModel]
|
public var tags: [TagModel]
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case tags
|
case tags
|
||||||
@ -34,6 +36,7 @@ import MVMCore
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
tags = try typeContainer.decode([TagModel].self, forKey: .tags)
|
tags = try typeContainer.decode([TagModel].self, forKey: .tags)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
}
|
}
|
||||||
@ -41,6 +44,7 @@ import MVMCore
|
|||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(tags, forKey: .tags)
|
try container.encode(tags, forKey: .tags)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -123,6 +123,9 @@ import VDS
|
|||||||
|
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
//forms
|
//forms
|
||||||
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
|
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
|
||||||
groupName = viewModel.groupName
|
groupName = viewModel.groupName
|
||||||
|
|||||||
@ -28,6 +28,9 @@ open class Checkboxes: VDS.CheckboxGroup, VDSMoleculeViewProtocol {
|
|||||||
|
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - MoleculeViewProtocol
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
showError = viewModel.showError
|
showError = viewModel.showError
|
||||||
isEnabled = viewModel.enabled && !viewModel.readOnly
|
isEnabled = viewModel.enabled && !viewModel.readOnly
|
||||||
|
|||||||
@ -28,7 +28,9 @@ import VDS
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
text = viewModel.text
|
text = viewModel.text
|
||||||
subText = viewModel.subText
|
subText = viewModel.subText
|
||||||
subTextRight = viewModel.subTextRight
|
subTextRight = viewModel.subTextRight
|
||||||
|
|||||||
@ -28,6 +28,9 @@ open class RadioBoxes: VDS.RadioBoxGroup, VDSMoleculeViewProtocol {
|
|||||||
|
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - MoleculeViewProtocol
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
boxes = viewModel.boxes
|
boxes = viewModel.boxes
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
selectorModels = viewModel.boxes.convertToVDSRadioBoxModel(surface: surface)
|
selectorModels = viewModel.boxes.convertToVDSRadioBoxModel(surface: surface)
|
||||||
|
|||||||
@ -93,7 +93,9 @@ import VDS
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func viewModelDidUpdate() {
|
open func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
//events
|
//events
|
||||||
viewModel.updateUI = {
|
viewModel.updateUI = {
|
||||||
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
||||||
|
|||||||
@ -28,6 +28,9 @@ open class RadioButtons: VDS.RadioButtonGroup, VDSMoleculeViewProtocol {
|
|||||||
|
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - MoleculeViewProtocol
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
showError = viewModel.showError
|
showError = viewModel.showError
|
||||||
isEnabled = viewModel.isEnabled
|
isEnabled = viewModel.isEnabled
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
|
|||||||
@ -103,6 +103,9 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
|
FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate)
|
||||||
|
|
||||||
isOn = viewModel.selected
|
isOn = viewModel.selected
|
||||||
|
|||||||
@ -19,6 +19,7 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
}
|
}
|
||||||
public var moleculeName: String?
|
public var moleculeName: String?
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var disabledColor: Color = Color(uiColor: .mvmCoolGray3)
|
public var disabledColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||||
@ -59,6 +60,7 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case disabledColor
|
case disabledColor
|
||||||
@ -79,6 +81,7 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
if let disabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor) {
|
if let disabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor) {
|
||||||
self.disabledColor = disabledColor
|
self.disabledColor = disabledColor
|
||||||
@ -116,6 +119,7 @@ open class ArrowModel: MoleculeModelProtocol, EnableableModelProtocol {
|
|||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(disabledColor, forKey: .disabledColor)
|
try container.encode(disabledColor, forKey: .disabledColor)
|
||||||
|
|||||||
@ -27,6 +27,9 @@ open class Badge: VDS.Badge, VDSMoleculeViewProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
text = viewModel.text
|
text = viewModel.text
|
||||||
maxWidth = viewModel.maxWidth
|
maxWidth = viewModel.maxWidth
|
||||||
numberOfLines = viewModel.numberOfLines
|
numberOfLines = viewModel.numberOfLines
|
||||||
|
|||||||
@ -25,6 +25,9 @@ open class BadgeIndicator: VDS.BadgeIndicator, VDSMoleculeViewProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
number = viewModel.number
|
number = viewModel.number
|
||||||
fillColor = viewModel.fillColor
|
fillColor = viewModel.fillColor
|
||||||
|
|||||||
@ -17,6 +17,7 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String { "badgeIndicator" }
|
public static var identifier: String { "badgeIndicator" }
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - VDS Properties
|
// MARK: - VDS Properties
|
||||||
@ -43,6 +44,7 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case inverted
|
case inverted
|
||||||
case accessibilityText
|
case accessibilityText
|
||||||
case number
|
case number
|
||||||
@ -67,6 +69,7 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
|
|||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
self.init()
|
self.init()
|
||||||
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
||||||
accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
number = try container.decodeIfPresent(Int.self, forKey: .number)
|
number = try container.decodeIfPresent(Int.self, forKey: .number)
|
||||||
@ -91,6 +94,7 @@ open class BadgeIndicatorModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
try container.encodeIfPresent(number, forKey: .number)
|
try container.encodeIfPresent(number, forKey: .number)
|
||||||
try container.encodeIfPresent(fillColor, forKey: .fillColor)
|
try container.encodeIfPresent(fillColor, forKey: .fillColor)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ open class BadgeModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "badge"
|
public static var identifier: String = "badge"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - VDS Properties
|
// MARK: - VDS Properties
|
||||||
@ -28,13 +29,14 @@ open class BadgeModel: MoleculeModelProtocol {
|
|||||||
public var surface: Surface = .light
|
public var surface: Surface = .light
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id, text, accessibilityText, fillColor, surface, numberOfLines, maxWidth
|
case id, accessibilityIdentifier, text, accessibilityText, fillColor, surface, numberOfLines, maxWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
required public convenience init(from decoder: Decoder) throws {
|
required public convenience init(from decoder: Decoder) throws {
|
||||||
self.init()
|
self.init()
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
text = try container.decode(String.self, forKey: .text)
|
text = try container.decode(String.self, forKey: .text)
|
||||||
accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
fillColor = try container.decodeIfPresent(Badge.FillColor.self, forKey: .fillColor) ?? .red
|
fillColor = try container.decodeIfPresent(Badge.FillColor.self, forKey: .fillColor) ?? .red
|
||||||
@ -48,6 +50,7 @@ open class BadgeModel: MoleculeModelProtocol {
|
|||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(text, forKey: .text)
|
try container.encode(text, forKey: .text)
|
||||||
try container.encode(accessibilityText, forKey: .accessibilityText)
|
try container.encode(accessibilityText, forKey: .accessibilityText)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(fillColor, forKey: .fillColor)
|
try container.encode(fillColor, forKey: .fillColor)
|
||||||
try container.encode(surface, forKey: .surface)
|
try container.encode(surface, forKey: .surface)
|
||||||
try container.encode(numberOfLines, forKey: .numberOfLines)
|
try container.encode(numberOfLines, forKey: .numberOfLines)
|
||||||
|
|||||||
@ -25,6 +25,9 @@ open class ButtonIcon: VDS.ButtonIcon, VDSMoleculeViewProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
|
|
||||||
onClick = { [weak self] control in
|
onClick = { [weak self] control in
|
||||||
|
|||||||
@ -16,6 +16,7 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "buttonIcon"
|
public static var identifier: String = "buttonIcon"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - VDS Properties
|
// MARK: - VDS Properties
|
||||||
@ -77,6 +78,7 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case inverted
|
case inverted
|
||||||
case accessibilityText
|
case accessibilityText
|
||||||
case action
|
case action
|
||||||
@ -105,6 +107,7 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
action = try container.decodeModel(codingKey: .action)
|
action = try container.decodeModel(codingKey: .action)
|
||||||
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
||||||
accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try container.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
badgeIndicator = try container.decodeIfPresent(BadgeIndicatorModel.self, forKey: .badgeIndicator)
|
badgeIndicator = try container.decodeIfPresent(BadgeIndicatorModel.self, forKey: .badgeIndicator)
|
||||||
@ -128,6 +131,7 @@ open class ButtonIconModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
try container.encodeIfPresent(badgeIndicator, forKey: .badgeIndicator)
|
try container.encodeIfPresent(badgeIndicator, forKey: .badgeIndicator)
|
||||||
|
|||||||
@ -22,6 +22,9 @@ open class CalendarView: VDS.CalendarBase, VDSMoleculeViewProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
if let _selectedDate = viewModel.selectedDate {
|
if let _selectedDate = viewModel.selectedDate {
|
||||||
selectedDate = _selectedDate
|
selectedDate = _selectedDate
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ open class CalendarViewModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "calendar"
|
public static var identifier: String = "calendar"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var dateFormatter: DateFormatter = {
|
public var dateFormatter: DateFormatter = {
|
||||||
let formatter = DateFormatter()
|
let formatter = DateFormatter()
|
||||||
@ -51,6 +52,8 @@ open class CalendarViewModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
|
case moleculeName
|
||||||
case inverted
|
case inverted
|
||||||
case dateFormat
|
case dateFormat
|
||||||
case hideContainerBorder
|
case hideContainerBorder
|
||||||
@ -76,6 +79,7 @@ open class CalendarViewModel: MoleculeModelProtocol {
|
|||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
||||||
|
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
hideContainerBorder = try container.decodeIfPresent(Bool.self, forKey: .hideContainerBorder)
|
hideContainerBorder = try container.decodeIfPresent(Bool.self, forKey: .hideContainerBorder)
|
||||||
hideCurrentDateIndicator = try container.decodeIfPresent(Bool.self, forKey: .hideCurrentDateIndicator)
|
hideCurrentDateIndicator = try container.decodeIfPresent(Bool.self, forKey: .hideCurrentDateIndicator)
|
||||||
@ -111,7 +115,9 @@ open class CalendarViewModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
try container.encode(dateFormat, forKey: .dateFormat)
|
try container.encode(dateFormat, forKey: .dateFormat)
|
||||||
try container.encode(hideContainerBorder, forKey: .hideContainerBorder)
|
try container.encode(hideContainerBorder, forKey: .hideContainerBorder)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import MVMCore
|
|||||||
|
|
||||||
public static var identifier: String = "caretView"
|
public static var identifier: String = "caretView"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var strokeColor: Color = Color(uiColor: .mvmBlack)
|
public var strokeColor: Color = Color(uiColor: .mvmBlack)
|
||||||
public var strokeColor_inverted: Color = Color(uiColor: .mvmWhite)
|
public var strokeColor_inverted: Color = Color(uiColor: .mvmWhite)
|
||||||
@ -30,6 +31,7 @@ import MVMCore
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case strokeColor
|
case strokeColor
|
||||||
@ -54,6 +56,7 @@ import MVMCore
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
if let strokeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .strokeColor) {
|
if let strokeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .strokeColor) {
|
||||||
self.strokeColor = strokeColor
|
self.strokeColor = strokeColor
|
||||||
@ -84,6 +87,7 @@ import MVMCore
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(strokeColor, forKey: .strokeColor)
|
try container.encode(strokeColor, forKey: .strokeColor)
|
||||||
try container.encode(strokeColor_inverted, forKey: .strokeColor_inverted)
|
try container.encode(strokeColor_inverted, forKey: .strokeColor_inverted)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
|
|||||||
@ -19,6 +19,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var moleculeName: String?
|
public var moleculeName: String?
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case currentIndex
|
case currentIndex
|
||||||
@ -70,6 +72,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
|
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
|
||||||
@ -118,6 +121,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(currentIndex, forKey: .currentIndex)
|
try container.encode(currentIndex, forKey: .currentIndex)
|
||||||
try container.encode(alwaysSendAction, forKey: .alwaysSendAction)
|
try container.encode(alwaysSendAction, forKey: .alwaysSendAction)
|
||||||
|
|||||||
@ -31,6 +31,9 @@ import VDS
|
|||||||
// MARK: - Atomic
|
// MARK: - Atomic
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open func viewModelDidUpdate() {
|
open func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
|
|
||||||
updateCheckbox()
|
updateCheckbox()
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import VDS
|
|||||||
open class var identifier: String { "checkboxLabel" }
|
open class var identifier: String { "checkboxLabel" }
|
||||||
public var moleculeName: String = CheckboxLabelModel.identifier
|
public var moleculeName: String = CheckboxLabelModel.identifier
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var checkbox: CheckboxModel
|
public var checkbox: CheckboxModel
|
||||||
|
|||||||
@ -14,6 +14,7 @@ public class CircularProgressBarModel: GraphSizeBase, MoleculeModelProtocol {
|
|||||||
|
|
||||||
public static var identifier: String = "circularProgress"
|
public static var identifier: String = "circularProgress"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var percent: Int = 0
|
public var percent: Int = 0
|
||||||
public var diameter: CGFloat? = 64
|
public var diameter: CGFloat? = 64
|
||||||
@ -31,6 +32,7 @@ public class CircularProgressBarModel: GraphSizeBase, MoleculeModelProtocol {
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case percent
|
case percent
|
||||||
case size
|
case size
|
||||||
@ -48,6 +50,7 @@ public class CircularProgressBarModel: GraphSizeBase, MoleculeModelProtocol {
|
|||||||
super.init()
|
super.init()
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
percent = try typeContainer.decode(Int.self, forKey: .percent)
|
percent = try typeContainer.decode(Int.self, forKey: .percent)
|
||||||
|
|
||||||
@ -89,6 +92,7 @@ public class CircularProgressBarModel: GraphSizeBase, MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(percent, forKey: .percent)
|
try container.encode(percent, forKey: .percent)
|
||||||
try container.encodeIfPresent(size, forKey: .size)
|
try container.encodeIfPresent(size, forKey: .size)
|
||||||
try container.encodeIfPresent(diameter, forKey: .diameter)
|
try container.encodeIfPresent(diameter, forKey: .diameter)
|
||||||
|
|||||||
@ -31,6 +31,9 @@ open class Icon: VDS.Icon, VDSMoleculeViewProtocol{
|
|||||||
// MARK: - Public
|
// MARK: - Public
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
color = viewModel.color.uiColor
|
color = viewModel.color.uiColor
|
||||||
size = viewModel.size
|
size = viewModel.size
|
||||||
|
|||||||
@ -21,6 +21,8 @@ open class IconModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
/// A representation that will be used to render the icon with corresponding name.
|
/// A representation that will be used to render the icon with corresponding name.
|
||||||
public var name: Icon.Name
|
public var name: Icon.Name
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var moleculeName: String = ImageViewModel.identifier
|
public var moleculeName: String = ImageViewModel.identifier
|
||||||
public var image: String
|
public var image: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var accessibilityText: String?
|
public var accessibilityText: String?
|
||||||
public var fallbackImage: String?
|
public var fallbackImage: String?
|
||||||
public var imageFormat: String?
|
public var imageFormat: String?
|
||||||
@ -47,6 +48,7 @@
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case image
|
case image
|
||||||
|
|||||||
@ -182,6 +182,9 @@ public typealias ActionBlock = () -> ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
shouldMaskWhileRecording = viewModel.shouldMaskRecordedView ?? false
|
shouldMaskWhileRecording = viewModel.shouldMaskRecordedView ?? false
|
||||||
text = viewModel.text
|
text = viewModel.text
|
||||||
hero = viewModel.hero
|
hero = viewModel.hero
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import VDS
|
|||||||
|
|
||||||
open class var identifier: String { "label" }
|
open class var identifier: String { "label" }
|
||||||
public var id: String
|
public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var text: String
|
public var text: String
|
||||||
@ -38,6 +39,7 @@ import VDS
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case text
|
case text
|
||||||
case accessibilityText
|
case accessibilityText
|
||||||
@ -88,6 +90,7 @@ import VDS
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
text = try typeContainer.decode(String.self, forKey: .text)
|
text = try typeContainer.decode(String.self, forKey: .text)
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
textColor = try typeContainer.decodeIfPresent(Color.self, forKey: .textColor)
|
textColor = try typeContainer.decodeIfPresent(Color.self, forKey: .textColor)
|
||||||
@ -115,6 +118,7 @@ import VDS
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
try container.encodeIfPresent(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(text, forKey: .text)
|
try container.encode(text, forKey: .text)
|
||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
try container.encodeIfPresent(textColor, forKey: .textColor)
|
try container.encodeIfPresent(textColor, forKey: .textColor)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import UIKit
|
|||||||
public static var identifier: String = "leftRightLabelView"
|
public static var identifier: String = "leftRightLabelView"
|
||||||
public var moleculeName: String = LeftRightLabelModel.identifier
|
public var moleculeName: String = LeftRightLabelModel.identifier
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var leftText: LabelModel
|
public var leftText: LabelModel
|
||||||
|
|||||||
@ -93,6 +93,9 @@ import VDS
|
|||||||
// MARK: - VDSMoleculeViewProtocol
|
// MARK: - VDSMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open func viewModelDidUpdate() {
|
open func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
style = VDS.Line.Style(rawValue: viewModel.type.rawValue) ?? .primary
|
style = VDS.Line.Style(rawValue: viewModel.type.rawValue) ?? .primary
|
||||||
orientation = viewModel.orientation
|
orientation = viewModel.orientation
|
||||||
|
|||||||
@ -55,6 +55,7 @@ public class LineModel: MoleculeModelProtocol, Invertable {
|
|||||||
|
|
||||||
public static var identifier: String = "line"
|
public static var identifier: String = "line"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
public var type: Style = .secondary
|
public var type: Style = .secondary
|
||||||
@ -83,6 +84,7 @@ public class LineModel: MoleculeModelProtocol, Invertable {
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case type
|
case type
|
||||||
case frequency
|
case frequency
|
||||||
@ -99,6 +101,7 @@ public class LineModel: MoleculeModelProtocol, Invertable {
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
if let type = try typeContainer.decodeIfPresent(Style.self, forKey: .type) {
|
if let type = try typeContainer.decodeIfPresent(Style.self, forKey: .type) {
|
||||||
self.type = type
|
self.type = type
|
||||||
@ -124,6 +127,7 @@ public class LineModel: MoleculeModelProtocol, Invertable {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(type, forKey: .type)
|
try container.encode(type, forKey: .type)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
try container.encodeIfPresent(frequency, forKey: .frequency)
|
try container.encodeIfPresent(frequency, forKey: .frequency)
|
||||||
|
|||||||
@ -22,6 +22,9 @@ open class LoadingSpinner: VDS.Loader, VDSMoleculeViewProtocol {
|
|||||||
// MARK: - Public Functions
|
// MARK: - Public Functions
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open func viewModelDidUpdate() {
|
open func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
size = Int(viewModel.diameter)
|
size = Int(viewModel.diameter)
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public static var identifier: String = "loadingSpinner"
|
public static var identifier: String = "loadingSpinner"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var inverted: Bool = false
|
public var inverted: Bool = false
|
||||||
@ -27,6 +28,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case strokeColor
|
case strokeColor
|
||||||
case diameter
|
case diameter
|
||||||
@ -47,6 +49,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
if let diameter = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .diameter) {
|
if let diameter = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .diameter) {
|
||||||
self.diameter = diameter
|
self.diameter = diameter
|
||||||
@ -65,6 +68,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(diameter, forKey: .diameter)
|
try container.encodeIfPresent(diameter, forKey: .diameter)
|
||||||
try container.encodeIfPresent(inverted, forKey: .inverted)
|
try container.encodeIfPresent(inverted, forKey: .inverted)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import Foundation
|
|||||||
|
|
||||||
public static var identifier: String = "multiProgressBar"
|
public static var identifier: String = "multiProgressBar"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var progressList: [SingleProgressBarModel]
|
public var progressList: [SingleProgressBarModel]
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
@ -30,6 +31,7 @@ import Foundation
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case progressList
|
case progressList
|
||||||
case thickness
|
case thickness
|
||||||
@ -44,6 +46,7 @@ import Foundation
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
progressList = try typeContainer.decode([SingleProgressBarModel].self, forKey: .progressList)
|
progressList = try typeContainer.decode([SingleProgressBarModel].self, forKey: .progressList)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
|
thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
|
||||||
@ -54,6 +57,7 @@ import Foundation
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(progressList, forKey: .progressList)
|
try container.encode(progressList, forKey: .progressList)
|
||||||
try container.encodeIfPresent(thickness, forKey: .thickness)
|
try container.encodeIfPresent(thickness, forKey: .thickness)
|
||||||
try container.encodeIfPresent(roundedCorners, forKey: .roundedCorners)
|
try container.encodeIfPresent(roundedCorners, forKey: .roundedCorners)
|
||||||
|
|||||||
@ -39,6 +39,9 @@ import VDS
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func viewModelDidUpdate() {
|
open func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
isEnabled = viewModel.enabled
|
isEnabled = viewModel.enabled
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
total = viewModel.totalPages
|
total = viewModel.totalPages
|
||||||
|
|||||||
@ -19,6 +19,7 @@ open class PaginationModel: MoleculeModelProtocol {
|
|||||||
open var moleculeName: String { Self.identifier }
|
open var moleculeName: String { Self.identifier }
|
||||||
open var backgroundColor: Color?
|
open var backgroundColor: Color?
|
||||||
open var id: String = UUID().uuidString
|
open var id: String = UUID().uuidString
|
||||||
|
open var accessibilityIdentifier: String?
|
||||||
|
|
||||||
open var totalPages: Int = 0
|
open var totalPages: Int = 0
|
||||||
open var selectedPage: Int = 0
|
open var selectedPage: Int = 0
|
||||||
@ -31,6 +32,9 @@ open class PaginationModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case totalPages
|
case totalPages
|
||||||
case selectedPage
|
case selectedPage
|
||||||
case enabled
|
case enabled
|
||||||
@ -43,6 +47,8 @@ open class PaginationModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
id = try container.decode(String.self, forKey: .id)
|
||||||
|
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
totalPages = try container.decode(Int.self, forKey: .totalPages)
|
totalPages = try container.decode(Int.self, forKey: .totalPages)
|
||||||
selectedPage = try container.decodeIfPresent(Int.self, forKey: .selectedPage) ?? 0
|
selectedPage = try container.decodeIfPresent(Int.self, forKey: .selectedPage) ?? 0
|
||||||
enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) ?? false
|
enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) ?? false
|
||||||
@ -51,6 +57,9 @@ open class PaginationModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(totalPages, forKey: .totalPages)
|
try container.encode(totalPages, forKey: .totalPages)
|
||||||
try container.encode(selectedPage, forKey: .selectedPage)
|
try container.encode(selectedPage, forKey: .selectedPage)
|
||||||
try container.encode(enabled, forKey: .enabled)
|
try container.encode(enabled, forKey: .enabled)
|
||||||
|
|||||||
@ -75,6 +75,9 @@ import Foundation
|
|||||||
guard let progressBarModel = model as? ProgressBarModel else { return }
|
guard let progressBarModel = model as? ProgressBarModel else { return }
|
||||||
|
|
||||||
self.progressBarModel = progressBarModel
|
self.progressBarModel = progressBarModel
|
||||||
|
if let accessibilityIdentifier = model.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
thickness = progressBarModel.thickness ?? 8
|
thickness = progressBarModel.thickness ?? 8
|
||||||
progress = Float((progressBarModel.percent) / 100.0)
|
progress = Float((progressBarModel.percent) / 100.0)
|
||||||
progressTintColor = progressBarModel.color.uiColor
|
progressTintColor = progressBarModel.color.uiColor
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import Foundation
|
|||||||
@objcMembers open class ProgressBarModel: MoleculeModelProtocol {
|
@objcMembers open class ProgressBarModel: MoleculeModelProtocol {
|
||||||
open class var identifier: String { "progressBar" }
|
open class var identifier: String { "progressBar" }
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
@Percent public var percent: CGFloat
|
@Percent public var percent: CGFloat
|
||||||
public var color: Color = Color(uiColor: .mfCerulean())
|
public var color: Color = Color(uiColor: .mfCerulean())
|
||||||
@ -20,6 +21,7 @@ import Foundation
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case roundedCorners
|
case roundedCorners
|
||||||
case thickness
|
case thickness
|
||||||
@ -35,6 +37,7 @@ import Foundation
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
percent = try typeContainer.decode(CGFloat.self, forKey: .percent)
|
percent = try typeContainer.decode(CGFloat.self, forKey: .percent)
|
||||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) {
|
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) {
|
||||||
self.color = color
|
self.color = color
|
||||||
@ -50,6 +53,7 @@ import Foundation
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(percent, forKey: .percent)
|
try container.encode(percent, forKey: .percent)
|
||||||
try container.encode(color, forKey: .color)
|
try container.encode(color, forKey: .color)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -14,6 +14,7 @@ open class StarModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public static var identifier: String = "star"
|
public static var identifier: String = "star"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
@Percent public var percent: CGFloat = 0
|
@Percent public var percent: CGFloat = 0
|
||||||
@ -26,6 +27,7 @@ open class StarModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case percent
|
case percent
|
||||||
@ -47,6 +49,7 @@ open class StarModel: MoleculeModelProtocol {
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
if let percent = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .percent) {
|
if let percent = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .percent) {
|
||||||
self.percent = percent
|
self.percent = percent
|
||||||
}
|
}
|
||||||
@ -63,6 +66,7 @@ open class StarModel: MoleculeModelProtocol {
|
|||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(percent, forKey: .percent)
|
try container.encode(percent, forKey: .percent)
|
||||||
try container.encodeIfPresent(borderColor, forKey: .borderColor)
|
try container.encodeIfPresent(borderColor, forKey: .borderColor)
|
||||||
try container.encodeIfPresent(fillColor, forKey: .fillColor)
|
try container.encodeIfPresent(fillColor, forKey: .fillColor)
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public static var identifier: String = "stars"
|
public static var identifier: String = "stars"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var starBackgroundColor: Color?
|
public var starBackgroundColor: Color?
|
||||||
@ -28,6 +29,7 @@ import MVMCore
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case starBackgroundColor
|
case starBackgroundColor
|
||||||
@ -53,6 +55,7 @@ import MVMCore
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
stars = try typeContainer.decode([StarModel].self, forKey: .stars)
|
stars = try typeContainer.decode([StarModel].self, forKey: .stars)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
starBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .starBackgroundColor)
|
starBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .starBackgroundColor)
|
||||||
@ -70,6 +73,7 @@ import MVMCore
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(stars, forKey: .stars)
|
try container.encode(stars, forKey: .stars)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(starBackgroundColor, forKey: .starBackgroundColor)
|
try container.encodeIfPresent(starBackgroundColor, forKey: .starBackgroundColor)
|
||||||
|
|||||||
@ -40,7 +40,9 @@ open class TileContainer: VDS.TileContainer, VDSMoleculeViewProtocol{
|
|||||||
// MARK: - Public
|
// MARK: - Public
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
if let moleculeModel = viewModel.molecule {
|
if let moleculeModel = viewModel.molecule {
|
||||||
if let molecule,
|
if let molecule,
|
||||||
moleculeModel.moleculeName == molecule.model?.moleculeName {
|
moleculeModel.moleculeName == molecule.model?.moleculeName {
|
||||||
|
|||||||
@ -70,8 +70,10 @@ open class TileContainerBaseModel<PaddingType: DefaultValuing & Codable, TileCon
|
|||||||
public var aspectRatio: TileContainerType.AspectRatio = .none
|
public var aspectRatio: TileContainerType.AspectRatio = .none
|
||||||
public var backgroundEffect: TileContainerType.BackgroundEffect = .none
|
public var backgroundEffect: TileContainerType.BackgroundEffect = .none
|
||||||
public var surface: Surface { inverted ? .dark : .light }
|
public var surface: Surface { inverted ? .dark : .light }
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case accessibilityIdentifier
|
||||||
case inverted
|
case inverted
|
||||||
case backgroundImage
|
case backgroundImage
|
||||||
case action
|
case action
|
||||||
@ -88,6 +90,7 @@ open class TileContainerBaseModel<PaddingType: DefaultValuing & Codable, TileCon
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
||||||
backgroundImage = try container.decodeIfPresent(String.self, forKey: .backgroundImage)
|
backgroundImage = try container.decodeIfPresent(String.self, forKey: .backgroundImage)
|
||||||
action = try container.decodeModelIfPresent(codingKey: .action)
|
action = try container.decodeModelIfPresent(codingKey: .action)
|
||||||
@ -104,6 +107,7 @@ open class TileContainerBaseModel<PaddingType: DefaultValuing & Codable, TileCon
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundImage, forKey: .backgroundImage)
|
try container.encodeIfPresent(backgroundImage, forKey: .backgroundImage)
|
||||||
try container.encodeModelIfPresent(action, forKey: .action)
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
try container.encodeIfPresent(imageFallbackColor, forKey: .imageFallbackColor)
|
try container.encodeIfPresent(imageFallbackColor, forKey: .imageFallbackColor)
|
||||||
|
|||||||
@ -39,6 +39,9 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{
|
|||||||
// MARK: - Public
|
// MARK: - Public
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
//tilelet specific properties
|
//tilelet specific properties
|
||||||
if let value = viewModel.textWidth {
|
if let value = viewModel.textWidth {
|
||||||
textWidth = .value(value)
|
textWidth = .value(value)
|
||||||
|
|||||||
@ -28,6 +28,9 @@ open class Tooltip: VDS.Tooltip, VDSMoleculeViewProtocol{
|
|||||||
// MARK: - Public
|
// MARK: - Public
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
fillColor = viewModel.fillColor
|
fillColor = viewModel.fillColor
|
||||||
size = viewModel.size
|
size = viewModel.size
|
||||||
|
|||||||
@ -22,6 +22,8 @@ open class TooltipModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var size: VDS.Tooltip.Size = .medium
|
public var size: VDS.Tooltip.Size = .medium
|
||||||
|
|
||||||
public var fillColor: VDS.Tooltip.FillColor = .primary
|
public var fillColor: VDS.Tooltip.FillColor = .primary
|
||||||
@ -39,6 +41,7 @@ open class TooltipModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case closeButtonText
|
case closeButtonText
|
||||||
@ -52,13 +55,14 @@ open class TooltipModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
self.id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
self.backgroundColor = try container.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try container.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
self.title = try container.decodeIfPresent(String.self, forKey: .title)
|
title = try container.decodeIfPresent(String.self, forKey: .title)
|
||||||
self.content = try container.decodeIfPresent(String.self, forKey: .content)
|
content = try container.decodeIfPresent(String.self, forKey: .content)
|
||||||
|
|
||||||
self.molecule = try container.decodeModelIfPresent(codingKey: .contentView)
|
molecule = try container.decodeModelIfPresent(codingKey: .contentView)
|
||||||
|
|
||||||
if let closeButtonText = try container.decodeIfPresent(String.self, forKey: .closeButtonText) {
|
if let closeButtonText = try container.decodeIfPresent(String.self, forKey: .closeButtonText) {
|
||||||
self.closeButtonText = closeButtonText
|
self.closeButtonText = closeButtonText
|
||||||
@ -81,6 +85,7 @@ open class TooltipModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(surface, forKey: .surface)
|
try container.encode(surface, forKey: .surface)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import Foundation
|
|||||||
open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
||||||
public static var identifier = "video"
|
public static var identifier = "video"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var video: String
|
public var video: String
|
||||||
public var showControls = false
|
public var showControls = false
|
||||||
@ -45,6 +46,7 @@ open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case video
|
case video
|
||||||
case showControls
|
case showControls
|
||||||
@ -60,6 +62,7 @@ open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
video = try typeContainer.decode(String.self, forKey:.video)
|
video = try typeContainer.decode(String.self, forKey:.video)
|
||||||
if let showControls = try typeContainer.decodeIfPresent(Bool.self, forKey: .showControls) {
|
if let showControls = try typeContainer.decodeIfPresent(Bool.self, forKey: .showControls) {
|
||||||
self.showControls = showControls
|
self.showControls = showControls
|
||||||
@ -76,6 +79,7 @@ open class VideoModel: MoleculeModelProtocol, PageBehaviorProtocolRequirer {
|
|||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(video, forKey: .video)
|
try container.encode(video, forKey: .video)
|
||||||
try container.encode(showControls, forKey: .showControls)
|
try container.encode(showControls, forKey: .showControls)
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import MVMCore
|
|||||||
public static var identifier: String = "webview"
|
public static var identifier: String = "webview"
|
||||||
public var moleculeName: String = WebViewModel.identifier
|
public var moleculeName: String = WebViewModel.identifier
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var url: URL?
|
public var url: URL?
|
||||||
@ -26,6 +27,7 @@ import MVMCore
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey{
|
private enum CodingKeys: String, CodingKey{
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case url
|
case url
|
||||||
@ -43,6 +45,7 @@ import MVMCore
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
url = try typeContainer.decodeIfPresent(URL.self, forKey: .url)
|
url = try typeContainer.decodeIfPresent(URL.self, forKey: .url)
|
||||||
htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString)
|
htmlString = try typeContainer.decodeIfPresent(String.self, forKey: .htmlString)
|
||||||
@ -57,6 +60,7 @@ import MVMCore
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(url, forKey: .url)
|
try container.encodeIfPresent(url, forKey: .url)
|
||||||
try container.encodeIfPresent(htmlString, forKey: .htmlString)
|
try container.encodeIfPresent(htmlString, forKey: .htmlString)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ public class WheelModel: GraphSizeBase, MoleculeModelProtocol {
|
|||||||
|
|
||||||
public static var identifier: String = "wheel"
|
public static var identifier: String = "wheel"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var style: GraphStyle = .unlimited {
|
public var style: GraphStyle = .unlimited {
|
||||||
didSet {
|
didSet {
|
||||||
@ -38,6 +39,7 @@ public class WheelModel: GraphSizeBase, MoleculeModelProtocol {
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case style
|
case style
|
||||||
case size
|
case size
|
||||||
case diameter
|
case diameter
|
||||||
@ -53,6 +55,7 @@ public class WheelModel: GraphSizeBase, MoleculeModelProtocol {
|
|||||||
super.init()
|
super.init()
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
if let style = try typeContainer.decodeIfPresent(GraphStyle.self, forKey: .style) {
|
if let style = try typeContainer.decodeIfPresent(GraphStyle.self, forKey: .style) {
|
||||||
self.style = style
|
self.style = style
|
||||||
@ -84,6 +87,7 @@ public class WheelModel: GraphSizeBase, MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(style, forKey: .style)
|
try container.encode(style, forKey: .style)
|
||||||
try container.encode(size, forKey: .size)
|
try container.encode(size, forKey: .size)
|
||||||
try container.encode(diameter, forKey: .diameter)
|
try container.encode(diameter, forKey: .diameter)
|
||||||
|
|||||||
@ -30,6 +30,9 @@ import VDS
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func viewModelDidUpdate() {
|
open func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
isEnabled = viewModel.enabled
|
isEnabled = viewModel.enabled
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
breadcrumbModels = viewModel.breadcrumbs.compactMap { [unowned self] breadcrumb in
|
breadcrumbModels = viewModel.breadcrumbs.compactMap { [unowned self] breadcrumb in
|
||||||
|
|||||||
@ -19,6 +19,7 @@ open class BreadcrumbsModel: MoleculeModelProtocol, ParentMoleculeModelProtocol
|
|||||||
open var moleculeName: String { Self.identifier }
|
open var moleculeName: String { Self.identifier }
|
||||||
open var backgroundColor: Color?
|
open var backgroundColor: Color?
|
||||||
open var id: String = UUID().uuidString
|
open var id: String = UUID().uuidString
|
||||||
|
open var accessibilityIdentifier: String?
|
||||||
open var children: [any MoleculeModelProtocol] { breadcrumbs }
|
open var children: [any MoleculeModelProtocol] { breadcrumbs }
|
||||||
|
|
||||||
open var breadcrumbs: [BreadcrumbModel] = []
|
open var breadcrumbs: [BreadcrumbModel] = []
|
||||||
@ -31,6 +32,8 @@ open class BreadcrumbsModel: MoleculeModelProtocol, ParentMoleculeModelProtocol
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case accessibilityIdentifier
|
||||||
|
case moleculeName
|
||||||
case breadcrumbs
|
case breadcrumbs
|
||||||
case enabled
|
case enabled
|
||||||
case inverted
|
case inverted
|
||||||
@ -42,6 +45,7 @@ open class BreadcrumbsModel: MoleculeModelProtocol, ParentMoleculeModelProtocol
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
breadcrumbs = try container.decode([BreadcrumbModel].self, forKey: .breadcrumbs)
|
breadcrumbs = try container.decode([BreadcrumbModel].self, forKey: .breadcrumbs)
|
||||||
enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) ?? false
|
enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) ?? false
|
||||||
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
||||||
@ -49,6 +53,9 @@ open class BreadcrumbsModel: MoleculeModelProtocol, ParentMoleculeModelProtocol
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encode(breadcrumbs, forKey: .breadcrumbs)
|
||||||
try container.encode(enabled, forKey: .enabled)
|
try container.encode(enabled, forKey: .enabled)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
}
|
}
|
||||||
@ -68,6 +75,7 @@ open class BreadcrumbModel: MoleculeModelProtocol {
|
|||||||
open var moleculeName: String { Self.identifier }
|
open var moleculeName: String { Self.identifier }
|
||||||
open var backgroundColor: Color?
|
open var backgroundColor: Color?
|
||||||
open var id: String = UUID().uuidString
|
open var id: String = UUID().uuidString
|
||||||
|
open var accessibilityIdentifier: String?
|
||||||
|
|
||||||
open var text: String = ""
|
open var text: String = ""
|
||||||
open var selected: Bool = false
|
open var selected: Bool = false
|
||||||
@ -79,6 +87,8 @@ open class BreadcrumbModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case text
|
case text
|
||||||
case selected
|
case selected
|
||||||
case action
|
case action
|
||||||
@ -90,6 +100,7 @@ open class BreadcrumbModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
accessibilityIdentifier = try container.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
text = try container.decode(String.self, forKey: .text)
|
text = try container.decode(String.self, forKey: .text)
|
||||||
selected = try container.decodeIfPresent(Bool.self, forKey: .selected) ?? false
|
selected = try container.decodeIfPresent(Bool.self, forKey: .selected) ?? false
|
||||||
action = try container.decodeModel(codingKey: .action)
|
action = try container.decodeModel(codingKey: .action)
|
||||||
@ -97,6 +108,8 @@ open class BreadcrumbModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(text, forKey: .text)
|
try container.encode(text, forKey: .text)
|
||||||
try container.encode(selected, forKey: .selected)
|
try container.encode(selected, forKey: .selected)
|
||||||
try container.encodeModelIfPresent(action, forKey: .action)
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
|
|||||||
@ -14,6 +14,7 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public static var identifier: String = "planNamesLockup"
|
public static var identifier: String = "planNamesLockup"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var headline: LabelModel
|
public var headline: LabelModel
|
||||||
@ -35,6 +36,7 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case headline
|
case headline
|
||||||
case subHeadline
|
case subHeadline
|
||||||
@ -47,6 +49,7 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
|
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
|
||||||
subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline)
|
subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline)
|
||||||
@ -57,6 +60,7 @@ public class LockUpsPlanNamesModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(headline, forKey: .headline)
|
try container.encode(headline, forKey: .headline)
|
||||||
try container.encode(subHeadline, forKey: .subHeadline)
|
try container.encode(subHeadline, forKey: .subHeadline)
|
||||||
|
|||||||
@ -15,6 +15,7 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public static var identifier: String = "planLockup"
|
public static var identifier: String = "planLockup"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var planLabel : LabelModel
|
public var planLabel : LabelModel
|
||||||
@ -47,6 +48,7 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case planLabel
|
case planLabel
|
||||||
case headline
|
case headline
|
||||||
@ -61,6 +63,7 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
planLabel = try typeContainer.decode(LabelModel.self, forKey: .planLabel)
|
planLabel = try typeContainer.decode(LabelModel.self, forKey: .planLabel)
|
||||||
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
|
headline = try typeContainer.decode(LabelModel.self, forKey: .headline)
|
||||||
@ -73,6 +76,7 @@ public class LockupsPlanSMLXLModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(planLabel, forKey: .planLabel)
|
try container.encode(planLabel, forKey: .planLabel)
|
||||||
try container.encode(headline, forKey: .headline)
|
try container.encode(headline, forKey: .headline)
|
||||||
|
|||||||
@ -20,6 +20,9 @@ import VDS
|
|||||||
// MARK: - Public Functions
|
// MARK: - Public Functions
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open func viewModelDidUpdate() {
|
open func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
textAlignment = viewModel.textAlignment
|
textAlignment = viewModel.textAlignment
|
||||||
eyebrowModel = viewModel.eyebrowModel(delegateObject: delegateObject, additionalData: additionalData)
|
eyebrowModel = viewModel.eyebrowModel(delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
|
|||||||
public static var identifier: String = "titleLockup"
|
public static var identifier: String = "titleLockup"
|
||||||
public var moleculeName: String = TitleLockupModel.identifier
|
public var moleculeName: String = TitleLockupModel.identifier
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var textAlignment: TitleLockup.TextAlignment = .left
|
public var textAlignment: TitleLockup.TextAlignment = .left
|
||||||
public var eyebrow: LabelModel?
|
public var eyebrow: LabelModel?
|
||||||
@ -72,6 +73,7 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case textAlignment
|
case textAlignment
|
||||||
case eyebrow
|
case eyebrow
|
||||||
case eyebrowColor
|
case eyebrowColor
|
||||||
@ -89,6 +91,7 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
textAlignment = try typeContainer.decodeIfPresent(TitleLockup.TextAlignment.self, forKey: .textAlignment) ?? .left
|
textAlignment = try typeContainer.decodeIfPresent(TitleLockup.TextAlignment.self, forKey: .textAlignment) ?? .left
|
||||||
title = try typeContainer.decodeMolecule(codingKey: .title)
|
title = try typeContainer.decodeMolecule(codingKey: .title)
|
||||||
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
||||||
@ -136,6 +139,7 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(textAlignment, forKey: .textAlignment)
|
try container.encode(textAlignment, forKey: .textAlignment)
|
||||||
try container.encodeIfPresent(eyebrow, forKey: .eyebrow)
|
try container.encodeIfPresent(eyebrow, forKey: .eyebrow)
|
||||||
try container.encode(eyebrowColor, forKey: .eyebrowColor)
|
try container.encode(eyebrowColor, forKey: .eyebrowColor)
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import Foundation
|
|||||||
public static var identifier: String = "doughnutChartItem"
|
public static var identifier: String = "doughnutChartItem"
|
||||||
public var moleculeName: String = DoughnutChartItemModel.identifier
|
public var moleculeName: String = DoughnutChartItemModel.identifier
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var label: LabelModel
|
public var label: LabelModel
|
||||||
@ -28,6 +29,8 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case label
|
case label
|
||||||
case percent
|
case percent
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import Foundation
|
|||||||
public static var identifier: String = "doughnutChart"
|
public static var identifier: String = "doughnutChart"
|
||||||
public var moleculeName: String = DoughnutChartModel.identifier
|
public var moleculeName: String = DoughnutChartModel.identifier
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var title: LabelModel?
|
public var title: LabelModel?
|
||||||
|
|||||||
@ -16,6 +16,7 @@ public class ImageHeadlineBodyModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "imageHeadlineBody"
|
public static var identifier: String = "imageHeadlineBody"
|
||||||
public var moleculeName: String = ImageHeadlineBodyModel.identifier
|
public var moleculeName: String = ImageHeadlineBodyModel.identifier
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var image: ImageViewModel
|
public var image: ImageViewModel
|
||||||
|
|||||||
@ -80,6 +80,10 @@ import VDS
|
|||||||
// MARK: - Atomic
|
// MARK: - Atomic
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
|
|
||||||
updateRadioButton()
|
updateRadioButton()
|
||||||
|
|||||||
@ -10,13 +10,14 @@ import Foundation
|
|||||||
import MVMCore
|
import MVMCore
|
||||||
import VDS
|
import VDS
|
||||||
|
|
||||||
@objcMembers public class RadioButtonLabelModel: MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
public class RadioButtonLabelModel: MoleculeModelProtocol, ParentMoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "radioButtonLabel"
|
public static var identifier: String = "radioButtonLabel"
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var moleculeName: String = RadioButtonLabelModel.identifier
|
public var moleculeName: String = RadioButtonLabelModel.identifier
|
||||||
|
|||||||
@ -38,6 +38,10 @@ import VDSCoreTokens
|
|||||||
guard let model = model as? TabBarModel else { return }
|
guard let model = model as? TabBarModel else { return }
|
||||||
self.model = model
|
self.model = model
|
||||||
|
|
||||||
|
if let accessibilityIdentifier = model.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
// Set appearance
|
// Set appearance
|
||||||
let appearance = UITabBarAppearance()
|
let appearance = UITabBarAppearance()
|
||||||
appearance.backgroundColor = model.backgroundColor?.uiColor
|
appearance.backgroundColor = model.backgroundColor?.uiColor
|
||||||
@ -51,6 +55,9 @@ import VDSCoreTokens
|
|||||||
for (index, tab) in model.tabs.enumerated() {
|
for (index, tab) in model.tabs.enumerated() {
|
||||||
let tabBarItem = UITabBarItem(title: tab.title, image: MVMCoreCache.shared()?.getImageFromRegisteredBundles(tab.image), tag: index)
|
let tabBarItem = UITabBarItem(title: tab.title, image: MVMCoreCache.shared()?.getImageFromRegisteredBundles(tab.image), tag: index)
|
||||||
tabBarItem.accessibilityLabel = tab.accessibilityText
|
tabBarItem.accessibilityLabel = tab.accessibilityText
|
||||||
|
if let accessibilityIdentifier = tab.accessibilityIdentifier {
|
||||||
|
tabBarItem.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
tabs.append(tabBarItem)
|
tabs.append(tabBarItem)
|
||||||
}
|
}
|
||||||
setItems(tabs, animated: false)
|
setItems(tabs, animated: false)
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import VDSCoreTokens
|
|||||||
open class TabBarModel: MoleculeModelProtocol {
|
open class TabBarModel: MoleculeModelProtocol {
|
||||||
public static var identifier: String = "tabBar"
|
public static var identifier: String = "tabBar"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
open var tabs: [TabBarItemModel]
|
open var tabs: [TabBarItemModel]
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ open class TabBarModel: MoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case tabs
|
case tabs
|
||||||
case selectedColor
|
case selectedColor
|
||||||
@ -77,6 +79,7 @@ open class TabBarModel: MoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
tabs = try typeContainer.decode([TabBarItemModel].self, forKey: .tabs)
|
tabs = try typeContainer.decode([TabBarItemModel].self, forKey: .tabs)
|
||||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) {
|
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) {
|
||||||
backgroundColor = color
|
backgroundColor = color
|
||||||
@ -99,6 +102,7 @@ open class TabBarModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(tabs, forKey: .tabs)
|
try container.encode(tabs, forKey: .tabs)
|
||||||
try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(_selectedColor, forKey: .selectedColor)
|
try container.encodeIfPresent(_selectedColor, forKey: .selectedColor)
|
||||||
@ -134,12 +138,14 @@ open class TabBarItemModel: Codable, Equatable, MoleculeModelComparisonProtocol
|
|||||||
open var image: String
|
open var image: String
|
||||||
open var action: ActionModelProtocol
|
open var action: ActionModelProtocol
|
||||||
open var accessibilityText: String?
|
open var accessibilityText: String?
|
||||||
|
open var accessibilityIdentifier: String?
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case title
|
case title
|
||||||
case image
|
case image
|
||||||
case action
|
case action
|
||||||
case accessibilityText
|
case accessibilityText
|
||||||
|
case accessibilityIdentifier
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(with title: String?, image: String, action: ActionModelProtocol) {
|
public init(with title: String?, image: String, action: ActionModelProtocol) {
|
||||||
@ -154,6 +160,7 @@ open class TabBarItemModel: Codable, Equatable, MoleculeModelComparisonProtocol
|
|||||||
image = try typeContainer.decode(String.self, forKey: .image)
|
image = try typeContainer.decode(String.self, forKey: .image)
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
@ -162,6 +169,7 @@ open class TabBarItemModel: Codable, Equatable, MoleculeModelComparisonProtocol
|
|||||||
try container.encode(image, forKey: .image)
|
try container.encode(image, forKey: .image)
|
||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func == (lhs: TabBarItemModel, rhs: TabBarItemModel) -> Bool {
|
public static func == (lhs: TabBarItemModel, rhs: TabBarItemModel) -> Bool {
|
||||||
|
|||||||
@ -63,6 +63,9 @@ import VDS
|
|||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
open func viewModelDidUpdate() {
|
open func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
borderLine = viewModel.borderLine
|
borderLine = viewModel.borderLine
|
||||||
if let minWidth = viewModel.minWidth {
|
if let minWidth = viewModel.minWidth {
|
||||||
self.minWidth = minWidth
|
self.minWidth = minWidth
|
||||||
|
|||||||
@ -13,6 +13,7 @@ open class TabsModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public static var identifier: String = "tabs"
|
public static var identifier: String = "tabs"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
open var tabs: [TabItemModel]
|
open var tabs: [TabItemModel]
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ open class TabsModel: MoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case tabs
|
case tabs
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case selectedIndex
|
case selectedIndex
|
||||||
@ -53,6 +55,7 @@ open class TabsModel: MoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
tabs = try typeContainer.decode([TabItemModel].self, forKey: .tabs)
|
tabs = try typeContainer.decode([TabItemModel].self, forKey: .tabs)
|
||||||
style = try typeContainer.decodeIfPresent(Surface.self, forKey: .style)
|
style = try typeContainer.decodeIfPresent(Surface.self, forKey: .style)
|
||||||
|
|
||||||
@ -94,6 +97,7 @@ open class TabsModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encode(tabs, forKey: .tabs)
|
try container.encode(tabs, forKey: .tabs)
|
||||||
try container.encode(selectedIndex, forKey: .selectedIndex)
|
try container.encode(selectedIndex, forKey: .selectedIndex)
|
||||||
try container.encode(fillContainer, forKey: .fillContainer)
|
try container.encode(fillContainer, forKey: .fillContainer)
|
||||||
|
|||||||
@ -64,6 +64,10 @@ import VDS
|
|||||||
// MARK: - VDSMoleculeViewProtocol
|
// MARK: - VDSMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
var buttons = [PillButton]()
|
var buttons = [PillButton]()
|
||||||
if let secondaryModel = viewModel.secondaryButton {
|
if let secondaryModel = viewModel.secondaryButton {
|
||||||
secondaryButton.set(with: secondaryModel, delegateObject, additionalData)
|
secondaryButton.set(with: secondaryModel, delegateObject, additionalData)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ public class TwoButtonViewModel: ParentMoleculeModelProtocol {
|
|||||||
|
|
||||||
public static var identifier: String = "twoButtonView"
|
public static var identifier: String = "twoButtonView"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var primaryButton: ButtonModel?
|
public var primaryButton: ButtonModel?
|
||||||
public var secondaryButton: ButtonModel?
|
public var secondaryButton: ButtonModel?
|
||||||
@ -39,6 +40,7 @@ public class TwoButtonViewModel: ParentMoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case primaryButton
|
case primaryButton
|
||||||
case secondaryButton
|
case secondaryButton
|
||||||
@ -62,6 +64,7 @@ public class TwoButtonViewModel: ParentMoleculeModelProtocol {
|
|||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
//set context value for 'primary' style to be set for the primaryButton in case the
|
//set context value for 'primary' style to be set for the primaryButton in case the
|
||||||
//property is not returned in the JSON and once decoded, this value is removed from the context
|
//property is not returned in the JSON and once decoded, this value is removed from the context
|
||||||
@ -81,6 +84,7 @@ public class TwoButtonViewModel: ParentMoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(primaryButton, forKey: .primaryButton)
|
try container.encodeIfPresent(primaryButton, forKey: .primaryButton)
|
||||||
try container.encodeIfPresent(secondaryButton, forKey: .secondaryButton)
|
try container.encodeIfPresent(secondaryButton, forKey: .secondaryButton)
|
||||||
|
|||||||
@ -105,6 +105,10 @@ import VDS
|
|||||||
// MARK: - VDSMoleculeViewProtocol
|
// MARK: - VDSMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
|
if let accessibilityIdentifier = viewModel.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
buttons.removeAll()
|
buttons.removeAll()
|
||||||
|
|
||||||
if let model = viewModel.leftLink {
|
if let model = viewModel.leftLink {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import Foundation
|
|||||||
public class TwoLinkViewModel: ParentMoleculeModelProtocol {
|
public class TwoLinkViewModel: ParentMoleculeModelProtocol {
|
||||||
public static var identifier: String = "twoLinkView"
|
public static var identifier: String = "twoLinkView"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var rightLink: LinkModel?
|
public var rightLink: LinkModel?
|
||||||
@ -21,6 +22,7 @@ public class TwoLinkViewModel: ParentMoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case rightLink
|
case rightLink
|
||||||
case leftLink
|
case leftLink
|
||||||
@ -34,6 +36,7 @@ public class TwoLinkViewModel: ParentMoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
rightLink = try typeContainer.decodeIfPresent(LinkModel.self, forKey: .rightLink)
|
rightLink = try typeContainer.decodeIfPresent(LinkModel.self, forKey: .rightLink)
|
||||||
leftLink = try typeContainer.decodeIfPresent(LinkModel.self, forKey: .leftLink)
|
leftLink = try typeContainer.decodeIfPresent(LinkModel.self, forKey: .leftLink)
|
||||||
@ -43,6 +46,7 @@ public class TwoLinkViewModel: ParentMoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(rightLink, forKey: .rightLink)
|
try container.encodeIfPresent(rightLink, forKey: .rightLink)
|
||||||
try container.encodeIfPresent(leftLink, forKey: .leftLink)
|
try container.encodeIfPresent(leftLink, forKey: .leftLink)
|
||||||
|
|||||||
@ -12,6 +12,7 @@ public class ActionDetailWithImageModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "actionDetailWithImage"
|
public static var identifier: String = "actionDetailWithImage"
|
||||||
public var moleculeName: String = ActionDetailWithImageModel.identifier
|
public var moleculeName: String = ActionDetailWithImageModel.identifier
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var headlineBodyButton: HeadlineBodyButtonModel
|
public var headlineBodyButton: HeadlineBodyButtonModel
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import MVMCore
|
|||||||
public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
||||||
public static var identifier: String = "cornerLabels"
|
public static var identifier: String = "cornerLabels"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var topLeftLabel: LabelModel?
|
public var topLeftLabel: LabelModel?
|
||||||
public var topRightLabel: LabelModel?
|
public var topRightLabel: LabelModel?
|
||||||
@ -41,6 +42,7 @@ public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case topLeftLabel
|
case topLeftLabel
|
||||||
case topRightLabel
|
case topRightLabel
|
||||||
@ -53,6 +55,7 @@ public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
molecule = try typeContainer.decodeModelIfPresent(codingKey: .molecule)
|
molecule = try typeContainer.decodeModelIfPresent(codingKey: .molecule)
|
||||||
topLeftLabel = try typeContainer.decodeMoleculeIfPresent(codingKey: .topLeftLabel)
|
topLeftLabel = try typeContainer.decodeMoleculeIfPresent(codingKey: .topLeftLabel)
|
||||||
@ -64,6 +67,7 @@ public class CornerLabelsModel: ParentMoleculeModelProtocol {
|
|||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeModelIfPresent(molecule, forKey: .molecule)
|
try container.encodeModelIfPresent(molecule, forKey: .molecule)
|
||||||
try container.encodeModelIfPresent(topLeftLabel, forKey: .topLeftLabel)
|
try container.encodeModelIfPresent(topLeftLabel, forKey: .topLeftLabel)
|
||||||
|
|||||||
@ -11,6 +11,7 @@ public class HeadlineBodyLinkToggleModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "headlineBodyLinkToggle"
|
public static var identifier: String = "headlineBodyLinkToggle"
|
||||||
public var moleculeName: String = HeadlineBodyLinkToggleModel.identifier
|
public var moleculeName: String = HeadlineBodyLinkToggleModel.identifier
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var headlineBodyLink: HeadlineBodyLinkModel
|
public var headlineBodyLink: HeadlineBodyLinkModel
|
||||||
public var toggle: ToggleModel
|
public var toggle: ToggleModel
|
||||||
|
|||||||
@ -13,6 +13,7 @@ open class HeadlineBodyToggleModel: MoleculeModelProtocol, ParentMoleculeModelPr
|
|||||||
public static var identifier: String = "headlineBodyToggle"
|
public static var identifier: String = "headlineBodyToggle"
|
||||||
public var moleculeName: String = HeadlineBodyToggleModel.identifier
|
public var moleculeName: String = HeadlineBodyToggleModel.identifier
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
open var backgroundColor: Color?
|
open var backgroundColor: Color?
|
||||||
open var headlineBody: HeadlineBodyModel
|
open var headlineBody: HeadlineBodyModel
|
||||||
open var toggle: ToggleModel
|
open var toggle: ToggleModel
|
||||||
|
|||||||
@ -13,6 +13,7 @@ public class LabelToggleModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "labelToggle"
|
public static var identifier: String = "labelToggle"
|
||||||
public var moleculeName: String = LabelToggleModel.identifier
|
public var moleculeName: String = LabelToggleModel.identifier
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var label: LabelModel
|
public var label: LabelModel
|
||||||
@ -26,6 +27,7 @@ public class LabelToggleModel: MoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case label
|
case label
|
||||||
case toggle
|
case toggle
|
||||||
@ -34,6 +36,7 @@ public class LabelToggleModel: MoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey:.backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey:.backgroundColor)
|
||||||
label = try typeContainer.decode(LabelModel.self, forKey:.label)
|
label = try typeContainer.decode(LabelModel.self, forKey:.label)
|
||||||
toggle = try typeContainer.decode(ToggleModel.self, forKey:.toggle)
|
toggle = try typeContainer.decode(ToggleModel.self, forKey:.toggle)
|
||||||
@ -43,6 +46,7 @@ public class LabelToggleModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(label, forKey: .label)
|
try container.encode(label, forKey: .label)
|
||||||
try container.encode(toggle, forKey: .toggle)
|
try container.encode(toggle, forKey: .toggle)
|
||||||
|
|||||||
@ -20,6 +20,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
|
|
||||||
open class var identifier: String { "navigationBar" }
|
open class var identifier: String { "navigationBar" }
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
open var title: String?
|
open var title: String?
|
||||||
open var hidden: Bool?
|
open var hidden: Bool?
|
||||||
@ -85,6 +86,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case title
|
case title
|
||||||
case hidden
|
case hidden
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
@ -107,6 +109,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
||||||
hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden)
|
hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
@ -126,6 +129,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encode(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(title, forKey: .title)
|
try container.encodeIfPresent(title, forKey: .title)
|
||||||
try container.encodeIfPresent(hidden, forKey: .hidden)
|
try container.encodeIfPresent(hidden, forKey: .hidden)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
|||||||
@ -13,6 +13,7 @@ public class NotificationXButtonModel: ButtonModelProtocol, MoleculeModelProtoco
|
|||||||
|
|
||||||
public static var identifier: String = "notificationXButton"
|
public static var identifier: String = "notificationXButton"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var action: ActionModelProtocol = ActionNoopModel()
|
public var action: ActionModelProtocol = ActionNoopModel()
|
||||||
@ -20,6 +21,7 @@ public class NotificationXButtonModel: ButtonModelProtocol, MoleculeModelProtoco
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case action
|
case action
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,6 +32,7 @@ public class NotificationXButtonModel: ButtonModelProtocol, MoleculeModelProtoco
|
|||||||
public required init(from decoder: Decoder) throws {
|
public required init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
if let action: ActionModelProtocol = try typeContainer.decodeModelIfPresent(codingKey: .action) {
|
if let action: ActionModelProtocol = try typeContainer.decodeModelIfPresent(codingKey: .action) {
|
||||||
self.action = action
|
self.action = action
|
||||||
}
|
}
|
||||||
@ -39,6 +42,7 @@ public class NotificationXButtonModel: ButtonModelProtocol, MoleculeModelProtoco
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encode(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ public class EyebrowHeadlineBodyLinkModel: ParentMoleculeModelProtocol {
|
|||||||
|
|
||||||
public static var identifier: String = "eyebrowHeadlineBodyLink"
|
public static var identifier: String = "eyebrowHeadlineBodyLink"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var moleculeName: String = EyebrowHeadlineBodyLinkModel.identifier
|
public var moleculeName: String = EyebrowHeadlineBodyLinkModel.identifier
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var eyebrow: LabelModel?
|
public var eyebrow: LabelModel?
|
||||||
@ -70,6 +71,7 @@ public class EyebrowHeadlineBodyLinkModel: ParentMoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case eyebrow
|
case eyebrow
|
||||||
case headline
|
case headline
|
||||||
@ -84,6 +86,7 @@ public class EyebrowHeadlineBodyLinkModel: ParentMoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
||||||
headline = try typeContainer.decodeMoleculeIfPresent(codingKey: .headline)
|
headline = try typeContainer.decodeMoleculeIfPresent(codingKey: .headline)
|
||||||
@ -100,6 +103,7 @@ public class EyebrowHeadlineBodyLinkModel: ParentMoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeIfPresent(eyebrow, forKey: .eyebrow)
|
try container.encodeIfPresent(eyebrow, forKey: .eyebrow)
|
||||||
try container.encodeModelIfPresent(headline, forKey: .headline)
|
try container.encodeModelIfPresent(headline, forKey: .headline)
|
||||||
|
|||||||
@ -15,6 +15,7 @@ public class HeadlineBodyButtonModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "headlineBodyButton"
|
public static var identifier: String = "headlineBodyButton"
|
||||||
public var moleculeName: String = HeadlineBodyButtonModel.identifier
|
public var moleculeName: String = HeadlineBodyButtonModel.identifier
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ public class HeadlineBodyButtonModel: MoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case headlineBody
|
case headlineBody
|
||||||
case button
|
case button
|
||||||
@ -62,6 +64,7 @@ public class HeadlineBodyButtonModel: MoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody)
|
headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody)
|
||||||
button = try typeContainer.decode(ButtonModel.self, forKey: .button)
|
button = try typeContainer.decode(ButtonModel.self, forKey: .button)
|
||||||
@ -73,6 +76,7 @@ public class HeadlineBodyButtonModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(headlineBody, forKey: .headlineBody)
|
try container.encode(headlineBody, forKey: .headlineBody)
|
||||||
try container.encode(button, forKey: .button)
|
try container.encode(button, forKey: .button)
|
||||||
|
|||||||
@ -17,6 +17,7 @@ public class HeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "headlineBodyLink"
|
public static var identifier: String = "headlineBodyLink"
|
||||||
public var moleculeName: String = HeadlineBodyLinkModel.identifier
|
public var moleculeName: String = HeadlineBodyLinkModel.identifier
|
||||||
@DecodableDefault.UUIDString public var id: String
|
@DecodableDefault.UUIDString public var id: String
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
public var link: LinkModel
|
public var link: LinkModel
|
||||||
|
|||||||
@ -15,6 +15,7 @@ open class HeadlineBodyModel: ParentMoleculeModelProtocol {
|
|||||||
public static var identifier: String = "headlineBody"
|
public static var identifier: String = "headlineBody"
|
||||||
public var moleculeName: String = HeadlineBodyModel.identifier
|
public var moleculeName: String = HeadlineBodyModel.identifier
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var headline: LabelModel?
|
public var headline: LabelModel?
|
||||||
public var body: LabelModel?
|
public var body: LabelModel?
|
||||||
public var style: Style?
|
public var style: Style?
|
||||||
@ -69,6 +70,7 @@ open class HeadlineBodyModel: ParentMoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case headline
|
case headline
|
||||||
case body
|
case body
|
||||||
case style
|
case style
|
||||||
@ -78,6 +80,7 @@ open class HeadlineBodyModel: ParentMoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
headline = try typeContainer.decodeMoleculeIfPresent(codingKey: .headline)
|
headline = try typeContainer.decodeMoleculeIfPresent(codingKey: .headline)
|
||||||
body = try typeContainer.decodeMoleculeIfPresent(codingKey: .body)
|
body = try typeContainer.decodeMoleculeIfPresent(codingKey: .body)
|
||||||
style = try typeContainer.decodeIfPresent(Style.self, forKey: .style)
|
style = try typeContainer.decodeIfPresent(Style.self, forKey: .style)
|
||||||
@ -88,6 +91,7 @@ open class HeadlineBodyModel: ParentMoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(headline, forKey: .headline)
|
try container.encodeIfPresent(headline, forKey: .headline)
|
||||||
try container.encodeIfPresent(body, forKey: .body)
|
try container.encodeIfPresent(body, forKey: .body)
|
||||||
try container.encodeIfPresent(style, forKey: .style)
|
try container.encodeIfPresent(style, forKey: .style)
|
||||||
|
|||||||
@ -14,6 +14,7 @@ public class StringAndMoleculeModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
public static var identifier: String = "stringAndMoleculeModel"
|
public static var identifier: String = "stringAndMoleculeModel"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var string: String
|
public var string: String
|
||||||
@ -37,6 +38,7 @@ public class StringAndMoleculeModel: MoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case string
|
case string
|
||||||
case molecule
|
case molecule
|
||||||
@ -50,6 +52,7 @@ public class StringAndMoleculeModel: MoleculeModelProtocol {
|
|||||||
public required init(from decoder: Decoder) throws {
|
public required init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
string = try typeContainer.decode(String.self, forKey: .string)
|
string = try typeContainer.decode(String.self, forKey: .string)
|
||||||
molecule = try typeContainer.decodeModel(codingKey: .molecule)
|
molecule = try typeContainer.decodeModel(codingKey: .molecule)
|
||||||
@ -59,6 +62,7 @@ public class StringAndMoleculeModel: MoleculeModelProtocol {
|
|||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(string, forKey: .string)
|
try container.encode(string, forKey: .string)
|
||||||
try container.encodeModel(molecule, forKey: .molecule)
|
try container.encodeModel(molecule, forKey: .molecule)
|
||||||
|
|||||||
@ -17,6 +17,7 @@ public class ThreeHeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
public static var identifier: String = "threeHeadlineBodyLink"
|
public static var identifier: String = "threeHeadlineBodyLink"
|
||||||
public var moleculeName: String = ThreeHeadlineBodyLinkModel.identifier
|
public var moleculeName: String = ThreeHeadlineBodyLinkModel.identifier
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ public class ThreeHeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case headline1
|
case headline1
|
||||||
case headline2
|
case headline2
|
||||||
@ -60,6 +62,7 @@ public class ThreeHeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
headline1 = try typeContainer.decode(LabelModel.self, forKey: .headline1)
|
headline1 = try typeContainer.decode(LabelModel.self, forKey: .headline1)
|
||||||
headline2 = try typeContainer.decode(LabelModel.self, forKey: .headline2)
|
headline2 = try typeContainer.decode(LabelModel.self, forKey: .headline2)
|
||||||
@ -72,6 +75,7 @@ public class ThreeHeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(headline1, forKey: .headline1)
|
try container.encode(headline1, forKey: .headline1)
|
||||||
try container.encode(headline2, forKey: .headline2)
|
try container.encode(headline2, forKey: .headline2)
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
|
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]
|
public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]
|
||||||
@ -85,6 +86,7 @@ import UIKit
|
|||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
|
case accessibilityIdentifier
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case molecules
|
case molecules
|
||||||
case index
|
case index
|
||||||
@ -115,6 +117,7 @@ import UIKit
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
molecules = try typeContainer.decodeModels(codingKey: .molecules)
|
molecules = try typeContainer.decodeModels(codingKey: .molecules)
|
||||||
index = try typeContainer.decodeIfPresent(Int.self, forKey: .index) ?? 0
|
index = try typeContainer.decodeIfPresent(Int.self, forKey: .index) ?? 0
|
||||||
selectable = try typeContainer.decodeIfPresent(Bool.self, forKey: .selectable) ?? false
|
selectable = try typeContainer.decodeIfPresent(Bool.self, forKey: .selectable) ?? false
|
||||||
@ -153,6 +156,7 @@ import UIKit
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeModels(molecules, forKey: .molecules)
|
try container.encodeModels(molecules, forKey: .molecules)
|
||||||
try container.encodeIfPresent(spacing, forKey: .spacing)
|
try container.encodeIfPresent(spacing, forKey: .spacing)
|
||||||
|
|||||||
@ -30,6 +30,9 @@ public typealias BarButtonAction = (BarButtonItem) -> ()
|
|||||||
|
|
||||||
open func set(with model: MoleculeModelProtocol & NavigationButtonModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open func set(with model: MoleculeModelProtocol & NavigationButtonModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
self.model = model
|
self.model = model
|
||||||
|
if let accessibilityIdentifier = model.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
buttonDelegate = delegateObject?.buttonDelegate
|
buttonDelegate = delegateObject?.buttonDelegate
|
||||||
actionDelegate?.buttonAction = { sender in
|
actionDelegate?.buttonAction = { sender in
|
||||||
Task(priority: .userInitiated) {
|
Task(priority: .userInitiated) {
|
||||||
|
|||||||
@ -79,6 +79,10 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
self.backgroundColor = backgroundColor.uiColor
|
self.backgroundColor = backgroundColor.uiColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let accessibilityIdentifier = (model as? MoleculeModelProtocol)?.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
// align if needed.
|
// align if needed.
|
||||||
if let model = model as? ContainerModelProtocol {
|
if let model = model as? ContainerModelProtocol {
|
||||||
containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol)
|
containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol)
|
||||||
|
|||||||
@ -141,6 +141,10 @@ import UIKit
|
|||||||
self.listItemModel = model
|
self.listItemModel = model
|
||||||
styleLine(with: model.style)
|
styleLine(with: model.style)
|
||||||
|
|
||||||
|
if let accessibilityIdentifier = model.accessibilityIdentifier {
|
||||||
|
self.accessibilityIdentifier = accessibilityIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
// Add the caret if there is an action and it's not declared hidden.
|
// Add the caret if there is an action and it's not declared hidden.
|
||||||
if !customAccessoryView {
|
if !customAccessoryView {
|
||||||
if let _ = model.action, !(model.hideArrow ?? false) {
|
if let _ = model.action, !(model.hideArrow ?? false) {
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import MVMCore
|
||||||
|
|
||||||
open class ContainerModel: ContainerModelProtocol, Codable, ModelComparisonProtocol {
|
open class ContainerModel: ContainerModelProtocol, Codable, ModelComparisonProtocol {
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ open class ContainerModel: ContainerModelProtocol, Codable, ModelComparisonProto
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var accessibilityIdentifier: String?
|
||||||
public var hasStableId = false
|
public var hasStableId = false
|
||||||
|
|
||||||
public var horizontalAlignment: UIStackView.Alignment?
|
public var horizontalAlignment: UIStackView.Alignment?
|
||||||
@ -34,6 +36,7 @@ open class ContainerModel: ContainerModelProtocol, Codable, ModelComparisonProto
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
|
case accessibilityIdentifier
|
||||||
case horizontalAlignment
|
case horizontalAlignment
|
||||||
case useHorizontalMargins
|
case useHorizontalMargins
|
||||||
case leftPadding
|
case leftPadding
|
||||||
@ -78,6 +81,7 @@ open class ContainerModel: ContainerModelProtocol, Codable, ModelComparisonProto
|
|||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||||
|
|
||||||
if let id = try typeContainer.decodeIfPresent(String.self, forKey: .id) {
|
if let id = try typeContainer.decodeIfPresent(String.self, forKey: .id) {
|
||||||
self.id = id
|
self.id = id
|
||||||
@ -103,6 +107,7 @@ open class ContainerModel: ContainerModelProtocol, Codable, ModelComparisonProto
|
|||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(id, forKey: .id)
|
try container.encode(id, forKey: .id)
|
||||||
|
try container.encodeIfPresent(accessibilityIdentifier, forKey: .accessibilityIdentifier)
|
||||||
try container.encodeIfPresent(ContainerHelper.getAlignmentString(for: verticalAlignment), forKey: .verticalAlignment)
|
try container.encodeIfPresent(ContainerHelper.getAlignmentString(for: verticalAlignment), forKey: .verticalAlignment)
|
||||||
try container.encodeIfPresent(ContainerHelper.getAlignmentString(for: horizontalAlignment), forKey: .horizontalAlignment)
|
try container.encodeIfPresent(ContainerHelper.getAlignmentString(for: horizontalAlignment), forKey: .horizontalAlignment)
|
||||||
try container.encodeIfPresent(useHorizontalMargins, forKey: .useHorizontalMargins)
|
try container.encodeIfPresent(useHorizontalMargins, forKey: .useHorizontalMargins)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user