Fix updated sticker set thumbnail loading.

This commit is contained in:
John Preston 2021-12-31 16:40:01 +03:00
parent bba7010e74
commit c632316ad7

View file

@ -172,11 +172,25 @@ void UpdateCloudFile(
return;
}
const auto needStickerThumbnailUpdate = [&] {
const auto was = std::get_if<StorageFileLocation>(
&file.location.file().data);
const auto now = std::get_if<StorageFileLocation>(
&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;
}
}