diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index c31b8c6d7..dfb94ef59 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -341,12 +341,6 @@ public: not_null 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 _fullPeerUpdated; - rpl::event_stream _stickerSetInstalled; - mtpRequestId _topPromotionRequestId = 0; std::pair _topPromotionKey; TimeId _topPromotionNextRequestTime = TimeId(0); diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index 947bca49b..a34986e64 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -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()); diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index eb109dcc3..dd70870c2 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -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); } } diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp index 6459dc81c..8c6564495 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp @@ -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({}); diff --git a/Telegram/SourceFiles/data/stickers/data_stickers.cpp b/Telegram/SourceFiles/data/stickers/data_stickers.cpp index d8c7b159c..1e310792b 100644 --- a/Telegram/SourceFiles/data/stickers/data_stickers.cpp +++ b/Telegram/SourceFiles/data/stickers/data_stickers.cpp @@ -102,6 +102,14 @@ rpl::producer<> Stickers::savedGifsUpdated() const { return _savedGifsUpdated.events(); } +void Stickers::notifyStickerSetInstalled(uint64 setId) { + _stickerSetInstalled.fire(std::move(setId)); +} + +rpl::producer Stickers::stickerSetInstalled() const { + return _stickerSetInstalled.events(); +} + // Increment attached sticker. void Stickers::incrementSticker(not_null 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 document) { diff --git a/Telegram/SourceFiles/data/stickers/data_stickers.h b/Telegram/SourceFiles/data/stickers/data_stickers.h index 55699c4fa..8f040ae3f 100644 --- a/Telegram/SourceFiles/data/stickers/data_stickers.h +++ b/Telegram/SourceFiles/data/stickers/data_stickers.h @@ -60,6 +60,8 @@ public: [[nodiscard]] rpl::producer recentUpdated() const; void notifySavedGifsUpdated(); [[nodiscard]] rpl::producer<> savedGifsUpdated() const; + void notifyStickerSetInstalled(uint64 setId); + [[nodiscard]] rpl::producer stickerSetInstalled() const; void incrementSticker(not_null document); @@ -225,6 +227,7 @@ private: rpl::event_stream<> _updated; rpl::event_stream _recentUpdated; rpl::event_stream<> _savedGifsUpdated; + rpl::event_stream _stickerSetInstalled; crl::time _lastUpdate = 0; crl::time _lastRecentUpdate = 0; crl::time _lastFavedUpdate = 0;