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

Don't store MTPInputStickerSet in data.

This commit is contained in:
John Preston
2021-07-08 19:42:57 +03:00
parent 9dfb43d525
commit 75090dedaa
23 changed files with 152 additions and 119 deletions

View File

@@ -80,6 +80,13 @@ MTPInputStickerSet StickersSet::mtpInput() const {
: MTP_inputStickerSetShortName(MTP_string(shortName));
}
StickerSetIdentifier StickersSet::identifier() const {
return StickerSetIdentifier{
.id = id,
.accessHash = access,
};
}
void StickersSet::setThumbnail(const ImageWithLocation &data) {
Data::UpdateCloudFile(
_thumbnail,
@@ -154,4 +161,25 @@ std::shared_ptr<StickersSetThumbnailView> StickersSet::activeThumbnailView() {
return _thumbnailView.lock();
}
MTPInputStickerSet InputStickerSet(StickerSetIdentifier id) {
return !id
? MTP_inputStickerSetEmpty()
: id.id
? MTP_inputStickerSetID(MTP_long(id.id), MTP_long(id.accessHash))
: MTP_inputStickerSetShortName(MTP_string(id.shortName));
}
StickerSetIdentifier FromInputSet(const MTPInputStickerSet &id) {
return id.match([](const MTPDinputStickerSetID &data) {
return StickerSetIdentifier{
.id = data.vid().v,
.accessHash = data.vaccess_hash().v,
};
}, [](const MTPDinputStickerSetShortName &data) {
return StickerSetIdentifier{ .shortName = qs(data.vshort_name()) };
}, [](const auto &) {
return StickerSetIdentifier();
});
}
} // namespace Stickers