mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-11-03 22:27:13 +01:00
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 lines
805 B
Swift
14 lines
805 B
Swift
import Foundation
|
|
import UIKit
|
|
import TelegramStringFormatting
|
|
import TextFormat
|
|
|
|
func chatListRichTextPreview(_ preview: NSAttributedString, font: UIFont, italicFont: UIFont, textColor: UIColor, additionalSpoilers: [NSRange]) -> NSAttributedString {
|
|
let result = NSMutableAttributedString(attributedString: styleInstantPagePreview(preview, font: font, italicFont: italicFont, textColor: textColor))
|
|
for range in additionalSpoilers {
|
|
guard range.location >= 0, range.location <= result.length, range.length > 0, range.length <= result.length - range.location else { continue }
|
|
result.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Spoiler), value: true, range: range)
|
|
}
|
|
return renderInstantPagePreviewIcons(result, font: font, textColor: textColor)
|
|
}
|