2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Update API scheme.

This commit is contained in:
John Preston
2020-12-13 23:27:51 +04:00
parent 7217d14f09
commit 2b91eedcd4
4 changed files with 51 additions and 24 deletions

View File

@@ -321,7 +321,7 @@ bool Stickers::applyArchivedResultFake() {
MTP_long(raw->access),
MTP_string(raw->title),
MTP_string(raw->shortName),
MTP_photoSizeEmpty(MTP_string()),
MTP_vector<MTPPhotoSize>(),
MTP_int(0),
MTP_int(raw->count),
MTP_int(raw->hash));
@@ -814,10 +814,20 @@ void Stickers::featuredSetsReceived(
auto it = sets.find(data->vid().v);
const auto title = getSetTitle(*data);
const auto installDate = data->vinstalled_date().value_or_empty();
const auto thumb = data->vthumb();
const auto thumbnail = thumb
? Images::FromPhotoSize(&session(), *data, *thumb)
: ImageWithLocation();
const auto thumbnail = [&] {
if (const auto thumbs = data->vthumbs()) {
for (const auto &thumb : thumbs->v) {
const auto result = Images::FromPhotoSize(
&session(),
*data,
thumb);
if (result.location.valid()) {
return result;
}
}
}
return ImageWithLocation();
}();
if (it == sets.cend()) {
auto setClientFlags = MTPDstickerSet_ClientFlag::f_featured
| MTPDstickerSet_ClientFlag::f_not_loaded;
@@ -1126,10 +1136,20 @@ StickersSet *Stickers::feedSet(const MTPDstickerSet &data) {
auto it = sets.find(data.vid().v);
auto title = getSetTitle(data);
auto flags = MTPDstickerSet::Flags(0);
const auto thumb = data.vthumb();
const auto thumbnail = thumb
? Images::FromPhotoSize(&session(), data, *thumb)
: ImageWithLocation();
const auto thumbnail = [&] {
if (const auto thumbs = data.vthumbs()) {
for (const auto &thumb : thumbs->v) {
const auto result = Images::FromPhotoSize(
&session(),
data,
thumb);
if (result.location.valid()) {
return result;
}
}
}
return ImageWithLocation();
}();
if (it == sets.cend()) {
it = sets.emplace(data.vid().v, std::make_unique<StickersSet>(
&owner(),