2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Prepare lottie animations caching.

This commit is contained in:
John Preston
2019-06-26 12:01:04 +02:00
parent f20d9395d1
commit 35bc2cc2a5
17 changed files with 148 additions and 40 deletions

View File

@@ -668,6 +668,21 @@ void DocumentData::setGoodThumbnailOnUpload(
QString(), std::move(bytes), "JPG", std::move(image)));
}
auto DocumentData::bigFileBaseCacheKey() const
-> std::optional<Storage::Cache::Key> {
if (hasRemoteLocation()) {
return StorageFileLocation(
_dc,
session().userId(),
MTP_inputDocumentFileLocation(
MTP_long(id),
MTP_long(_access),
MTP_bytes(_fileReference),
MTP_string(QString()))).bigFileBaseCacheKey();
}
return std::nullopt;
}
bool DocumentData::saveToCache() const {
return (type == StickerDocument && size < Storage::kMaxStickerInMemory)
|| (isAnimation() && size < Storage::kMaxAnimationInMemory)