mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Improve pic display for ads
This commit is contained in:
parent
651c57a010
commit
03e318fef3
@ -1089,7 +1089,14 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
|||||||
|
|
||||||
if let (titleBadgeLayout, titleBadgeApply) = titleBadgeLayoutAndApply {
|
if let (titleBadgeLayout, titleBadgeApply) = titleBadgeLayoutAndApply {
|
||||||
let titleBadgeLabel = titleBadgeApply()
|
let titleBadgeLabel = titleBadgeApply()
|
||||||
let titleBadgeFrame = CGRect(origin: CGPoint(x: titleFrame.maxX + titleBadgeSpacing + titleBadgePadding, y: floorToScreenPixels(titleFrame.midY - titleBadgeLayout.size.height / 2.0)), size: titleBadgeLayout.size)
|
var titleLineWidth: CGFloat = 0.0
|
||||||
|
if let firstLine = titleLayout.linesRects().first {
|
||||||
|
titleLineWidth = firstLine.width
|
||||||
|
} else {
|
||||||
|
titleLineWidth = titleFrame.width
|
||||||
|
}
|
||||||
|
|
||||||
|
let titleBadgeFrame = CGRect(origin: CGPoint(x: titleFrame.minX + titleLineWidth + titleBadgeSpacing + titleBadgePadding, y: floorToScreenPixels(titleFrame.midY - titleBadgeLayout.size.height / 2.0)), size: titleBadgeLayout.size)
|
||||||
let badgeBackgroundFrame = titleBadgeFrame.insetBy(dx: -titleBadgePadding, dy: -1.0 + UIScreenPixel)
|
let badgeBackgroundFrame = titleBadgeFrame.insetBy(dx: -titleBadgePadding, dy: -1.0 + UIScreenPixel)
|
||||||
|
|
||||||
let button: HighlightTrackingButtonNode
|
let button: HighlightTrackingButtonNode
|
||||||
|
@ -1415,7 +1415,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
ignoreForward = true
|
ignoreForward = true
|
||||||
effectiveAuthor = author
|
effectiveAuthor = author
|
||||||
displayAuthorInfo = !mergedTop.merged && incoming
|
displayAuthorInfo = !mergedTop.merged && incoming
|
||||||
hasAvatar = adAttribute.displayAvatar
|
hasAvatar = adAttribute.displayAvatar && !adAttribute.canReport
|
||||||
} else {
|
} else {
|
||||||
effectiveAuthor = firstMessage.author
|
effectiveAuthor = firstMessage.author
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ public final class ChatMessageItemImpl: ChatMessageItem, CustomStringConvertible
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let adAttribute = message.adAttribute {
|
if let adAttribute = message.adAttribute {
|
||||||
if adAttribute.displayAvatar {
|
if adAttribute.displayAvatar && !adAttribute.canReport {
|
||||||
hasAvatar = adAttribute.displayAvatar
|
hasAvatar = adAttribute.displayAvatar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -510,6 +510,9 @@ public final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContent
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if adAttribute.displayAvatar && adAttribute.canReport, let profileImage = item.message.author?.smallProfileImage {
|
||||||
|
mediaAndFlags = (TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: [profileImage], immediateThumbnailData: nil, reference: nil, partialReference: nil, flags: []), [.preferMediaInline])
|
||||||
|
}
|
||||||
|
|
||||||
if adAttribute.canReport {
|
if adAttribute.canReport {
|
||||||
titleBadge = item.presentationData.strings.Message_AdWhatIsThis
|
titleBadge = item.presentationData.strings.Message_AdWhatIsThis
|
||||||
|
Loading…
x
Reference in New Issue
Block a user