Various fixes

This commit is contained in:
Ilya Laktyushin
2023-12-20 17:44:12 +04:00
parent 3ae64b399f
commit 90a1e9b688
10 changed files with 249 additions and 178 deletions

View File

@@ -491,9 +491,12 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
if remainingCutoutHeight > 0.0 {
cutout = TextNodeCutout(topRight: CGSize(width: cutoutWidth, height: remainingCutoutHeight))
}
var maximumNumberOfLines: Int = 12
if isPreview {
maximumNumberOfLines = mediaAndFlags != nil ? 4 : 6
}
let textString = stringWithAppliedEntities(text, entities: entities ?? [], baseColor: messageTheme.primaryTextColor, linkColor: incoming ? mainColor : messageTheme.linkTextColor, baseFont: textFont, linkFont: textFont, boldFont: textBoldFont, italicFont: textItalicFont, boldItalicFont: textBoldItalicFont, fixedFont: textFixedFont, blockQuoteFont: textBlockQuoteFont, message: nil, adjustQuoteFontSize: true)
let textLayoutAndApplyValue = makeTextLayout(TextNodeLayoutArguments(attributedString: textString, backgroundColor: nil, maximumNumberOfLines: 12, truncationType: .end, constrainedSize: CGSize(width: maxContentsWidth, height: 10000.0), alignment: .natural, lineSpacing: textLineSpacing, cutout: cutout, insets: UIEdgeInsets()))
let textLayoutAndApplyValue = makeTextLayout(TextNodeLayoutArguments(attributedString: textString, backgroundColor: nil, maximumNumberOfLines: maximumNumberOfLines, truncationType: .end, constrainedSize: CGSize(width: maxContentsWidth, height: 10000.0), alignment: .natural, lineSpacing: textLineSpacing, cutout: cutout, insets: UIEdgeInsets()))
textLayoutAndApply = textLayoutAndApplyValue
remainingCutoutHeight -= textLayoutAndApplyValue.0.size.height