mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Update video qualities list.
This commit is contained in:
parent
475dec3014
commit
e52baf555f
3 changed files with 37 additions and 0 deletions
|
@ -451,6 +451,9 @@ not_null<HistoryItem*> History::createItem(
|
||||||
if (detachExistingItem) {
|
if (detachExistingItem) {
|
||||||
result->removeMainView();
|
result->removeMainView();
|
||||||
}
|
}
|
||||||
|
if (result->needsUpdateForVideoQualities(message)) {
|
||||||
|
owner().updateEditedMessage(message);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
const auto result = message.match([&](const auto &data) {
|
const auto result = message.match([&](const auto &data) {
|
||||||
|
|
|
@ -1303,6 +1303,38 @@ void HistoryItem::customEmojiRepaint() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HistoryItem::needsUpdateForVideoQualities(const MTPMessage &data) {
|
||||||
|
// When video gets the converted alt-videos lists, we need to update
|
||||||
|
// the message data even without edit-message update.
|
||||||
|
return data.match([&](const MTPDmessage &data) {
|
||||||
|
const auto media = data.vmedia();
|
||||||
|
if (!media) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return media->match([&](const MTPDmessageMediaDocument &data) {
|
||||||
|
const auto document = data.vdocument();
|
||||||
|
const auto alts = data.valt_documents();
|
||||||
|
if (!document || !alts || alts->v.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const auto id = document->match([](const auto &data) {
|
||||||
|
return DocumentId(data.vid().v);
|
||||||
|
});
|
||||||
|
const auto existingMedia = this->media();
|
||||||
|
const auto existingDocument = existingMedia
|
||||||
|
? existingMedia->document()
|
||||||
|
: nullptr;
|
||||||
|
return !existingDocument
|
||||||
|
|| (existingDocument->id != id)
|
||||||
|
|| existingDocument->resolveQualities(this).empty();
|
||||||
|
}, [](const auto &) {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}, [](const auto &) {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryItem::finishEditionToEmpty() {
|
void HistoryItem::finishEditionToEmpty() {
|
||||||
finishEdition(-1);
|
finishEdition(-1);
|
||||||
_history->itemVanished(this);
|
_history->itemVanished(this);
|
||||||
|
|
|
@ -553,6 +553,8 @@ public:
|
||||||
[[nodiscard]] bool canUpdateDate() const;
|
[[nodiscard]] bool canUpdateDate() const;
|
||||||
void customEmojiRepaint();
|
void customEmojiRepaint();
|
||||||
|
|
||||||
|
[[nodiscard]] bool needsUpdateForVideoQualities(const MTPMessage &data);
|
||||||
|
|
||||||
[[nodiscard]] TimeId ttlDestroyAt() const {
|
[[nodiscard]] TimeId ttlDestroyAt() const {
|
||||||
return _ttlDestroyAt;
|
return _ttlDestroyAt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue