From 2e937fd0de790339a9bc1f109fc2b6ccd7162bb3 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 12 Feb 2024 17:30:40 -0600 Subject: [PATCH] updated model Signed-off-by: Matt Bruce --- MVMCoreUI/Atomic/Atoms/Views/Label/LabelModel.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/LabelModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelModel.swift index 19284756..fe37a2c0 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/LabelModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelModel.swift @@ -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 } +}