2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Use both thumbnails in photos and documents.

Fixes #5602.
This commit is contained in:
John Preston
2019-01-25 18:37:28 +04:00
parent a70e72f75d
commit a1baa23a52
56 changed files with 1358 additions and 878 deletions

View File

@@ -110,8 +110,8 @@ std::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
message = &r.vsend_message;
} break;
}
auto badAttachment = (result->_photo && result->_photo->full->isNull())
|| (result->_document && !result->_document->isValid());
auto badAttachment = (result->_photo && result->_photo->isNull())
|| (result->_document && result->_document->isNull());
if (!message) {
return nullptr;
@@ -246,11 +246,10 @@ std::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
bool Result::onChoose(Layout::ItemBase *layout) {
if (_photo && _type == Type::Photo) {
if (_photo->medium->loaded() || _photo->thumb->loaded()) {
if (_photo->thumbnail()->loaded()) {
return true;
} else if (!_photo->medium->loading()) {
_photo->thumb->loadEvenCancelled(Data::FileOrigin());
_photo->medium->loadEvenCancelled(Data::FileOrigin());
} else if (!_photo->thumbnail()->loading()) {
_photo->thumbnail()->loadEvenCancelled(Data::FileOrigin());
}
return false;
}