mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Simplify stickers inner API.
This commit is contained in:
parent
94e4a8981f
commit
fede1ff173
6 changed files with 12 additions and 12 deletions
|
@ -41,7 +41,7 @@ void AttachedStickers::request(
|
||||||
return;
|
return;
|
||||||
} else if (result.v.size() > 1) {
|
} else if (result.v.size() > 1) {
|
||||||
strongController->show(
|
strongController->show(
|
||||||
Box<StickersBox>(strongController, result));
|
Box<StickersBox>(strongController, result.v));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Single attached sticker pack.
|
// Single attached sticker pack.
|
||||||
|
|
|
@ -416,7 +416,7 @@ StickersBox::StickersBox(
|
||||||
StickersBox::StickersBox(
|
StickersBox::StickersBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
const MTPVector<MTPStickerSetCovered> &attachedSets)
|
const QVector<MTPStickerSetCovered> &attachedSets)
|
||||||
: _controller(controller)
|
: _controller(controller)
|
||||||
, _api(&controller->session().mtp())
|
, _api(&controller->session().mtp())
|
||||||
, _section(Section::Attached)
|
, _section(Section::Attached)
|
||||||
|
@ -460,8 +460,8 @@ void StickersBox::showAttachedStickers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (const auto &set : _attachedSets.v) {
|
for (const auto &set : _attachedSets) {
|
||||||
add(stickers->feedSetCovered(set));
|
add(stickers->feedSet(set));
|
||||||
}
|
}
|
||||||
for (const auto &setId : _emojiSets) {
|
for (const auto &setId : _emojiSets) {
|
||||||
const auto i = stickers->sets().find(setId.id);
|
const auto i = stickers->sets().find(setId.id);
|
||||||
|
@ -501,7 +501,7 @@ void StickersBox::getArchivedDone(
|
||||||
auto addedSet = false;
|
auto addedSet = false;
|
||||||
auto changedSets = false;
|
auto changedSets = false;
|
||||||
for (const auto &data : stickers.vsets().v) {
|
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);
|
const auto index = archived.indexOf(set->id);
|
||||||
if (archived.isEmpty() || index != archived.size() - 1) {
|
if (archived.isEmpty() || index != archived.size() - 1) {
|
||||||
changedSets = true;
|
changedSets = true;
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
StickersBox(
|
StickersBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
const MTPVector<MTPStickerSetCovered> &attachedSets);
|
const QVector<MTPStickerSetCovered> &attachedSets);
|
||||||
StickersBox(
|
StickersBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
|
@ -164,7 +164,7 @@ private:
|
||||||
Tab *_tab = nullptr;
|
Tab *_tab = nullptr;
|
||||||
|
|
||||||
const Data::StickersType _attachedType = {};
|
const Data::StickersType _attachedType = {};
|
||||||
const MTPVector<MTPStickerSetCovered> _attachedSets;
|
const QVector<MTPStickerSetCovered> _attachedSets;
|
||||||
const std::vector<StickerSetIdentifier> _emojiSets;
|
const std::vector<StickerSetIdentifier> _emojiSets;
|
||||||
|
|
||||||
ChannelData *_megagroupSet = nullptr;
|
ChannelData *_megagroupSet = nullptr;
|
||||||
|
|
|
@ -346,7 +346,7 @@ void StickersListWidget::preloadMoreOfficial() {
|
||||||
const auto &list = data.vsets().v;
|
const auto &list = data.vsets().v;
|
||||||
_officialOffset += list.size();
|
_officialOffset += list.size();
|
||||||
for (int i = 0, l = list.size(); i != l; ++i) {
|
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]);
|
list[i]);
|
||||||
if (set->stickers.empty() && set->covers.empty()) {
|
if (set->stickers.empty() && set->covers.empty()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -763,7 +763,7 @@ void StickersListWidget::searchResultsDone(
|
||||||
}
|
}
|
||||||
auto &d = result.c_messages_foundStickerSets();
|
auto &d = result.c_messages_foundStickerSets();
|
||||||
for (const auto &data : d.vsets().v) {
|
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()) {
|
if (set->stickers.empty() && set->covers.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,7 +364,7 @@ void Stickers::applyArchivedResult(
|
||||||
auto masksCount = 0;
|
auto masksCount = 0;
|
||||||
auto stickersCount = 0;
|
auto stickersCount = 0;
|
||||||
for (const auto &data : v) {
|
for (const auto &data : v) {
|
||||||
const auto set = feedSetCovered(data);
|
const auto set = feedSet(data);
|
||||||
if (set->flags & SetFlag::NotLoaded) {
|
if (set->flags & SetFlag::NotLoaded) {
|
||||||
setsToRequest.insert(set->id, set->accessHash);
|
setsToRequest.insert(set->id, set->accessHash);
|
||||||
}
|
}
|
||||||
|
@ -1454,7 +1454,7 @@ not_null<StickersSet*> Stickers::feedSetFull(
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
not_null<StickersSet*> Stickers::feedSetCovered(
|
not_null<StickersSet*> Stickers::feedSet(
|
||||||
const MTPStickerSetCovered &data) {
|
const MTPStickerSetCovered &data) {
|
||||||
const auto set = data.match([&](const auto &data) {
|
const auto set = data.match([&](const auto &data) {
|
||||||
return feedSet(data.vset());
|
return feedSet(data.vset());
|
||||||
|
|
|
@ -237,8 +237,8 @@ public:
|
||||||
not_null<DocumentData*> document);
|
not_null<DocumentData*> document);
|
||||||
|
|
||||||
not_null<StickersSet*> feedSet(const MTPStickerSet &data);
|
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*> feedSetFull(const MTPDmessages_stickerSet &data);
|
||||||
not_null<StickersSet*> feedSetCovered(const MTPStickerSetCovered &data);
|
|
||||||
void feedSetStickers(
|
void feedSetStickers(
|
||||||
not_null<StickersSet*> set,
|
not_null<StickersSet*> set,
|
||||||
const QVector<MTPDocument> &documents,
|
const QVector<MTPDocument> &documents,
|
||||||
|
|
Loading…
Add table
Reference in a new issue