Initial implementation of the PSA API

This commit is contained in:
Ali
2020-04-24 23:18:44 +04:00
parent faf022b9ec
commit c4004a23ee
68 changed files with 4928 additions and 4378 deletions

View File

@@ -645,12 +645,15 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
var forwardSource: Peer?
var forwardAuthorSignature: String?
var forwardPsaType: String?
var forwardInfoSizeApply: (CGSize, () -> ChatMessageForwardInfoNode)?
var forwardInfoSizeApply: (CGSize, (CGFloat) -> ChatMessageForwardInfoNode)?
var updatedForwardBackgroundNode: ASImageNode?
var forwardBackgroundImage: UIImage?
if !ignoreForward, let forwardInfo = item.message.forwardInfo {
forwardPsaType = forwardInfo.psaType
if let source = forwardInfo.source {
forwardSource = source
if let authorSignature = forwardInfo.authorSignature {
@@ -670,7 +673,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
}
}
let availableWidth = max(60.0, availableContentWidth + 6.0)
forwardInfoSizeApply = makeForwardInfoLayout(item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
forwardInfoSizeApply = makeForwardInfoLayout(item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
if let currentForwardBackgroundNode = currentForwardBackgroundNode {
updatedForwardBackgroundNode = currentForwardBackgroundNode
@@ -851,7 +854,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
}
if let (forwardInfoSize, forwardInfoApply) = forwardInfoSizeApply {
let forwardInfoNode = forwardInfoApply()
let forwardInfoNode = forwardInfoApply(forwardInfoSize.width)
if strongSelf.forwardInfoNode == nil {
strongSelf.forwardInfoNode = forwardInfoNode
strongSelf.addSubnode(forwardInfoNode)