mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Improve video userpics in chat history.
This commit is contained in:
@@ -309,6 +309,18 @@ bool ShouldAutoPlay(
|
||||
document->size);
|
||||
}
|
||||
|
||||
bool ShouldAutoPlay(
|
||||
const Full &data,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<PhotoData*> photo) {
|
||||
const auto source = SourceFromPeer(peer);
|
||||
const auto size = photo->videoByteSize();
|
||||
return photo->hasVideo()
|
||||
&& (data.shouldDownload(source, Type::AutoPlayGIF, size)
|
||||
|| data.shouldDownload(source, Type::AutoPlayVideo, size)
|
||||
|| data.shouldDownload(source, Type::AutoPlayVideoMessage, size));
|
||||
}
|
||||
|
||||
Full WithDisabledAutoPlay(const Full &data) {
|
||||
auto result = data;
|
||||
for (const auto source : enums_view<Source>(kSourcesCount)) {
|
||||
|
@@ -120,6 +120,10 @@ private:
|
||||
const Full &data,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<DocumentData*> document);
|
||||
[[nodiscard]] bool ShouldAutoPlay(
|
||||
const Full &data,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<PhotoData*> photo);
|
||||
|
||||
[[nodiscard]] Full WithDisabledAutoPlay(const Full &data);
|
||||
|
||||
|
@@ -3208,6 +3208,10 @@ void Session::checkPlayingAnimations() {
|
||||
if (document->isAnimation() || document->isVideoFile()) {
|
||||
check.emplace(view);
|
||||
}
|
||||
} else if (const auto photo = media->getPhoto()) {
|
||||
if (photo->hasVideo()) {
|
||||
check.emplace(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user