mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Add premium icon
This commit is contained in:
@@ -1570,21 +1570,24 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
|||||||
} else if let effectiveAuthor = effectiveAuthor {
|
} else if let effectiveAuthor = effectiveAuthor {
|
||||||
authorNameString = EnginePeer(effectiveAuthor).displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
authorNameString = EnginePeer(effectiveAuthor).displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||||
|
|
||||||
|
let nameColor: UIColor
|
||||||
if incoming {
|
if incoming {
|
||||||
authorNameColor = chatMessagePeerIdColors[Int(clamping: effectiveAuthor.id.id._internalGetInt64Value() % 7)]
|
nameColor = chatMessagePeerIdColors[Int(clamping: effectiveAuthor.id.id._internalGetInt64Value() % 7)]
|
||||||
} else {
|
} else {
|
||||||
authorNameColor = item.presentationData.theme.theme.chat.message.outgoing.accentTextColor
|
nameColor = item.presentationData.theme.theme.chat.message.outgoing.accentTextColor
|
||||||
}
|
}
|
||||||
|
authorNameColor = nameColor
|
||||||
|
|
||||||
if case let .peer(peerId) = item.chatLocation, let authorPeerId = item.message.author?.id, authorPeerId == peerId {
|
if case let .peer(peerId) = item.chatLocation, let authorPeerId = item.message.author?.id, authorPeerId == peerId {
|
||||||
} else if effectiveAuthor.isScam {
|
} else if effectiveAuthor.isScam {
|
||||||
currentCredibilityIcon = .scam(color: incoming ? item.presentationData.theme.theme.chat.message.incoming.scamColor : item.presentationData.theme.theme.chat.message.outgoing.scamColor)
|
currentCredibilityIcon = .scam(color: incoming ? item.presentationData.theme.theme.chat.message.incoming.scamColor : item.presentationData.theme.theme.chat.message.outgoing.scamColor)
|
||||||
} else if effectiveAuthor.isFake {
|
} else if effectiveAuthor.isFake {
|
||||||
currentCredibilityIcon = .fake(color: incoming ? item.presentationData.theme.theme.chat.message.incoming.scamColor : item.presentationData.theme.theme.chat.message.outgoing.scamColor)
|
currentCredibilityIcon = .fake(color: incoming ? item.presentationData.theme.theme.chat.message.incoming.scamColor : item.presentationData.theme.theme.chat.message.outgoing.scamColor)
|
||||||
} else if let user = item.message.author as? TelegramUser, let emojiStatus = user.emojiStatus {
|
} else if let user = effectiveAuthor as? TelegramUser, let emojiStatus = user.emojiStatus {
|
||||||
currentCredibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.mediaPlaceholderColor : item.presentationData.theme.theme.chat.message.outgoing.mediaPlaceholderColor, themeColor: authorNameColor?.withMultipliedAlpha(0.4), loopMode: .count(2))
|
currentCredibilityIcon = .animation(content: .customEmoji(fileId: emojiStatus.fileId), size: CGSize(width: 20.0, height: 20.0), placeholderColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.mediaPlaceholderColor : item.presentationData.theme.theme.chat.message.outgoing.mediaPlaceholderColor, themeColor: nameColor.withMultipliedAlpha(0.4), loopMode: .count(2))
|
||||||
|
} else if effectiveAuthor.isPremium {
|
||||||
|
currentCredibilityIcon = .premium(color: nameColor.withMultipliedAlpha(0.4))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if let rawAuthorNameColor = authorNameColor {
|
if let rawAuthorNameColor = authorNameColor {
|
||||||
var dimColors = false
|
var dimColors = false
|
||||||
@@ -2466,7 +2469,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
|||||||
containerSize: CGSize(width: 20.0, height: 20.0)
|
containerSize: CGSize(width: 20.0, height: 20.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
credibilityIconView.frame = CGRect(origin: CGPoint(x: nameNode.frame.maxX + 4.0, y: nameNode.frame.minY + floor((nameNode.bounds.height - credibilityIconSize.height) / 2.0)), size: credibilityIconSize)
|
credibilityIconView.frame = CGRect(origin: CGPoint(x: nameNode.frame.maxX + 3.0, y: nameNode.frame.minY + floor((nameNode.bounds.height - credibilityIconSize.height) / 2.0)), size: credibilityIconSize)
|
||||||
} else {
|
} else {
|
||||||
strongSelf.credibilityIconView?.removeFromSuperview()
|
strongSelf.credibilityIconView?.removeFromSuperview()
|
||||||
strongSelf.credibilityIconView = nil
|
strongSelf.credibilityIconView = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user