Moved stickerSetInstalled from ApiWrap to Data::Stickers.

This commit is contained in:
23rd 2021-03-30 01:28:19 +03:00
parent 7e04bf9533
commit 8d62800e77
6 changed files with 18 additions and 13 deletions

View file

@ -341,12 +341,6 @@ public:
not_null<UserData*> user,
PhotoId afterId);
void stickerSetInstalled(uint64 setId) {
_stickerSetInstalled.fire_copy(setId);
}
auto stickerSetInstalled() const {
return _stickerSetInstalled.events();
}
void readFeaturedSetDelayed(uint64 setId);
void parseChannelParticipants(
@ -736,8 +730,6 @@ private:
base::Observable<PeerData*> _fullPeerUpdated;
rpl::event_stream<uint64> _stickerSetInstalled;
mtpRequestId _topPromotionRequestId = 0;
std::pair<QString, uint32> _topPromotionKey;
TimeId _topPromotionNextRequestTime = TimeId(0);

View file

@ -192,7 +192,8 @@ void StickerSetBox::prepare() {
if (_inner->isMasksSet()) {
Ui::Toast::Show(tr::lng_masks_installed(tr::now));
} else {
_controller->session().api().stickerSetInstalled(setId);
auto &stickers = _controller->session().data().stickers();
stickers.notifyStickerSetInstalled(setId);
}
closeBox();
}, lifetime());

View file

@ -1691,7 +1691,8 @@ void StickersBox::Inner::saveGroupSet() {
: 0;
if (newId != oldId) {
session().api().setGroupStickerSet(_megagroupSet, _megagroupSetInput);
session().api().stickerSetInstalled(Data::Stickers::MegagroupSetId);
session().data().stickers().notifyStickerSetInstalled(
Data::Stickers::MegagroupSetId);
}
}

View file

@ -388,8 +388,8 @@ TabbedSelector::TabbedSelector(
}
if (hasStickersTab()) {
session().api().stickerSetInstalled(
) | rpl::start_with_next([this](uint64 setId) {
session().data().stickers().stickerSetInstalled(
) | rpl::start_with_next([=](uint64 setId) {
_tabsSlider->setActiveSection(indexByType(SelectorTab::Stickers));
stickers()->showStickerSet(setId);
_showRequests.fire({});

View file

@ -102,6 +102,14 @@ rpl::producer<> Stickers::savedGifsUpdated() const {
return _savedGifsUpdated.events();
}
void Stickers::notifyStickerSetInstalled(uint64 setId) {
_stickerSetInstalled.fire(std::move(setId));
}
rpl::producer<uint64> Stickers::stickerSetInstalled() const {
return _stickerSetInstalled.events();
}
// Increment attached sticker.
void Stickers::incrementSticker(not_null<DocumentData*> document) {
if (!document->sticker()
@ -513,7 +521,7 @@ void Stickers::setIsFaved(
}
session().local().writeFavedStickers();
notifyUpdated();
session().api().stickerSetInstalled(FavedSetId);
notifyStickerSetInstalled(FavedSetId);
}
void Stickers::requestSetToPushFaved(not_null<DocumentData*> document) {

View file

@ -60,6 +60,8 @@ public:
[[nodiscard]] rpl::producer<Recent> recentUpdated() const;
void notifySavedGifsUpdated();
[[nodiscard]] rpl::producer<> savedGifsUpdated() const;
void notifyStickerSetInstalled(uint64 setId);
[[nodiscard]] rpl::producer<uint64> stickerSetInstalled() const;
void incrementSticker(not_null<DocumentData*> document);
@ -225,6 +227,7 @@ private:
rpl::event_stream<> _updated;
rpl::event_stream<Recent> _recentUpdated;
rpl::event_stream<> _savedGifsUpdated;
rpl::event_stream<uint64> _stickerSetInstalled;
crl::time _lastUpdate = 0;
crl::time _lastRecentUpdate = 0;
crl::time _lastFavedUpdate = 0;