Fix send button icon in white dark theme

This commit is contained in:
Ilya Laktyushin 2021-09-21 18:48:35 +03:00
parent 9e9dbd49dc
commit 9f9ce2b850
3 changed files with 20 additions and 4 deletions

View File

@ -117,3 +117,17 @@ public extension NavigationControllerTheme {
self.init(statusBar: navigationStatusBar, navigationBar: NavigationBarTheme(rootControllerTheme: presentationTheme), emptyAreaColor: presentationTheme.chatList.backgroundColor)
}
}
public extension PresentationThemeBubbleColorComponents {
var hasSingleFillColor: Bool {
if self.fill.count == 1 {
return true
}
for i in 0 ..< self.fill.count - 1 {
if self.fill[i].argb != self.fill[i + 1].argb {
return false
}
}
return true
}
}

View File

@ -433,7 +433,7 @@ public struct PresentationResourcesChat {
return generateImage(CGSize(width: 33.0, height: 33.0), rotatedContext: { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
let color: UIColor
if [.day, .night].contains(theme.referenceTheme.baseTheme) && theme.chat.message.outgoing.bubble.withWallpaper.fill.count > 1 {
if [.day, .night].contains(theme.referenceTheme.baseTheme) && !theme.chat.message.outgoing.bubble.withWallpaper.hasSingleFillColor {
color = .white
} else {
color = theme.chat.inputPanel.actionControlForegroundColor
@ -470,7 +470,7 @@ public struct PresentationResourcesChat {
return generateImage(CGSize(width: 33.0, height: 33.0), rotatedContext: { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
let color: UIColor
if [.day, .night].contains(theme.referenceTheme.baseTheme) && theme.chat.message.outgoing.bubble.withWallpaper.fill.count > 1 {
if [.day, .night].contains(theme.referenceTheme.baseTheme) && !theme.chat.message.outgoing.bubble.withWallpaper.hasSingleFillColor {
color = .white
} else {
color = theme.chat.inputPanel.actionControlForegroundColor
@ -515,7 +515,7 @@ public struct PresentationResourcesChat {
context.translateBy(x: -imageRect.midX, y: -imageRect.midY)
let color: UIColor
if [.day, .night].contains(theme.referenceTheme.baseTheme) && theme.chat.message.outgoing.bubble.withWallpaper.fill.count > 1 {
if [.day, .night].contains(theme.referenceTheme.baseTheme) && !theme.chat.message.outgoing.bubble.withWallpaper.hasSingleFillColor {
color = .white
} else {
color = theme.chat.inputPanel.actionControlForegroundColor

View File

@ -42,6 +42,8 @@ final class ChatTextInputActionButtonsNode: ASDisplayNode {
self.micButton = ChatTextInputMediaRecordingButton(theme: theme, strings: strings, presentController: presentController)
self.sendContainerNode = ASDisplayNode()
self.sendContainerNode.layer.allowsGroupOpacity = true
self.backgroundNode = ASDisplayNode()
self.backgroundNode.backgroundColor = theme.chat.inputPanel.actionControlFillColor
self.backgroundNode.clipsToBounds = true
@ -112,7 +114,7 @@ final class ChatTextInputActionButtonsNode: ASDisplayNode {
self.backgroundNode.backgroundColor = theme.chat.inputPanel.actionControlFillColor
if [.day, .night].contains(theme.referenceTheme.baseTheme) && theme.chat.message.outgoing.bubble.withWallpaper.fill.count > 1 {
if [.day, .night].contains(theme.referenceTheme.baseTheme) && !theme.chat.message.outgoing.bubble.withWallpaper.hasSingleFillColor {
self.backdropNode.isHidden = false
} else {
self.backdropNode.isHidden = true