diff --git a/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift b/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift index a44b15315d..c3da0743ba 100644 --- a/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift +++ b/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift @@ -163,8 +163,8 @@ private final class BubbleSettingsControllerNode: ASDisplayNode, UIScrollViewDel let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() - peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) - peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) + peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) + peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) let replyMessageId = MessageId(peerId: peerId, namespace: 0, id: 3) messages[replyMessageId] = Message(stableId: 3, stableVersion: 0, id: replyMessageId, globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 66000, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_1_Text, attributes: [], media: [], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [], associatedMedia: [:], associatedThreadInfo: nil, associatedStories: [:]) diff --git a/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift index fcab55d4d7..80db8ad146 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift @@ -145,7 +145,7 @@ class ForwardPrivacyChatPreviewItemNode: ListViewItemNode { var peers = SimpleDictionary() let messages = SimpleDictionary() - peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: item.peerName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) + peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: item.peerName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) let forwardInfo = MessageForwardInfo(author: item.linkEnabled ? peers[peerId] : nil, source: nil, sourceMessageId: nil, date: 0, authorSignature: item.linkEnabled ? nil : item.peerName, psaType: nil, flags: []) diff --git a/submodules/SettingsUI/Sources/Reactions/ReactionChatPreviewItem.swift b/submodules/SettingsUI/Sources/Reactions/ReactionChatPreviewItem.swift index cf77e6f925..505feacc47 100644 --- a/submodules/SettingsUI/Sources/Reactions/ReactionChatPreviewItem.swift +++ b/submodules/SettingsUI/Sources/Reactions/ReactionChatPreviewItem.swift @@ -274,7 +274,7 @@ class ReactionChatPreviewItemNode: ListViewItemNode { var peers = SimpleDictionary() let messages = SimpleDictionary() - peers[userPeerId] = TelegramUser(id: userPeerId, accessHash: nil, firstName: item.strings.Settings_QuickReactionSetup_DemoMessageAuthor, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) + peers[userPeerId] = TelegramUser(id: userPeerId, accessHash: nil, firstName: item.strings.Settings_QuickReactionSetup_DemoMessageAuthor, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) let messageText = item.strings.Settings_QuickReactionSetup_DemoMessageText diff --git a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift index b0b1fd5e68..9cb991d7b9 100644 --- a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift +++ b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift @@ -427,8 +427,8 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() - peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) - peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) + peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) + peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) let replyMessageId = MessageId(peerId: peerId, namespace: 0, id: 3) messages[replyMessageId] = Message(stableId: 3, stableVersion: 0, id: replyMessageId, globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 66000, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[otherPeerId], text: self.presentationData.strings.Appearance_ThemePreview_Chat_1_Text, attributes: [], media: [], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [], associatedMedia: [:], associatedThreadInfo: nil, associatedStories: [:]) diff --git a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift index 8ab919d482..4490fc76cb 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift @@ -1030,8 +1030,8 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() - peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) - peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) + peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) + peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) var sampleMessages: [Message] = [] diff --git a/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift b/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift index 051db65dee..d89f7d51a7 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift @@ -581,8 +581,8 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate { let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() - peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) - peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) + peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) + peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_Chat_2_ReplyName, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) var sampleMessages: [Message] = [] diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift index a30c0254e2..a20fecdc7e 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift @@ -155,7 +155,7 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode { let replyMessageId = MessageId(peerId: peerId, namespace: 0, id: 3) if let (author, text) = messageItem.reply { - peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: author, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) + peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: author, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) messages[replyMessageId] = Message(stableId: 3, stableVersion: 0, id: replyMessageId, globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 66000, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[peerId], text: text, attributes: [], media: [], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [], associatedMedia: [:], associatedThreadInfo: nil, associatedStories: [:]) } diff --git a/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift b/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift index df34b3f35b..6b721d5afb 100644 --- a/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift +++ b/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift @@ -1485,8 +1485,8 @@ final class WallpaperGalleryItemNode: GalleryItemNode { let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() let messages = SimpleDictionary() - peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_PreviewReplyAuthor, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) - peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_PreviewReplyAuthor, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil) + peers[peerId] = TelegramUser(id: peerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_PreviewReplyAuthor, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) + peers[otherPeerId] = TelegramUser(id: otherPeerId, accessHash: nil, firstName: self.presentationData.strings.Appearance_PreviewReplyAuthor, lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: .blue, backgroundEmojiId: nil) var topMessageText = "" var bottomMessageText = "" diff --git a/submodules/TelegramPresentationData/Sources/Resources/PresentationResourceKey.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourceKey.swift index a8749e2f94..2a7e573952 100644 --- a/submodules/TelegramPresentationData/Sources/Resources/PresentationResourceKey.swift +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourceKey.swift @@ -298,9 +298,12 @@ public enum PresentationResourceKey: Int32 { case storyViewListLikeIcon case navigationPostStoryIcon - case chatReplyBackgroundTemplateImage + case chatReplyBackgroundTemplateIncomingImage + case chatReplyBackgroundTemplateOutgoingDashedImage case chatReplyServiceBackgroundTemplateImage - case chatReplyLineDashTemplateImage + + case chatReplyLineDashTemplateIncomingImage + case chatReplyLineDashTemplateOutgoingImage } public enum ChatExpiredStoryIndicatorType: Hashable { diff --git a/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift index f262102ddb..7486b84c3e 100644 --- a/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift @@ -1285,8 +1285,9 @@ public struct PresentationResourcesChat { }) } - public static func chatReplyBackgroundTemplateImage(_ theme: PresentationTheme) -> UIImage? { - return theme.image(PresentationResourceKey.chatReplyBackgroundTemplateImage.rawValue, { theme in + public static func chatReplyBackgroundTemplateImage(_ theme: PresentationTheme, dashedOutgoing: Bool) -> UIImage? { + let key: PresentationResourceKey = dashedOutgoing ? .chatReplyBackgroundTemplateOutgoingDashedImage : .chatReplyBackgroundTemplateIncomingImage + return theme.image(key.rawValue, { theme in let radius: CGFloat = 4.0 let lineWidth: CGFloat = 3.0 @@ -1299,7 +1300,7 @@ public struct PresentationResourcesChat { context.setFillColor(UIColor.white.withMultipliedAlpha(0.1).cgColor) context.fill(CGRect(origin: CGPoint(), size: size)) - context.setFillColor(UIColor.white.cgColor) + context.setFillColor(UIColor.white.withAlphaComponent(dashedOutgoing ? 0.2 : 1.0).cgColor) context.fill(CGRect(origin: CGPoint(), size: CGSize(width: lineWidth, height: size.height))) })?.stretchableImage(withLeftCapWidth: Int(radius) + 2, topCapHeight: Int(radius) + 3).withRenderingMode(.alwaysTemplate) }) @@ -1318,12 +1319,13 @@ public struct PresentationResourcesChat { }) } - public static func chatReplyLineDashTemplateImage(_ theme: PresentationTheme) -> UIImage? { - return theme.image(PresentationResourceKey.chatReplyLineDashTemplateImage.rawValue, { theme in + public static func chatReplyLineDashTemplateImage(_ theme: PresentationTheme, incoming: Bool) -> UIImage? { + let key: PresentationResourceKey = incoming ? .chatReplyLineDashTemplateIncomingImage : .chatReplyLineDashTemplateOutgoingImage + return theme.image(key.rawValue, { theme in let radius: CGFloat = 3.0 - let offset: CGFloat = 5.0 + let offset: CGFloat = incoming ? 5.0 : -3.0 - return generateImage(CGSize(width: 8.0, height: radius * 6.0), rotatedContext: { size, context in + return generateImage(CGSize(width: 12.0, height: radius * 6.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) context.move(to: CGPoint(x: radius, y: offset)) @@ -1334,6 +1336,17 @@ public struct PresentationResourcesChat { context.setFillColor(UIColor.white.cgColor) context.fillPath() + + if !incoming { + context.move(to: CGPoint(x: radius, y: size.height + offset)) + context.addLine(to: CGPoint(x: radius, y: size.height + offset + radius * 3.0)) + context.addLine(to: CGPoint(x: 0.0, y: size.height + offset + radius * 4.0)) + context.addLine(to: CGPoint(x: 0.0, y: size.height + offset + radius)) + context.closePath() + + context.setFillColor(UIColor.white.cgColor) + context.fillPath() + } })?.resizableImage(withCapInsets: .zero, resizingMode: .tile).withRenderingMode(.alwaysTemplate) }) } diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageAttachedContentNode/Sources/ChatMessageAttachedContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageAttachedContentNode/Sources/ChatMessageAttachedContentNode.swift index fd0b70494c..940ae43936 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageAttachedContentNode/Sources/ChatMessageAttachedContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageAttachedContentNode/Sources/ChatMessageAttachedContentNode.swift @@ -767,7 +767,7 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode { animation.animator.updateFrame(layer: backgroundView.layer, frame: backgroundFrame, completion: nil) } else { backgroundView = UIImageView() - backgroundView.image = PresentationResourcesChat.chatReplyBackgroundTemplateImage(presentationData.theme.theme) + backgroundView.image = PresentationResourcesChat.chatReplyBackgroundTemplateImage(presentationData.theme.theme, dashedOutgoing: !incoming && secondaryColor != nil) self.backgroundView = backgroundView backgroundView.frame = backgroundFrame self.view.insertSubview(backgroundView, at: 0) @@ -780,14 +780,14 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode { if let current = self.lineDashView { lineDashView = current } else { - lineDashView = UIImageView(image: PresentationResourcesChat.chatReplyLineDashTemplateImage(presentationData.theme.theme)) + lineDashView = UIImageView(image: PresentationResourcesChat.chatReplyLineDashTemplateImage(presentationData.theme.theme, incoming: incoming)) lineDashView.clipsToBounds = true self.lineDashView = lineDashView self.view.insertSubview(lineDashView, aboveSubview: backgroundView) } lineDashView.tintColor = secondaryColor - lineDashView.frame = CGRect(origin: backgroundFrame.origin, size: CGSize(width: 8.0, height: backgroundFrame.height)) - lineDashView.layer.cornerRadius = 4.0 + lineDashView.frame = CGRect(origin: backgroundFrame.origin, size: CGSize(width: 12.0, height: backgroundFrame.height)) + lineDashView.layer.cornerRadius = 6.0 } else { if let lineDashView = self.lineDashView { self.lineDashView = nil diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageForwardInfoNode/Sources/ChatMessageForwardInfoNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageForwardInfoNode/Sources/ChatMessageForwardInfoNode.swift index 78cae803d2..308ca2f60f 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageForwardInfoNode/Sources/ChatMessageForwardInfoNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageForwardInfoNode/Sources/ChatMessageForwardInfoNode.swift @@ -162,7 +162,15 @@ public class ChatMessageForwardInfoNode: ASDisplayNode { completeSourceString = strings.Message_GenericForwardedPsa(peerString) } } else { - titleColor = incoming ? presentationData.theme.theme.chat.message.incoming.accentTextColor : presentationData.theme.theme.chat.message.outgoing.accentTextColor + if incoming { + if let color = peer?.nameColor?.color { + titleColor = color + } else { + titleColor = presentationData.theme.theme.chat.message.incoming.accentTextColor + } + } else { + titleColor = presentationData.theme.theme.chat.message.outgoing.accentTextColor + } if let storyData = storyData { switch storyData.storyType { diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode/Sources/ChatMessageReplyInfoNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode/Sources/ChatMessageReplyInfoNode.swift index 38a6c7ea0c..2f0440275a 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode/Sources/ChatMessageReplyInfoNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode/Sources/ChatMessageReplyInfoNode.swift @@ -346,17 +346,70 @@ public class ChatMessageReplyInfoNode: ASDisplayNode { let placeholderColor: UIColor = arguments.parentMessage.effectivelyIncoming(arguments.context.account.peerId) ? arguments.presentationData.theme.theme.chat.message.incoming.mediaPlaceholderColor : arguments.presentationData.theme.theme.chat.message.outgoing.mediaPlaceholderColor let textColor: UIColor + let dustColor: UIColor + + var authorNameColor: UIColor? + var dashSecondaryColor: UIColor? + + let author = arguments.message?.effectiveAuthor + +// if ([Namespaces.Peer.CloudGroup, Namespaces.Peer.CloudChannel].contains(arguments.parentMessage.id.peerId.namespace) && author?.id.namespace == Namespaces.Peer.CloudUser) { + authorNameColor = author?.nameColor?.color + dashSecondaryColor = author?.nameColor?.dashColors.1 +// if let rawAuthorNameColor = authorNameColor { +// var dimColors = false +// switch arguments.presentationData.theme.theme.name { +// case .builtin(.nightAccent), .builtin(.night): +// dimColors = true +// default: +// break +// } +// if dimColors { +// var hue: CGFloat = 0.0 +// var saturation: CGFloat = 0.0 +// var brightness: CGFloat = 0.0 +// rawAuthorNameColor.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: nil) +// authorNameColor = UIColor(hue: hue, saturation: saturation * 0.7, brightness: min(1.0, brightness * 1.2), alpha: 1.0) +// } +// } +// } + + let mainColor: UIColor + var secondaryColor: UIColor? + + var isIncoming = false switch arguments.type { - case let .bubble(incoming): - if isExpiredStory || isStory { - textColor = incoming ? arguments.presentationData.theme.theme.chat.message.incoming.accentTextColor : arguments.presentationData.theme.theme.chat.message.outgoing.accentTextColor - } else if isMedia { - textColor = incoming ? arguments.presentationData.theme.theme.chat.message.incoming.secondaryTextColor : arguments.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor - } else { - textColor = incoming ? arguments.presentationData.theme.theme.chat.message.incoming.primaryTextColor : arguments.presentationData.theme.theme.chat.message.outgoing.primaryTextColor - } - case .standalone: - textColor = titleColor + case let .bubble(incoming): + titleColor = incoming ? (authorNameColor ?? arguments.presentationData.theme.theme.chat.message.incoming.accentTextColor) : arguments.presentationData.theme.theme.chat.message.outgoing.accentTextColor + if incoming { + isIncoming = true + if let authorNameColor { + mainColor = authorNameColor + secondaryColor = dashSecondaryColor + } else { + mainColor = arguments.presentationData.theme.theme.chat.message.incoming.accentTextColor + } + } else { + mainColor = arguments.presentationData.theme.theme.chat.message.outgoing.accentTextColor + if let _ = dashSecondaryColor { + secondaryColor = arguments.presentationData.theme.theme.chat.message.outgoing.accentTextColor + } + } + if isExpiredStory || isStory { + textColor = incoming ? arguments.presentationData.theme.theme.chat.message.incoming.accentTextColor : arguments.presentationData.theme.theme.chat.message.outgoing.accentTextColor + } else if isMedia { + textColor = incoming ? arguments.presentationData.theme.theme.chat.message.incoming.secondaryTextColor : arguments.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor + } else { + textColor = incoming ? arguments.presentationData.theme.theme.chat.message.incoming.primaryTextColor : arguments.presentationData.theme.theme.chat.message.outgoing.primaryTextColor + } + dustColor = incoming ? arguments.presentationData.theme.theme.chat.message.incoming.secondaryTextColor : arguments.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor + case .standalone: + let serviceColor = serviceMessageColorComponents(theme: arguments.presentationData.theme.theme, wallpaper: arguments.presentationData.theme.wallpaper) + titleColor = serviceColor.primaryText + + mainColor = serviceMessageColorComponents(chatTheme: arguments.presentationData.theme.theme.chat, wallpaper: arguments.presentationData.theme.wallpaper).primaryText + textColor = titleColor + dustColor = titleColor } let messageText: NSAttributedString @@ -699,7 +752,7 @@ public class ChatMessageReplyInfoNode: ASDisplayNode { if case .standalone = arguments.type { node.backgroundView.image = PresentationResourcesChat.chatReplyServiceBackgroundTemplateImage(arguments.presentationData.theme.theme) } else { - node.backgroundView.image = PresentationResourcesChat.chatReplyBackgroundTemplateImage(arguments.presentationData.theme.theme) + node.backgroundView.image = PresentationResourcesChat.chatReplyBackgroundTemplateImage(arguments.presentationData.theme.theme, dashedOutgoing: !isIncoming && secondaryColor != nil) } if node.backgroundView.superview == nil { node.contentNode.view.insertSubview(node.backgroundView, at: 0) @@ -719,14 +772,17 @@ public class ChatMessageReplyInfoNode: ASDisplayNode { if let current = node.lineDashView { lineDashView = current } else { - lineDashView = UIImageView(image: PresentationResourcesChat.chatReplyLineDashTemplateImage(arguments.presentationData.theme.theme)) + lineDashView = UIImageView(image: PresentationResourcesChat.chatReplyLineDashTemplateImage(arguments.presentationData.theme.theme, incoming: isIncoming)) lineDashView.clipsToBounds = true node.lineDashView = lineDashView node.contentNode.view.addSubview(lineDashView) } lineDashView.tintColor = secondaryColor - lineDashView.frame = CGRect(origin: .zero, size: CGSize(width: 8.0, height: backgroundFrame.height)) - lineDashView.layer.cornerRadius = 4.0 + lineDashView.frame = CGRect(origin: .zero, size: CGSize(width: 12.0, height: backgroundFrame.height)) + lineDashView.layer.cornerRadius = 6.0 + if #available(iOS 13.0, *) { + lineDashView.layer.cornerCurve = .continuous + } } else { if let lineDashView = node.lineDashView { node.lineDashView = nil diff --git a/submodules/TelegramUI/Components/ChatTextInputMediaRecordingButton/Sources/LockView.swift b/submodules/TelegramUI/Components/ChatTextInputMediaRecordingButton/Sources/LockView.swift index 6f0e822ad5..637cd20049 100644 --- a/submodules/TelegramUI/Components/ChatTextInputMediaRecordingButton/Sources/LockView.swift +++ b/submodules/TelegramUI/Components/ChatTextInputMediaRecordingButton/Sources/LockView.swift @@ -73,7 +73,7 @@ final class LockView: UIButton, TGModernConversationInputMicButtonLock { [ "Path.Path.Обводка 1": theme.chat.inputPanel.panelControlAccentColor, - "Path.Path.Заливка 1": theme.chat.inputPanel.panelBackgroundColor, + "Path.Path.Заливка 1": theme.chat.inputPanel.panelBackgroundColor.withAlphaComponent(1.0), "Rectangle.Rectangle.Обводка 1": theme.chat.inputPanel.panelControlAccentColor, "Rectangle.Заливка 1": theme.chat.inputPanel.panelControlAccentColor, "Path 4.Path 4.Обводка 1": theme.chat.inputPanel.panelControlAccentColor diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift index f9b3de8285..855234842d 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift @@ -3411,14 +3411,14 @@ public final class EmojiPagerContentComponent: Component { image.draw(in: CGRect(origin: CGPoint(x: floor((size.width - imageSize.width) / 2.0), y: floor((size.height - imageSize.height) / 2.0)), size: imageSize)) } case .stop: - if let image = generateTintedImage(image: UIImage(bundleImageName: "Peer Info/ButtonStop"), color: UIColor(rgb: 0xcdcdcd)) { + if let image = generateTintedImage(image: UIImage(bundleImageName: "Premium/NoIcon"), color: .white) { let imageSize = image.size.aspectFitted(CGSize(width: size.width - 6.0, height: size.height - 6.0)) image.draw(in: CGRect(origin: CGPoint(x: floor((size.width - imageSize.width) / 2.0), y: floor((size.height - imageSize.height) / 2.0)), size: imageSize)) } } UIGraphicsPopContext() - }) + })?.withRenderingMode(icon == .stop ? .alwaysTemplate : .alwaysOriginal) self.contents = image?.cgImage } } @@ -5877,7 +5877,12 @@ public final class EmojiPagerContentComponent: Component { var isSelected = false if let itemFile = item.itemFile, component.selectedItems.contains(itemFile.fileId) { isSelected = true - } else if case let .icon(icon) = item.content.id, case .topic = icon, component.selectedItems.isEmpty { + } else if case let .icon(icon) = item.content.id, component.selectedItems.isEmpty { + if case .topic = icon { + isSelected = true + } else if case .stop = icon { + isSelected = true + } } if isSelected { @@ -5908,9 +5913,9 @@ public final class EmojiPagerContentComponent: Component { itemTransition.setFrame(layer: itemSelectionLayer, frame: baseItemFrame) - itemLayer.transform = CATransform3DMakeScale(0.8, 0.8, 1.0) +// itemLayer.transform = CATransform3DMakeScale(0.8, 0.8, 1.0) } else { - itemLayer.transform = CATransform3DIdentity +// itemLayer.transform = CATransform3DIdentity } if animateItemIn, !transition.animation.isImmediate, let contentAnimation = contentAnimation, case .groupExpanded(id: itemGroup.groupId) = contentAnimation.type, let placeholderView = self.visibleItemPlaceholderViews[itemId] { @@ -6086,6 +6091,7 @@ public final class EmojiPagerContentComponent: Component { break } if case let .icon(icon) = id.itemId, case .topic = icon, component.selectedItems.isEmpty { + } else if case let .icon(icon) = id.itemId, case .stop = icon, component.selectedItems.isEmpty { } else if let fileId = fileId, component.selectedItems.contains(fileId) { } else { itemSelectionLayer.removeFromSuperlayer() @@ -7859,7 +7865,7 @@ public final class EmojiPagerContentComponent: Component { itemFile: nil, subgroupId: nil, icon: .none, - tintMode: .none + tintMode: backgroundIconColor.flatMap { .custom($0) } ?? .accent ) let groupId = "recent" diff --git a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/PeerNameColorScreen.swift b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/PeerNameColorScreen.swift index 45168b1b10..719640e073 100644 --- a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/PeerNameColorScreen.swift +++ b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/PeerNameColorScreen.swift @@ -327,6 +327,14 @@ public func PeerNameColorScreen( } else { nameColor = (peer?.nameColor ?? .blue).color } + + let selectedItems: [EngineMedia.Id] + if let selectedEmojiId, selectedEmojiId != 0 { + selectedItems = [EngineMedia.Id(namespace: Namespaces.Media.CloudFile, id: selectedEmojiId)] + } else { + selectedItems = [] + } + return EmojiPagerContentComponent.emojiInputData( context: context, animationCache: context.animationCache, @@ -338,7 +346,7 @@ public func PeerNameColorScreen( areUnicodeEmojiEnabled: false, areCustomEmojiEnabled: true, chatPeerId: context.account.peerId, - selectedItems: Set(selectedEmojiId.flatMap { [EngineMedia.Id(namespace: Namespaces.Media.CloudFile, id: $0)] } ?? []), + selectedItems: Set(selectedItems), backgroundIconColor: nameColor ) } diff --git a/submodules/TelegramUI/Images.xcassets/Premium/NoIcon.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Premium/NoIcon.imageset/Contents.json new file mode 100644 index 0000000000..f923ab5c87 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Premium/NoIcon.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "noicon_30.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Premium/NoIcon.imageset/noicon_30.pdf b/submodules/TelegramUI/Images.xcassets/Premium/NoIcon.imageset/noicon_30.pdf new file mode 100644 index 0000000000..a85f38b99b --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Premium/NoIcon.imageset/noicon_30.pdf @@ -0,0 +1,87 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 5.000000 5.000000 cm +0.000000 0.000000 0.000000 scn +13.500000 0.000000 m +20.955845 0.000000 27.000000 6.044155 27.000000 13.500000 c +27.000000 20.955845 20.955845 27.000000 13.500000 27.000000 c +6.044156 27.000000 0.000000 20.955845 0.000000 13.500000 c +0.000000 6.044155 6.044156 0.000000 13.500000 0.000000 c +h +5.152241 15.265368 m +5.000000 14.897825 5.000000 14.431883 5.000000 13.500000 c +5.000000 12.568117 5.000000 12.102175 5.152241 11.734632 c +5.355228 11.244577 5.744577 10.855228 6.234633 10.652241 c +6.602176 10.500000 7.068117 10.500000 8.000000 10.500000 c +19.000000 10.500000 l +19.931883 10.500000 20.397825 10.500000 20.765368 10.652241 c +21.255423 10.855228 21.644772 11.244577 21.847759 11.734632 c +22.000000 12.102175 22.000000 12.568117 22.000000 13.500000 c +22.000000 14.431883 22.000000 14.897825 21.847759 15.265368 c +21.644772 15.755423 21.255423 16.144772 20.765368 16.347759 c +20.397825 16.500000 19.931883 16.500000 19.000000 16.500000 c +8.000000 16.500000 l +7.068117 16.500000 6.602176 16.500000 6.234633 16.347759 c +5.744577 16.144772 5.355228 15.755423 5.152241 15.265368 c +h +f* +n +Q + +endstream +endobj + +3 0 obj + 1179 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 37.000000 37.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Pages 5 0 R + /Type /Catalog + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000001269 00000 n +0000001292 00000 n +0000001465 00000 n +0000001539 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +1598 +%%EOF \ No newline at end of file