updated model

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-02-12 17:30:40 -06:00
parent 3eaf765655
commit 2e937fd0de

View File

@ -5,7 +5,7 @@
// Created by Suresh, Kamlesh on 10/3/19.
// Copyright © 2019 Suresh, Kamlesh. All rights reserved.
//
import VDS
@objcMembers open class LabelModel: MoleculeModelProtocol {
//--------------------------------------------------
@ -30,6 +30,7 @@
public var numberOfLines: Int?
public var shouldMaskRecordedView: Bool? = false
public var accessibilityTraits: UIAccessibilityTraits?
public var inverted: Bool = false
//--------------------------------------------------
// MARK: - Keys
@ -49,6 +50,7 @@
case attributes
case html
case hero
case inverted
case makeWholeViewClickable
case numberOfLines
case shouldMaskRecordedView
@ -97,6 +99,7 @@
attributes = try typeContainer.decodeModelsIfPresent(codingKey: .attributes)
html = try typeContainer.decodeIfPresent(String.self, forKey: .html)
hero = try typeContainer.decodeIfPresent(Int.self, forKey: .hero)
inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
makeWholeViewClickable = try typeContainer.decodeIfPresent(Bool.self, forKey: .makeWholeViewClickable)
numberOfLines = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfLines)
shouldMaskRecordedView = try typeContainer.decodeIfPresent(Bool.self, forKey: .shouldMaskRecordedView) ?? false
@ -123,9 +126,14 @@
try container.encodeModelsIfPresent(attributes, forKey: .attributes)
try container.encodeIfPresent(html, forKey: .html)
try container.encodeIfPresent(hero, forKey: .hero)
try container.encodeIfPresent(inverted, forKey: .inverted)
try container.encodeIfPresent(makeWholeViewClickable, forKey: .makeWholeViewClickable)
try container.encodeIfPresent(numberOfLines, forKey: .numberOfLines)
try container.encodeIfPresent(shouldMaskRecordedView, forKey: .shouldMaskRecordedView)
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
}
}
extension LabelModel {
public var surface: Surface { inverted ? .dark : .light }
}