diff --git a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift index 67edfdc8a3..1e68394109 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift @@ -250,10 +250,18 @@ public func customizeDefaultDayTheme(theme: PresentationTheme, editing: Bool, ti incoming: chat.message.incoming.withUpdated( bubble: chat.message.incoming.bubble.withUpdated( withWallpaper: chat.message.incoming.bubble.withWallpaper.withUpdated( - stroke: incomingBubbleStrokeColor + stroke: incomingBubbleStrokeColor, + reactionInactiveBackground: accentColor?.withMultipliedAlpha(0.1), + reactionInactiveForeground: accentColor, + reactionActiveBackground: accentColor, + reactionActiveForeground: .clear ), withoutWallpaper: chat.message.incoming.bubble.withoutWallpaper.withUpdated( - stroke: incomingBubbleStrokeColor + stroke: incomingBubbleStrokeColor, + reactionInactiveBackground: accentColor?.withMultipliedAlpha(0.1), + reactionInactiveForeground: accentColor, + reactionActiveBackground: accentColor, + reactionActiveForeground: .clear ) ), linkHighlightColor: accentColor?.withAlphaComponent(0.3), @@ -278,12 +286,20 @@ public func customizeDefaultDayTheme(theme: PresentationTheme, editing: Bool, ti withWallpaper: chat.message.outgoing.bubble.withWallpaper.withUpdated( fill: outgoingBubbleFillColors, highlightedFill: outgoingBubbleHighlightedFill, - stroke: outgoingBubbleStrokeColor + stroke: outgoingBubbleStrokeColor, + reactionInactiveBackground: outgoingControlColor?.withMultipliedAlpha(0.1), + reactionInactiveForeground: outgoingControlColor, + reactionActiveBackground: outgoingControlColor, + reactionActiveForeground: .clear ), withoutWallpaper: chat.message.outgoing.bubble.withoutWallpaper.withUpdated( fill: outgoingBubbleFillColors, highlightedFill: outgoingBubbleHighlightedFill, - stroke: outgoingBubbleStrokeColor + stroke: outgoingBubbleStrokeColor, + reactionInactiveBackground: outgoingControlColor?.withMultipliedAlpha(0.1), + reactionInactiveForeground: outgoingControlColor, + reactionActiveBackground: outgoingControlColor, + reactionActiveForeground: .clear ) ), primaryTextColor: outgoingPrimaryTextColor, diff --git a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift index 3105038c81..fd5d7f30bc 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift @@ -1101,6 +1101,7 @@ extension PresentationThemeBubbleColorComponents: Codable { case reactionInactiveFg case reactionActiveBg case reactionActiveFg + case __workaroundNonexistingKey } public convenience init(from decoder: Decoder) throws { @@ -1121,16 +1122,51 @@ extension PresentationThemeBubbleColorComponents: Codable { fill = [fillColor, gradientColor] } - + + let fallbackKeyPrefix: String + if codingPath.hasPrefix("chat.message.incoming.") { + fallbackKeyPrefix = "chat.message.incoming." + } else { + fallbackKeyPrefix = "chat.message.outgoing." + } + + let reactionInactiveBackground: UIColor + if let color = try? decodeColor(values, .reactionInactiveBg) { + reactionInactiveBackground = color + } else { + reactionInactiveBackground = (try decodeColor(values, .__workaroundNonexistingKey, fallbackKey: "\(fallbackKeyPrefix).accentControl")).withMultipliedAlpha(0.1) + } + + let reactionInactiveForeground: UIColor + if let color = try? decodeColor(values, .reactionInactiveFg) { + reactionInactiveForeground = color + } else { + reactionInactiveForeground = try decodeColor(values, .__workaroundNonexistingKey, fallbackKey: "\(fallbackKeyPrefix).accentControl") + } + + let reactionActiveBackground: UIColor + if let color = try? decodeColor(values, .reactionActiveBg) { + reactionActiveBackground = color + } else { + reactionActiveBackground = try decodeColor(values, .__workaroundNonexistingKey, fallbackKey: "\(fallbackKeyPrefix).accentControl") + } + + let reactionActiveForeground: UIColor + if let color = try? decodeColor(values, .reactionActiveFg) { + reactionActiveForeground = color + } else { + reactionActiveForeground = .clear + } + self.init( fill: fill, highlightedFill: try decodeColor(values, .highlightedBg), stroke: try decodeColor(values, .stroke), shadow: try? values.decode(PresentationThemeBubbleShadow.self, forKey: .shadow), - reactionInactiveBackground: try decodeColor(values, .reactionInactiveBg), - reactionInactiveForeground: try decodeColor(values, .reactionInactiveFg), - reactionActiveBackground: try decodeColor(values, .reactionActiveBg), - reactionActiveForeground: try decodeColor(values, .reactionActiveFg) + reactionInactiveBackground: reactionInactiveBackground, + reactionInactiveForeground: reactionInactiveForeground, + reactionActiveBackground: reactionActiveBackground, + reactionActiveForeground: reactionActiveForeground ) }