mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
@@ -76,6 +76,9 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
private var media: Media?
|
||||
private var theme: ChatPresentationThemeData?
|
||||
|
||||
private var isHighlighted: Bool = false
|
||||
private var highlightTimer: Foundation.Timer?
|
||||
|
||||
public var openMedia: ((InteractiveMediaNodeActivateContent) -> Void)?
|
||||
public var activateAction: (() -> Void)?
|
||||
public var requestUpdateLayout: (() -> Void)?
|
||||
@@ -109,6 +112,10 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
self.addSubnode(self.statusNode)
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.highlightTimer?.invalidate()
|
||||
}
|
||||
|
||||
@objc private func pressed() {
|
||||
self.activateAction?()
|
||||
}
|
||||
@@ -817,7 +824,7 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
self.inlineMediaValue = inlineMediaValue
|
||||
|
||||
if updateMedia {
|
||||
let updateInlineImageSignal = chatWebpageSnippetPhoto(account: context.account, userLocation: .peer(message.id.peerId), photoReference: .message(message: MessageReference(message), media: inlineMediaValue))
|
||||
let updateInlineImageSignal = chatWebpageSnippetPhoto(account: context.account, userLocation: .peer(message.id.peerId), photoReference: .message(message: MessageReference(message), media: inlineMediaValue), placeholderColor: mainColor.withMultipliedAlpha(0.1))
|
||||
inlineMedia.setSignal(updateInlineImageSignal)
|
||||
}
|
||||
|
||||
@@ -2065,8 +2072,34 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
let transition: ContainedViewLayoutTransition = .animated(duration: isHighlighted ? 0.1 : 0.2, curve: .easeInOut)
|
||||
let scale: CGFloat = isHighlighted ? ((self.bounds.width - 5.0) / self.bounds.width) : 1.0
|
||||
if self.isHighlighted != isHighlighted {
|
||||
self.isHighlighted = isHighlighted
|
||||
|
||||
if isHighlighted {
|
||||
/*self.highlightTimer = Foundation.Timer.scheduledTimer(withTimeInterval: 0.05, repeats: false, block: { [weak self] timer in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if self.highlightTimer === timer {
|
||||
self.highlightTimer = nil
|
||||
}
|
||||
self.applyIsHighlighted()
|
||||
})*/
|
||||
self.applyIsHighlighted()
|
||||
} else {
|
||||
self.applyIsHighlighted()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func applyIsHighlighted() {
|
||||
if let highlightTimer = self.highlightTimer {
|
||||
self.highlightTimer = nil
|
||||
highlightTimer.invalidate()
|
||||
}
|
||||
|
||||
let transition: ContainedViewLayoutTransition = .animated(duration: self.isHighlighted ? 0.2 : 0.2, curve: .easeInOut)
|
||||
let scale: CGFloat = self.isHighlighted ? ((self.bounds.width - 5.0) / self.bounds.width) : 1.0
|
||||
transition.updateSublayerTransformScale(node: self, scale: scale)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user