mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Name color improvements
This commit is contained in:
parent
7cb8f9739b
commit
014e3d8b76
@ -71,11 +71,13 @@ public final class TextNodeBlockQuoteData: NSObject {
|
||||
public let title: NSAttributedString?
|
||||
public let color: UIColor
|
||||
public let secondaryColor: UIColor?
|
||||
public let tertiaryColor: UIColor?
|
||||
|
||||
public init(title: NSAttributedString?, color: UIColor, secondaryColor: UIColor?) {
|
||||
public init(title: NSAttributedString?, color: UIColor, secondaryColor: UIColor?, tertiaryColor: UIColor?) {
|
||||
self.title = title
|
||||
self.color = color
|
||||
self.secondaryColor = secondaryColor
|
||||
self.tertiaryColor = tertiaryColor
|
||||
|
||||
super.init()
|
||||
}
|
||||
@ -102,6 +104,13 @@ public final class TextNodeBlockQuoteData: NSObject {
|
||||
} else if (self.secondaryColor == nil) != (other.secondaryColor == nil) {
|
||||
return false
|
||||
}
|
||||
if let lhsTertiaryColor = self.tertiaryColor, let rhsTertiaryColor = other.tertiaryColor {
|
||||
if !lhsTertiaryColor.isEqual(rhsTertiaryColor) {
|
||||
return false
|
||||
}
|
||||
} else if (self.tertiaryColor == nil) != (other.tertiaryColor == nil) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@ -141,11 +150,13 @@ private final class TextNodeBlockQuote {
|
||||
let frame: CGRect
|
||||
let tintColor: UIColor
|
||||
let secondaryTintColor: UIColor?
|
||||
let tertiaryTintColor: UIColor?
|
||||
|
||||
init(frame: CGRect, tintColor: UIColor, secondaryTintColor: UIColor?) {
|
||||
init(frame: CGRect, tintColor: UIColor, secondaryTintColor: UIColor?, tertiaryTintColor: UIColor?) {
|
||||
self.frame = frame
|
||||
self.tintColor = tintColor
|
||||
self.secondaryTintColor = secondaryTintColor
|
||||
self.tertiaryTintColor = tertiaryTintColor
|
||||
}
|
||||
}
|
||||
|
||||
@ -1212,6 +1223,7 @@ open class TextNode: ASDisplayNode {
|
||||
let isBlockQuote: Bool
|
||||
let tintColor: UIColor?
|
||||
let secondaryTintColor: UIColor?
|
||||
let tertiaryTintColor: UIColor?
|
||||
}
|
||||
var stringSegments: [StringSegment] = []
|
||||
|
||||
@ -1235,7 +1247,8 @@ open class TextNode: ASDisplayNode {
|
||||
firstCharacterOffset: segmentCharacterOffset,
|
||||
isBlockQuote: false,
|
||||
tintColor: nil,
|
||||
secondaryTintColor: nil
|
||||
secondaryTintColor: nil,
|
||||
tertiaryTintColor: nil
|
||||
))
|
||||
}
|
||||
|
||||
@ -1247,7 +1260,8 @@ open class TextNode: ASDisplayNode {
|
||||
firstCharacterOffset: effectiveRange.location,
|
||||
isBlockQuote: true,
|
||||
tintColor: value.color,
|
||||
secondaryTintColor: value.secondaryColor
|
||||
secondaryTintColor: value.secondaryColor,
|
||||
tertiaryTintColor: value.tertiaryColor
|
||||
))
|
||||
}
|
||||
segmentCharacterOffset = effectiveRange.location + effectiveRange.length
|
||||
@ -1261,7 +1275,8 @@ open class TextNode: ASDisplayNode {
|
||||
firstCharacterOffset: effectiveRange.location,
|
||||
isBlockQuote: false,
|
||||
tintColor: nil,
|
||||
secondaryTintColor: nil
|
||||
secondaryTintColor: nil,
|
||||
tertiaryTintColor: nil
|
||||
))
|
||||
segmentCharacterOffset = effectiveRange.location + effectiveRange.length
|
||||
}
|
||||
@ -1277,7 +1292,8 @@ open class TextNode: ASDisplayNode {
|
||||
firstCharacterOffset: segmentCharacterOffset,
|
||||
isBlockQuote: false,
|
||||
tintColor: nil,
|
||||
secondaryTintColor: nil
|
||||
secondaryTintColor: nil,
|
||||
tertiaryTintColor: nil
|
||||
))
|
||||
}
|
||||
|
||||
@ -1290,6 +1306,7 @@ open class TextNode: ASDisplayNode {
|
||||
var lines: [TextNodeLine] = []
|
||||
var tintColor: UIColor?
|
||||
var secondaryTintColor: UIColor?
|
||||
var tertiaryTintColor: UIColor?
|
||||
var isBlockQuote: Bool = false
|
||||
var additionalWidth: CGFloat = 0.0
|
||||
}
|
||||
@ -1301,6 +1318,7 @@ open class TextNode: ASDisplayNode {
|
||||
calculatedSegment.isBlockQuote = segment.isBlockQuote
|
||||
calculatedSegment.tintColor = segment.tintColor
|
||||
calculatedSegment.secondaryTintColor = segment.secondaryTintColor
|
||||
calculatedSegment.tertiaryTintColor = segment.tertiaryTintColor
|
||||
|
||||
let rawSubstring = segment.substring.string as NSString
|
||||
let substringLength = rawSubstring.length
|
||||
@ -1512,7 +1530,7 @@ open class TextNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
if segment.isBlockQuote, let tintColor = segment.tintColor {
|
||||
blockQuotes.append(TextNodeBlockQuote(frame: CGRect(origin: CGPoint(x: 0.0, y: blockMinY - 2.0), size: CGSize(width: blockWidth, height: blockMaxY - (blockMinY - 2.0) + 4.0)), tintColor: tintColor, secondaryTintColor: segment.secondaryTintColor))
|
||||
blockQuotes.append(TextNodeBlockQuote(frame: CGRect(origin: CGPoint(x: 0.0, y: blockMinY - 2.0), size: CGSize(width: blockWidth, height: blockMaxY - (blockMinY - 2.0) + 4.0)), tintColor: tintColor, secondaryTintColor: segment.secondaryTintColor, tertiaryTintColor: segment.tertiaryTintColor))
|
||||
}
|
||||
}
|
||||
|
||||
@ -2216,9 +2234,19 @@ open class TextNode: ASDisplayNode {
|
||||
if let secondaryTintColor = blockQuote.secondaryTintColor {
|
||||
let isMonochrome = secondaryTintColor.alpha == 0.0
|
||||
|
||||
let tertiaryTintColor = blockQuote.tertiaryTintColor
|
||||
let dashHeight: CGFloat = tertiaryTintColor != nil ? 6.0 : 9.0
|
||||
|
||||
do {
|
||||
context.saveGState()
|
||||
|
||||
|
||||
let dashOffset: CGFloat
|
||||
if let _ = tertiaryTintColor {
|
||||
dashOffset = isMonochrome ? -2.0 : 0.0
|
||||
} else {
|
||||
dashOffset = isMonochrome ? -4.0 : 5.0
|
||||
}
|
||||
|
||||
if isMonochrome {
|
||||
context.setFillColor(blockQuote.tintColor.withMultipliedAlpha(0.2).cgColor)
|
||||
context.fill(lineFrame)
|
||||
@ -2229,23 +2257,37 @@ open class TextNode: ASDisplayNode {
|
||||
context.setFillColor(secondaryTintColor.cgColor)
|
||||
}
|
||||
|
||||
let dashOffset: CGFloat = isMonochrome ? -4.0 : 5.0
|
||||
context.translateBy(x: blockFrame.minX, y: blockFrame.minY + dashOffset)
|
||||
|
||||
var offset = 0.0
|
||||
while offset < blockFrame.height {
|
||||
context.move(to: CGPoint(x: 0.0, y: 3.0))
|
||||
context.addLine(to: CGPoint(x: lineWidth, y: 0.0))
|
||||
context.addLine(to: CGPoint(x: lineWidth, y: 9.0))
|
||||
context.addLine(to: CGPoint(x: 0.0, y: 9.0 + 3.0))
|
||||
context.closePath()
|
||||
context.fillPath()
|
||||
func drawDashes() {
|
||||
context.translateBy(x: blockFrame.minX, y: blockFrame.minY + dashOffset)
|
||||
|
||||
context.translateBy(x: 0.0, y: 18.0)
|
||||
offset += 18.0
|
||||
var offset = 0.0
|
||||
while offset < blockFrame.height {
|
||||
context.move(to: CGPoint(x: 0.0, y: 3.0))
|
||||
context.addLine(to: CGPoint(x: lineWidth, y: 0.0))
|
||||
context.addLine(to: CGPoint(x: lineWidth, y: dashHeight))
|
||||
context.addLine(to: CGPoint(x: 0.0, y: dashHeight + 3.0))
|
||||
context.closePath()
|
||||
context.fillPath()
|
||||
|
||||
context.translateBy(x: 0.0, y: 18.0)
|
||||
offset += 18.0
|
||||
}
|
||||
}
|
||||
|
||||
drawDashes()
|
||||
context.restoreGState()
|
||||
|
||||
if let tertiaryTintColor {
|
||||
context.saveGState()
|
||||
context.translateBy(x: 0.0, y: dashHeight)
|
||||
if isMonochrome {
|
||||
context.setFillColor(blockQuote.tintColor.withAlphaComponent(0.4).cgColor)
|
||||
} else {
|
||||
context.setFillColor(tertiaryTintColor.cgColor)
|
||||
}
|
||||
drawDashes()
|
||||
context.restoreGState()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
context.setFillColor(blockQuote.tintColor.cgColor)
|
||||
|
@ -1213,7 +1213,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
}
|
||||
}
|
||||
let availableWidth = max(60.0, availableContentWidth + 6.0)
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
if replyInfoApply != nil || viaBotApply != nil || forwardInfoSizeApply != nil {
|
||||
|
@ -187,6 +187,9 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
if let _ = nameColors?.secondary {
|
||||
secondaryColor = .clear
|
||||
}
|
||||
if let _ = nameColors?.tertiary {
|
||||
tertiaryColor = .clear
|
||||
}
|
||||
} else {
|
||||
var authorNameColor: UIColor?
|
||||
authorNameColor = nameColors?.main
|
||||
|
@ -1260,7 +1260,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
||||
authorNameLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode),
|
||||
adminBadgeLayout: (TextNodeLayoutArguments) -> (TextNodeLayout, () -> TextNode),
|
||||
threadInfoLayout: (ChatMessageThreadInfoNode.Arguments) -> (CGSize, (Bool) -> ChatMessageThreadInfoNode),
|
||||
forwardInfoLayout: (ChatPresentationData, PresentationStrings, ChatMessageForwardInfoType, Peer?, String?, String?, ChatMessageForwardInfoNode.StoryData?, CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode),
|
||||
forwardInfoLayout: (AccountContext, ChatPresentationData, PresentationStrings, ChatMessageForwardInfoType, Peer?, String?, String?, ChatMessageForwardInfoNode.StoryData?, CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode),
|
||||
replyInfoLayout: (ChatMessageReplyInfoNode.Arguments) -> (CGSize, (CGSize, Bool, ListViewItemUpdateAnimation) -> ChatMessageReplyInfoNode),
|
||||
actionButtonsLayout: (AccountContext, ChatPresentationThemeData, PresentationChatBubbleCorners, PresentationStrings, WallpaperBackgroundNode?, ReplyMarkupMessageAttribute, Message, CGFloat) -> (minWidth: CGFloat, layout: (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode)),
|
||||
reactionButtonsLayout: (ChatMessageReactionButtonsNode.Arguments) -> (minWidth: CGFloat, layout: (CGFloat) -> (size: CGSize, apply: (ListViewItemUpdateAnimation) -> ChatMessageReactionButtonsNode)),
|
||||
@ -2177,7 +2177,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
||||
forwardAuthorSignature = forwardInfo.authorSignature
|
||||
}
|
||||
}
|
||||
let sizeAndApply = forwardInfoLayout(item.presentationData, item.presentationData.strings, .bubble(incoming: incoming), forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude))
|
||||
let sizeAndApply = forwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .bubble(incoming: incoming), forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude))
|
||||
forwardInfoSizeApply = (sizeAndApply.0, { width in sizeAndApply.1(width) })
|
||||
|
||||
forwardInfoOriginY = headerSize.height
|
||||
@ -2204,7 +2204,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
||||
}
|
||||
}
|
||||
|
||||
let sizeAndApply = forwardInfoLayout(item.presentationData, item.presentationData.strings, .bubble(incoming: incoming), forwardSource, nil, nil, ChatMessageForwardInfoNode.StoryData(storyType: storyType), CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude))
|
||||
let sizeAndApply = forwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .bubble(incoming: incoming), forwardSource, nil, nil, ChatMessageForwardInfoNode.StoryData(storyType: storyType), CGSize(width: maximumNodeWidth - layoutConstants.text.bubbleInsets.left - layoutConstants.text.bubbleInsets.right, height: CGFloat.greatestFiniteMagnitude))
|
||||
forwardInfoSizeApply = (sizeAndApply.0, { width in sizeAndApply.1(width) })
|
||||
|
||||
if storyType != .regular {
|
||||
|
@ -6,6 +6,7 @@ import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import LocalizedPeerData
|
||||
import AccountContext
|
||||
|
||||
public enum ChatMessageForwardInfoType: Equatable {
|
||||
case bubble(incoming: Bool)
|
||||
@ -106,10 +107,10 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
public static func asyncLayout(_ maybeNode: ChatMessageForwardInfoNode?) -> (_ presentationData: ChatPresentationData, _ strings: PresentationStrings, _ type: ChatMessageForwardInfoType, _ peer: Peer?, _ authorName: String?, _ psaType: String?, _ storyData: StoryData?, _ constrainedSize: CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode) {
|
||||
public static func asyncLayout(_ maybeNode: ChatMessageForwardInfoNode?) -> (_ context: AccountContext, _ presentationData: ChatPresentationData, _ strings: PresentationStrings, _ type: ChatMessageForwardInfoType, _ peer: Peer?, _ authorName: String?, _ psaType: String?, _ storyData: StoryData?, _ constrainedSize: CGSize) -> (CGSize, (CGFloat) -> ChatMessageForwardInfoNode) {
|
||||
let textNodeLayout = TextNode.asyncLayout(maybeNode?.textNode)
|
||||
|
||||
return { presentationData, strings, type, peer, authorName, psaType, storyData, constrainedSize in
|
||||
return { context, presentationData, strings, type, peer, authorName, psaType, storyData, constrainedSize in
|
||||
let fontSize = floor(presentationData.fontSize.baseDisplaySize * 13.0 / 17.0)
|
||||
let prefixFont = Font.regular(fontSize)
|
||||
let peerFont = Font.medium(fontSize)
|
||||
@ -163,11 +164,11 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
}
|
||||
} else {
|
||||
if incoming {
|
||||
// if let color = peer?.nameColor?.color {
|
||||
// titleColor = color
|
||||
// } else {
|
||||
if let nameColor = peer?.nameColor {
|
||||
titleColor = context.peerNameColors.get(nameColor).main
|
||||
} else {
|
||||
titleColor = presentationData.theme.theme.chat.message.incoming.accentTextColor
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
titleColor = presentationData.theme.theme.chat.message.outgoing.accentTextColor
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ public class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureReco
|
||||
}
|
||||
}
|
||||
let availableWidth = max(60.0, availableContentWidth - normalDisplaySize.width + 6.0)
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
if replyInfoApply != nil || viaBotApply != nil || forwardInfoSizeApply != nil {
|
||||
|
@ -432,7 +432,7 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
let availableWidth: CGFloat = max(60.0, availableContentWidth - 210.0 + 6.0)
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
var notConsumed = false
|
||||
|
@ -780,7 +780,7 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
}
|
||||
}
|
||||
let availableForwardWidth = max(60.0, availableWidth + 6.0)
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableForwardWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
forwardInfoSizeApply = makeForwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableForwardWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
var needsReplyBackground = false
|
||||
|
@ -380,27 +380,33 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
underlineLinks = false
|
||||
}
|
||||
|
||||
// let author = item.message.author
|
||||
let author = item.message.author
|
||||
let mainColor: UIColor
|
||||
let secondaryColor: UIColor? = nil
|
||||
var secondaryColor: UIColor? = nil
|
||||
var tertiaryColor: UIColor? = nil
|
||||
|
||||
let nameColors = author?.nameColor.flatMap { item.context.peerNameColors.get($0) }
|
||||
if !incoming {
|
||||
mainColor = messageTheme.accentTextColor
|
||||
// if let _ = author?.nameColor?.dashColors.1 {
|
||||
// secondaryColor = .clear
|
||||
// }
|
||||
if let _ = nameColors?.secondary {
|
||||
secondaryColor = .clear
|
||||
}
|
||||
if let _ = nameColors?.tertiary {
|
||||
tertiaryColor = .clear
|
||||
}
|
||||
} else {
|
||||
// let authorNameColor: UIColor?
|
||||
// authorNameColor = author?.nameColor?.color
|
||||
// secondaryColor = author?.nameColor?.dashColors.1
|
||||
let authorNameColor = nameColors?.main
|
||||
secondaryColor = nameColors?.secondary
|
||||
tertiaryColor = nameColors?.tertiary
|
||||
|
||||
// if let authorNameColor {
|
||||
// mainColor = authorNameColor
|
||||
// } else {
|
||||
if let authorNameColor {
|
||||
mainColor = authorNameColor
|
||||
} else {
|
||||
mainColor = messageTheme.accentTextColor
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
attributedText = stringWithAppliedEntities(rawText, entities: entities, baseColor: messageTheme.primaryTextColor, linkColor: messageTheme.linkTextColor, baseQuoteTintColor: mainColor, baseQuoteSecondaryTintColor: secondaryColor, baseFont: textFont, linkFont: textFont, boldFont: item.presentationData.messageBoldFont, italicFont: item.presentationData.messageItalicFont, boldItalicFont: item.presentationData.messageBoldItalicFont, fixedFont: item.presentationData.messageFixedFont, blockQuoteFont: item.presentationData.messageBlockQuoteFont, underlineLinks: underlineLinks, message: item.message, adjustQuoteFontSize: true)
|
||||
attributedText = stringWithAppliedEntities(rawText, entities: entities, baseColor: messageTheme.primaryTextColor, linkColor: messageTheme.linkTextColor, baseQuoteTintColor: mainColor, baseQuoteSecondaryTintColor: secondaryColor, baseQuoteTertiaryTintColor: tertiaryColor, baseFont: textFont, linkFont: textFont, boldFont: item.presentationData.messageBoldFont, italicFont: item.presentationData.messageItalicFont, boldItalicFont: item.presentationData.messageBoldItalicFont, fixedFont: item.presentationData.messageFixedFont, blockQuoteFont: item.presentationData.messageBlockQuoteFont, underlineLinks: underlineLinks, message: item.message, adjustQuoteFontSize: true)
|
||||
} else if !rawText.isEmpty {
|
||||
attributedText = NSAttributedString(string: rawText, font: textFont, textColor: messageTheme.primaryTextColor)
|
||||
} else {
|
||||
|
@ -55,7 +55,7 @@ public func chatInputStateStringWithAppliedEntities(_ text: String, entities: [M
|
||||
return string
|
||||
}
|
||||
|
||||
public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEntity], baseColor: UIColor, linkColor: UIColor, baseQuoteTintColor: UIColor? = nil, baseQuoteSecondaryTintColor: UIColor? = nil, baseFont: UIFont, linkFont: UIFont, boldFont: UIFont, italicFont: UIFont, boldItalicFont: UIFont, fixedFont: UIFont, blockQuoteFont: UIFont, underlineLinks: Bool = true, external: Bool = false, message: Message?, entityFiles: [MediaId: TelegramMediaFile] = [:], adjustQuoteFontSize: Bool = false) -> NSAttributedString {
|
||||
public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEntity], baseColor: UIColor, linkColor: UIColor, baseQuoteTintColor: UIColor? = nil, baseQuoteSecondaryTintColor: UIColor? = nil, baseQuoteTertiaryTintColor: UIColor? = nil, baseFont: UIFont, linkFont: UIFont, boldFont: UIFont, italicFont: UIFont, boldItalicFont: UIFont, fixedFont: UIFont, blockQuoteFont: UIFont, underlineLinks: Bool = true, external: Bool = false, message: Message?, entityFiles: [MediaId: TelegramMediaFile] = [:], adjustQuoteFontSize: Bool = false) -> NSAttributedString {
|
||||
let baseQuoteTintColor = baseQuoteTintColor ?? baseColor
|
||||
|
||||
var nsString: NSString?
|
||||
@ -214,7 +214,7 @@ public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEnti
|
||||
case .BlockQuote:
|
||||
addFontAttributes(range, .blockQuote)
|
||||
|
||||
string.addAttribute(NSAttributedString.Key(rawValue: "Attribute__Blockquote"), value: TextNodeBlockQuoteData(title: nil, color: baseQuoteTintColor, secondaryColor: baseQuoteSecondaryTintColor), range: range)
|
||||
string.addAttribute(NSAttributedString.Key(rawValue: "Attribute__Blockquote"), value: TextNodeBlockQuoteData(title: nil, color: baseQuoteTintColor, secondaryColor: baseQuoteSecondaryTintColor, tertiaryColor: baseQuoteTertiaryTintColor), range: range)
|
||||
case .BankCard:
|
||||
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||
if underlineLinks && underlineAllLinks {
|
||||
|
Loading…
x
Reference in New Issue
Block a user