mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various fixes
This commit is contained in:
@@ -58,10 +58,15 @@ final class HorizontalStickerGridItemNode: GridItemNode {
|
||||
|
||||
private var currentIsPreviewing: Bool = false
|
||||
|
||||
private var setupTimestamp: Double?
|
||||
|
||||
override var isVisibleInGrid: Bool {
|
||||
didSet {
|
||||
if oldValue != self.isVisibleInGrid {
|
||||
if self.isVisibleInGrid {
|
||||
if self.setupTimestamp == nil {
|
||||
self.setupTimestamp = CACurrentMediaTime()
|
||||
}
|
||||
self.animationNode?.visibility = true
|
||||
} else {
|
||||
self.animationNode?.visibility = false
|
||||
@@ -158,7 +163,20 @@ final class HorizontalStickerGridItemNode: GridItemNode {
|
||||
self.imageNode.setSignal(chatMessageAnimatedSticker(postbox: account.postbox, file: item.file, small: true, size: fittedDimensions, synchronousLoad: false))
|
||||
}
|
||||
animationNode.started = { [weak self] in
|
||||
self?.imageNode.alpha = 0.0
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
strongSelf.imageNode.alpha = 0.0
|
||||
|
||||
let current = CACurrentMediaTime()
|
||||
if let setupTimestamp = strongSelf.setupTimestamp, current - setupTimestamp > 0.3 {
|
||||
if let placeholderNode = strongSelf.placeholderNode, !placeholderNode.alpha.isZero {
|
||||
strongSelf.removePlaceholder(animated: true)
|
||||
}
|
||||
} else {
|
||||
strongSelf.removePlaceholder(animated: false)
|
||||
}
|
||||
}
|
||||
animationNode.setup(source: AnimatedStickerResourceSource(account: account, resource: item.file.resource, isVideo: item.file.isVideoSticker), width: Int(fittedDimensions.width), height: Int(fittedDimensions.height), mode: .cached)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user