mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Streaming sticker caching
This commit is contained in:
@@ -377,12 +377,10 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
if let file = file {
|
||||
let dimensions = file.dimensions ?? PixelDimensions(width: 512, height: 512)
|
||||
let fittedSize = isEmoji ? dimensions.cgSize.aspectFilled(CGSize(width: 384.0, height: 384.0)) : dimensions.cgSize.aspectFitted(CGSize(width: 384.0, height: 384.0))
|
||||
let mode: AnimatedStickerMode
|
||||
if file.resource is LocalFileReferenceMediaResource {
|
||||
mode = .direct
|
||||
} else {
|
||||
mode = .cached
|
||||
}
|
||||
|
||||
let pathPrefix = item.context.account.postbox.mediaBox.shortLivedResourceCachePathPrefix(file.resource.id)
|
||||
let mode: AnimatedStickerMode = .direct(cachePathPrefix: pathPrefix)
|
||||
|
||||
animationNode.setup(source: AnimatedStickerResourceSource(account: item.context.account, resource: file.resource, fitzModifier: fitzModifier), width: Int(fittedSize.width), height: Int(fittedSize.height), playbackMode: playbackMode, mode: mode)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user