Simplify stickers inner API.

This commit is contained in:
John Preston 2022-08-15 11:33:24 +03:00
parent 94e4a8981f
commit fede1ff173
6 changed files with 12 additions and 12 deletions

View file

@ -41,7 +41,7 @@ void AttachedStickers::request(
return;
} else if (result.v.size() > 1) {
strongController->show(
Box<StickersBox>(strongController, result));
Box<StickersBox>(strongController, result.v));
return;
}
// Single attached sticker pack.

View file

@ -416,7 +416,7 @@ StickersBox::StickersBox(
StickersBox::StickersBox(
QWidget*,
not_null<Window::SessionController*> controller,
const MTPVector<MTPStickerSetCovered> &attachedSets)
const QVector<MTPStickerSetCovered> &attachedSets)
: _controller(controller)
, _api(&controller->session().mtp())
, _section(Section::Attached)
@ -460,8 +460,8 @@ void StickersBox::showAttachedStickers() {
}
}
};
for (const auto &set : _attachedSets.v) {
add(stickers->feedSetCovered(set));
for (const auto &set : _attachedSets) {
add(stickers->feedSet(set));
}
for (const auto &setId : _emojiSets) {
const auto i = stickers->sets().find(setId.id);
@ -501,7 +501,7 @@ void StickersBox::getArchivedDone(
auto addedSet = false;
auto changedSets = false;
for (const auto &data : stickers.vsets().v) {
const auto set = session().data().stickers().feedSetCovered(data);
const auto set = session().data().stickers().feedSet(data);
const auto index = archived.indexOf(set->id);
if (archived.isEmpty() || index != archived.size() - 1) {
changedSets = true;

View file

@ -70,7 +70,7 @@ public:
StickersBox(
QWidget*,
not_null<Window::SessionController*> controller,
const MTPVector<MTPStickerSetCovered> &attachedSets);
const QVector<MTPStickerSetCovered> &attachedSets);
StickersBox(
QWidget*,
not_null<Window::SessionController*> controller,
@ -164,7 +164,7 @@ private:
Tab *_tab = nullptr;
const Data::StickersType _attachedType = {};
const MTPVector<MTPStickerSetCovered> _attachedSets;
const QVector<MTPStickerSetCovered> _attachedSets;
const std::vector<StickerSetIdentifier> _emojiSets;
ChannelData *_megagroupSet = nullptr;

View file

@ -346,7 +346,7 @@ void StickersListWidget::preloadMoreOfficial() {
const auto &list = data.vsets().v;
_officialOffset += list.size();
for (int i = 0, l = list.size(); i != l; ++i) {
const auto set = session().data().stickers().feedSetCovered(
const auto set = session().data().stickers().feedSet(
list[i]);
if (set->stickers.empty() && set->covers.empty()) {
continue;
@ -763,7 +763,7 @@ void StickersListWidget::searchResultsDone(
}
auto &d = result.c_messages_foundStickerSets();
for (const auto &data : d.vsets().v) {
const auto set = session().data().stickers().feedSetCovered(data);
const auto set = session().data().stickers().feedSet(data);
if (set->stickers.empty() && set->covers.empty()) {
continue;
}

View file

@ -364,7 +364,7 @@ void Stickers::applyArchivedResult(
auto masksCount = 0;
auto stickersCount = 0;
for (const auto &data : v) {
const auto set = feedSetCovered(data);
const auto set = feedSet(data);
if (set->flags & SetFlag::NotLoaded) {
setsToRequest.insert(set->id, set->accessHash);
}
@ -1454,7 +1454,7 @@ not_null<StickersSet*> Stickers::feedSetFull(
return set;
}
not_null<StickersSet*> Stickers::feedSetCovered(
not_null<StickersSet*> Stickers::feedSet(
const MTPStickerSetCovered &data) {
const auto set = data.match([&](const auto &data) {
return feedSet(data.vset());

View file

@ -237,8 +237,8 @@ public:
not_null<DocumentData*> document);
not_null<StickersSet*> feedSet(const MTPStickerSet &data);
not_null<StickersSet*> feedSet(const MTPStickerSetCovered &data);
not_null<StickersSet*> feedSetFull(const MTPDmessages_stickerSet &data);
not_null<StickersSet*> feedSetCovered(const MTPStickerSetCovered &data);
void feedSetStickers(
not_null<StickersSet*> set,
const QVector<MTPDocument> &documents,