mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various improvements
This commit is contained in:
parent
059af7d697
commit
89e3ae02a2
51 changed files with 1305 additions and 660 deletions
|
|
@ -209,11 +209,21 @@ public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEnti
|
|||
}
|
||||
}
|
||||
if !skipEntity {
|
||||
var hashtagValue = hashtag
|
||||
var peerNameValue: String?
|
||||
if hashtagValue.contains("@") {
|
||||
let components = hashtagValue.components(separatedBy: "@")
|
||||
if components.count == 2, let firstComponent = components.first, let lastComponent = components.last, !firstComponent.isEmpty && !lastComponent.isEmpty {
|
||||
hashtagValue = firstComponent
|
||||
peerNameValue = lastComponent
|
||||
}
|
||||
}
|
||||
|
||||
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||
if underlineLinks && underlineAllLinks {
|
||||
string.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue as NSNumber, range: range)
|
||||
}
|
||||
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Hashtag), value: TelegramHashtag(peerName: nil, hashtag: hashtag), range: range)
|
||||
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Hashtag), value: TelegramHashtag(peerName: peerNameValue, hashtag: hashtagValue), range: range)
|
||||
}
|
||||
case .BotCommand:
|
||||
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue