From c632316ad7d5a572c0e1ddd9867a71c0d823c320 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 31 Dec 2021 16:40:01 +0300 Subject: [PATCH] Fix updated sticker set thumbnail loading. --- Telegram/SourceFiles/data/data_cloud_file.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/data/data_cloud_file.cpp b/Telegram/SourceFiles/data/data_cloud_file.cpp index f0801e13e..77ae77634 100644 --- a/Telegram/SourceFiles/data/data_cloud_file.cpp +++ b/Telegram/SourceFiles/data/data_cloud_file.cpp @@ -172,11 +172,25 @@ void UpdateCloudFile( return; } + const auto needStickerThumbnailUpdate = [&] { + const auto was = std::get_if( + &file.location.file().data); + const auto now = std::get_if( + &data.location.file().data); + using Type = StorageFileLocation::Type; + if (!was || !now || was->type() != Type::StickerSetThumb) { + return false; + } + return now->valid() + && (now->type() != Type::StickerSetThumb + || now->cacheKey() != was->cacheKey()); + }; const auto update = !file.location.valid() || (data.location.file().cacheKey() && (!file.location.file().cacheKey() || (file.location.width() < data.location.width()) - || (file.location.height() < data.location.height()))); + || (file.location.height() < data.location.height()) + || needStickerThumbnailUpdate())); if (!update) { return; } @@ -204,6 +218,8 @@ void UpdateCloudFile( } else if (file.loader) { const auto origin = base::take(file.loader)->fileOrigin(); restartLoader(origin); + } else if (file.flags & CloudFile::Flag::Failed) { + file.flags &= ~CloudFile::Flag::Failed; } }