fixed the vds color breaking changes for monarch
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
f3e2263048
commit
037a52d379
@ -58,7 +58,7 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
|
||||
textPercentage = try container.decodeIfPresent(CGFloat.self, forKey: .textPercentage)
|
||||
|
||||
if let color = eyebrow?.textColor?.uiColor {
|
||||
self.eyebrowColor = .custom(color, color)
|
||||
self.eyebrowColor = .custom(color)
|
||||
|
||||
} else if let eyebrowColor = try? container.decodeIfPresent(TitleLockup.TextColor.self, forKey: .eyebrowColor) {
|
||||
self.eyebrowColor = eyebrowColor
|
||||
@ -68,7 +68,7 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
|
||||
}
|
||||
|
||||
if let color = title?.textColor?.uiColor {
|
||||
self.titleColor = .custom(color, color)
|
||||
self.titleColor = .custom(color)
|
||||
|
||||
} else if let titleColor = try? container.decodeIfPresent(TitleLockup.TitleTextColor.self, forKey: .titleColor) {
|
||||
self.titleColor = titleColor
|
||||
@ -78,7 +78,7 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
|
||||
}
|
||||
|
||||
if let color = subTitle?.textColor?.uiColor {
|
||||
self.subTitleColor = .custom(color, color)
|
||||
self.subTitleColor = .custom(color)
|
||||
|
||||
} else if let subTitleColor = try? container.decodeIfPresent(TitleLockup.TextColor.self, forKey: .subTitleColor) {
|
||||
self.subTitleColor = subTitleColor
|
||||
|
||||
@ -197,8 +197,7 @@ extension VDS.TitleLockup.TextColor: Codable {
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case type
|
||||
case lightColor
|
||||
case darkColor
|
||||
case color
|
||||
}
|
||||
|
||||
enum CustomColorType: String, Codable {
|
||||
@ -217,9 +216,8 @@ extension VDS.TitleLockup.TextColor: Codable {
|
||||
case .secondary:
|
||||
self = .secondary
|
||||
case .custom:
|
||||
let lightColor = try container.decode(Color.self, forKey: .lightColor)
|
||||
let darkColor = try container.decode(Color.self, forKey: .darkColor)
|
||||
self = .custom(lightColor.uiColor, darkColor.uiColor)
|
||||
let color = try container.decode(Color.self, forKey: .color)
|
||||
self = .custom(color.uiColor)
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,11 +228,10 @@ extension VDS.TitleLockup.TextColor: Codable {
|
||||
try container.encode(CustomColorType.primary.rawValue, forKey: .type)
|
||||
case .secondary:
|
||||
try container.encode(CustomColorType.secondary.rawValue, forKey: .type)
|
||||
case .custom(let lightColor, let darkColor):
|
||||
case .custom(let color):
|
||||
try container.encode(CustomColorType.custom.rawValue, forKey: .type)
|
||||
try container.encode(Color(uiColor: lightColor), forKey: .lightColor)
|
||||
try container.encode(Color(uiColor: darkColor), forKey: .darkColor)
|
||||
@unknown default:
|
||||
try container.encode(Color(uiColor: color), forKey: .color)
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -244,8 +241,7 @@ extension VDS.TitleLockup.TitleTextColor: Codable {
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case type
|
||||
case lightColor
|
||||
case darkColor
|
||||
case color
|
||||
}
|
||||
|
||||
enum CustomColorType: String, Codable {
|
||||
@ -261,9 +257,8 @@ extension VDS.TitleLockup.TitleTextColor: Codable {
|
||||
case .primary:
|
||||
self = .primary
|
||||
case .custom:
|
||||
let lightColor = try container.decode(Color.self, forKey: .lightColor)
|
||||
let darkColor = try container.decode(Color.self, forKey: .darkColor)
|
||||
self = .custom(lightColor.uiColor, darkColor.uiColor)
|
||||
let color = try container.decode(Color.self, forKey: .color)
|
||||
self = .custom(color.uiColor)
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,11 +267,10 @@ extension VDS.TitleLockup.TitleTextColor: Codable {
|
||||
switch self {
|
||||
case .primary:
|
||||
try container.encode(CustomColorType.primary.rawValue, forKey: .type)
|
||||
case .custom(let lightColor, let darkColor):
|
||||
case .custom(let color):
|
||||
try container.encode(CustomColorType.custom.rawValue, forKey: .type)
|
||||
try container.encode(Color(uiColor: lightColor), forKey: .lightColor)
|
||||
try container.encode(Color(uiColor: darkColor), forKey: .darkColor)
|
||||
@unknown default:
|
||||
try container.encode(Color(uiColor: color), forKey: .color)
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ extension Tilelet.DescriptiveIcon: Codable {
|
||||
let accessibleText = try container.decodeIfPresent(String.self, forKey: .accessibleText)
|
||||
if let uiColor = color?.uiColor {
|
||||
self.init(name: name,
|
||||
colorConfiguration: .init(uiColor, uiColor),
|
||||
iconColor: .custom(uiColor),
|
||||
size: size,
|
||||
accessibleText: accessibleText)
|
||||
} else {
|
||||
@ -61,7 +61,9 @@ extension Tilelet.DescriptiveIcon: Codable {
|
||||
try container.encode(name, forKey: .name)
|
||||
try container.encode(size, forKey: .size)
|
||||
try container.encodeIfPresent(accessibleText, forKey: .accessibleText)
|
||||
try container.encodeIfPresent(colorConfiguration.lightColor.hexString, forKey: .color)
|
||||
if let color = iconColor?.uiColor {
|
||||
try container.encode(Color(uiColor: color), forKey: .color)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +83,7 @@ extension Tilelet.DirectionalIcon: Codable {
|
||||
let accessibleText = try container.decodeIfPresent(String.self, forKey: .accessibleText)
|
||||
if let uiColor = color?.uiColor {
|
||||
self.init(iconType: iconType,
|
||||
colorConfiguration: .init(uiColor, uiColor),
|
||||
iconColor: .custom(uiColor),
|
||||
size: size,
|
||||
accessibleText: accessibleText)
|
||||
} else {
|
||||
@ -96,6 +98,8 @@ extension Tilelet.DirectionalIcon: Codable {
|
||||
try container.encode(iconType, forKey: .name)
|
||||
try container.encode(size, forKey: .size)
|
||||
try container.encodeIfPresent(accessibleText, forKey: .accessibleText)
|
||||
try container.encodeIfPresent(colorConfiguration.lightColor.hexString, forKey: .color)
|
||||
if let color = iconColor?.uiColor {
|
||||
try container.encode(Color(uiColor: color), forKey: .color)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
|
||||
subTitle = try typeContainer.decodeMoleculeIfPresent(codingKey: .subTitle)
|
||||
|
||||
if let color = eyebrow?.textColor?.uiColor {
|
||||
self.eyebrowColor = .custom(color, color)
|
||||
self.eyebrowColor = .custom(color)
|
||||
|
||||
} else if let eyebrowColor = try? typeContainer.decodeIfPresent(TitleLockup.TextColor.self, forKey: .eyebrowColor) {
|
||||
self.eyebrowColor = eyebrowColor
|
||||
@ -109,7 +109,7 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
|
||||
}
|
||||
|
||||
if let color = title.textColor?.uiColor {
|
||||
self.titleColor = .custom(color, color)
|
||||
self.titleColor = .custom(color)
|
||||
|
||||
} else if let titleColor = try? typeContainer.decodeIfPresent(TitleLockup.TitleTextColor.self, forKey: .titleColor) {
|
||||
self.titleColor = titleColor
|
||||
@ -119,7 +119,7 @@ public class TitleLockupModel: ParentMoleculeModelProtocol {
|
||||
}
|
||||
|
||||
if let color = subTitle?.textColor?.uiColor {
|
||||
self.subTitleColor = .custom(color, color)
|
||||
self.subTitleColor = .custom(color)
|
||||
|
||||
} else if let subTitleColor = try? typeContainer.decodeIfPresent(TitleLockup.TextColor.self, forKey: .subTitleColor) {
|
||||
self.subTitleColor = subTitleColor
|
||||
|
||||
Loading…
Reference in New Issue
Block a user