mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix updated sticker set thumbnail loading.
This commit is contained in:
parent
bba7010e74
commit
c632316ad7
1 changed files with 17 additions and 1 deletions
|
@ -172,11 +172,25 @@ void UpdateCloudFile(
|
||||||
return;
|
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()
|
const auto update = !file.location.valid()
|
||||||
|| (data.location.file().cacheKey()
|
|| (data.location.file().cacheKey()
|
||||||
&& (!file.location.file().cacheKey()
|
&& (!file.location.file().cacheKey()
|
||||||
|| (file.location.width() < data.location.width())
|
|| (file.location.width() < data.location.width())
|
||||||
|| (file.location.height() < data.location.height())));
|
|| (file.location.height() < data.location.height())
|
||||||
|
|| needStickerThumbnailUpdate()));
|
||||||
if (!update) {
|
if (!update) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -204,6 +218,8 @@ void UpdateCloudFile(
|
||||||
} else if (file.loader) {
|
} else if (file.loader) {
|
||||||
const auto origin = base::take(file.loader)->fileOrigin();
|
const auto origin = base::take(file.loader)->fileOrigin();
|
||||||
restartLoader(origin);
|
restartLoader(origin);
|
||||||
|
} else if (file.flags & CloudFile::Flag::Failed) {
|
||||||
|
file.flags &= ~CloudFile::Flag::Failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue