Updated polls

This commit is contained in:
Ali
2020-01-08 00:53:20 +04:00
parent 54f46ccac3
commit b87c84a17d
54 changed files with 6176 additions and 4293 deletions

View File

@@ -1051,15 +1051,24 @@ extension PresentationThemeChatBubblePolls: Codable {
case highlight
case separator
case bar
case barIconForeground
case barPositive
case barNegative
}
public convenience init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
self.init(radioButton: try decodeColor(values, .radioButton),
radioProgress: try decodeColor(values, .radioProgress),
highlight: try decodeColor(values, .highlight),
separator: try decodeColor(values, .separator),
bar: try decodeColor(values, .bar))
let bar = try decodeColor(values, .bar)
self.init(
radioButton: try decodeColor(values, .radioButton),
radioProgress: try decodeColor(values, .radioProgress),
highlight: try decodeColor(values, .highlight),
separator: try decodeColor(values, .separator),
bar: bar,
barIconForeground: (try? decodeColor(values, .barIconForeground)) ?? .white,
barPositive: (try? decodeColor(values, .barPositive)) ?? bar,
barNegative: (try? decodeColor(values, .barNegative)) ?? bar
)
}
public func encode(to encoder: Encoder) throws {
@@ -1069,6 +1078,9 @@ extension PresentationThemeChatBubblePolls: Codable {
try encodeColor(&values, self.highlight, .highlight)
try encodeColor(&values, self.separator, .separator)
try encodeColor(&values, self.bar, .bar)
try encodeColor(&values, self.barIconForeground, .barIconForeground)
try encodeColor(&values, self.barPositive, .barPositive)
try encodeColor(&values, self.barNegative, .barNegative)
}
}
@@ -1097,11 +1109,13 @@ extension PresentationThemePartedColors: Codable {
case actionButtonsText
case textSelection
case textSelectionKnob
case accentControlDisabled
}
public convenience init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
let codingPath = decoder.codingPath.map { $0.stringValue }.joined(separator: ".")
let accentControlColor = try decodeColor(values, .accentControl)
self.init(
bubble: try values.decode(PresentationThemeBubbleColor.self, forKey: .bubble),
primaryTextColor: try decodeColor(values, .primaryText),
@@ -1111,7 +1125,8 @@ extension PresentationThemePartedColors: Codable {
scamColor: try decodeColor(values, .scam),
textHighlightColor: try decodeColor(values, .textHighlight),
accentTextColor: try decodeColor(values, .accentText),
accentControlColor: try decodeColor(values, .accentControl),
accentControlColor: accentControlColor,
accentControlDisabledColor: (try? decodeColor(values, .accentControlDisabled)) ?? accentControlColor.withAlphaComponent(0.5),
mediaActiveControlColor: try decodeColor(values, .mediaActiveControl),
mediaInactiveControlColor: try decodeColor(values, .mediaInactiveControl),
mediaControlInnerBackgroundColor: try decodeColor(values, .mediaControlInnerBg, decoder: decoder, fallbackKey: codingPath + ".bubble.withWp.bg"),