mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Keep document byte data only in DocumentMedia.
This commit is contained in:
@@ -1028,15 +1028,13 @@ void GifsListWidget::showPreview() {
|
||||
auto layout = _rows[row].items[col];
|
||||
if (const auto w = App::wnd()) {
|
||||
if (const auto previewDocument = layout->getPreviewDocument()) {
|
||||
w->showMediaPreview(
|
||||
_previewShown = w->showMediaPreview(
|
||||
Data::FileOriginSavedGifs(),
|
||||
previewDocument);
|
||||
_previewShown = true;
|
||||
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
|
||||
w->showMediaPreview(
|
||||
_previewShown = w->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewPhoto);
|
||||
_previewShown = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1220,7 +1220,8 @@ not_null<Lottie::Animation*> LottieAnimationFromDocument(
|
||||
|
||||
bool HasLottieThumbnail(
|
||||
ImagePtr thumbnail,
|
||||
not_null<DocumentData*> sticker) {
|
||||
not_null<Data::DocumentMedia*> media) {
|
||||
const auto document = media->owner();
|
||||
if (thumbnail) {
|
||||
if (!thumbnail->loaded()) {
|
||||
return false;
|
||||
@@ -1230,15 +1231,15 @@ bool HasLottieThumbnail(
|
||||
return location.valid()
|
||||
&& location.type() == StorageFileLocation::Type::StickerSetThumb
|
||||
&& !bytes.isEmpty();
|
||||
} else if (const auto info = sticker->sticker()) {
|
||||
} else if (const auto info = document->sticker()) {
|
||||
if (!info->animated) {
|
||||
return false;
|
||||
}
|
||||
sticker->automaticLoad(sticker->stickerSetOrigin(), nullptr);
|
||||
if (!sticker->loaded()) {
|
||||
document->automaticLoad(document->stickerSetOrigin(), nullptr);
|
||||
if (!media->loaded()) {
|
||||
return false;
|
||||
}
|
||||
return sticker->bigFileBaseCacheKey().has_value();
|
||||
return document->bigFileBaseCacheKey().has_value();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -160,7 +160,7 @@ enum class LottieSize : uchar {
|
||||
|
||||
[[nodiscard]] bool HasLottieThumbnail(
|
||||
ImagePtr thumbnail,
|
||||
not_null<DocumentData*> sticker);
|
||||
not_null<Data::DocumentMedia*> media);
|
||||
[[nodiscard]] std::unique_ptr<Lottie::SinglePlayer> LottieThumbnail(
|
||||
ImagePtr thumbnail,
|
||||
not_null<Data::DocumentMedia*> media,
|
||||
|
@@ -701,7 +701,9 @@ void StickersListWidget::Footer::paintSearchIcon(Painter &p) const {
|
||||
void StickersListWidget::Footer::validateIconLottieAnimation(
|
||||
const StickerIcon &icon) {
|
||||
if (icon.lottie
|
||||
|| !Stickers::HasLottieThumbnail(icon.thumbnail, icon.sticker)) {
|
||||
|| !Stickers::HasLottieThumbnail(
|
||||
icon.thumbnail,
|
||||
icon.stickerMedia.get())) {
|
||||
return;
|
||||
}
|
||||
auto player = Stickers::LottieThumbnail(
|
||||
|
Reference in New Issue
Block a user