mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Optimize emoji / stickers update requests.
This commit is contained in:
parent
4f7aa15416
commit
4cf4b6a368
15 changed files with 96 additions and 59 deletions
|
@ -2336,7 +2336,11 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||||
stickers.setsOrderRef() = std::move(result);
|
stickers.setsOrderRef() = std::move(result);
|
||||||
session().local().writeInstalledStickers();
|
session().local().writeInstalledStickers();
|
||||||
}
|
}
|
||||||
stickers.notifyUpdated();
|
stickers.notifyUpdated(isEmoji
|
||||||
|
? Data::StickersType::Emoji
|
||||||
|
: isMasks
|
||||||
|
? Data::StickersType::Masks
|
||||||
|
: Data::StickersType::Stickers);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
@ -1679,7 +1679,7 @@ void ApiWrap::saveStickerSets(
|
||||||
if (writeFaved) {
|
if (writeFaved) {
|
||||||
storage.writeFavedStickers();
|
storage.writeFavedStickers();
|
||||||
}
|
}
|
||||||
_session->data().stickers().notifyUpdated();
|
_session->data().stickers().notifyUpdated(type);
|
||||||
|
|
||||||
if (setDisenableRequests.empty()) {
|
if (setDisenableRequests.empty()) {
|
||||||
stickersSaveOrder();
|
stickersSaveOrder();
|
||||||
|
@ -2555,7 +2555,7 @@ void ApiWrap::setGroupStickerSet(
|
||||||
megagroup->inputChannel,
|
megagroup->inputChannel,
|
||||||
Data::InputStickerSet(set)
|
Data::InputStickerSet(set)
|
||||||
)).send();
|
)).send();
|
||||||
_session->data().stickers().notifyUpdated();
|
_session->data().stickers().notifyUpdated(Data::StickersType::Stickers);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<not_null<DocumentData*>> *ApiWrap::stickersByEmoji(
|
std::vector<not_null<DocumentData*>> *ApiWrap::stickersByEmoji(
|
||||||
|
@ -2595,7 +2595,8 @@ std::vector<not_null<DocumentData*>> *ApiWrap::stickersByEmoji(
|
||||||
}
|
}
|
||||||
entry.hash = data.vhash().v;
|
entry.hash = data.vhash().v;
|
||||||
entry.received = crl::now();
|
entry.received = crl::now();
|
||||||
_session->data().stickers().notifyUpdated();
|
_session->data().stickers().notifyUpdated(
|
||||||
|
Data::StickersType::Stickers);
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
if (it == _stickersByEmoji.end()) {
|
if (it == _stickersByEmoji.end()) {
|
||||||
|
@ -2864,7 +2865,8 @@ void ApiWrap::readFeaturedSets() {
|
||||||
MTP_vector<MTPlong>(wrappedIds));
|
MTP_vector<MTPlong>(wrappedIds));
|
||||||
request(std::move(requestData)).done([=] {
|
request(std::move(requestData)).done([=] {
|
||||||
local().writeFeaturedStickers();
|
local().writeFeaturedStickers();
|
||||||
_session->data().stickers().notifyUpdated();
|
_session->data().stickers().notifyUpdated(
|
||||||
|
Data::StickersType::Stickers);
|
||||||
}).send();
|
}).send();
|
||||||
|
|
||||||
_session->data().stickers().setFeaturedSetsUnreadCount(count);
|
_session->data().stickers().setFeaturedSetsUnreadCount(count);
|
||||||
|
|
|
@ -301,6 +301,7 @@ void StickerSetBox::prepare() {
|
||||||
object_ptr<Inner>(this, _controller, _set, _type),
|
object_ptr<Inner>(this, _controller, _set, _type),
|
||||||
st::stickersScroll);
|
st::stickersScroll);
|
||||||
_controller->session().data().stickers().updated(
|
_controller->session().data().stickers().updated(
|
||||||
|
_type
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
@ -369,7 +370,7 @@ void StickerSetBox::prepare() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_controller->session().data().stickers().notifyUpdated();
|
_controller->session().data().stickers().notifyUpdated(type);
|
||||||
|
|
||||||
closeBox();
|
closeBox();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
@ -785,7 +786,7 @@ void StickerSetBox::Inner::installDone(
|
||||||
} else {
|
} else {
|
||||||
storage.writeInstalledStickers();
|
storage.writeInstalledStickers();
|
||||||
}
|
}
|
||||||
stickers.notifyUpdated();
|
stickers.notifyUpdated(type);
|
||||||
}
|
}
|
||||||
_setInstalled.fire_copy(_setId);
|
_setInstalled.fire_copy(_setId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -619,9 +619,10 @@ void StickersBox::prepare() {
|
||||||
setDimensions(st::boxWideWidth, st::boxMaxListHeight);
|
setDimensions(st::boxWideWidth, st::boxMaxListHeight);
|
||||||
|
|
||||||
session().data().stickers().updated(
|
session().data().stickers().updated(
|
||||||
) | rpl::start_with_next(
|
_isMasks ? Data::StickersType::Masks : Data::StickersType::Stickers
|
||||||
[this] { handleStickersUpdated(); },
|
) | rpl::start_with_next([=] {
|
||||||
lifetime());
|
handleStickersUpdated();
|
||||||
|
}, lifetime());
|
||||||
session().api().updateStickers();
|
session().api().updateStickers();
|
||||||
session().api().updateMasks();
|
session().api().updateMasks();
|
||||||
|
|
||||||
|
@ -871,7 +872,8 @@ void StickersBox::installSet(uint64 setId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersBox::installDone(const MTPmessages_StickerSetInstallResult &result) {
|
void StickersBox::installDone(
|
||||||
|
const MTPmessages_StickerSetInstallResult &result) {
|
||||||
if (result.type() == mtpc_messages_stickerSetInstallResultArchive) {
|
if (result.type() == mtpc_messages_stickerSetInstallResultArchive) {
|
||||||
session().data().stickers().applyArchivedResult(
|
session().data().stickers().applyArchivedResult(
|
||||||
result.c_messages_stickerSetInstallResultArchive());
|
result.c_messages_stickerSetInstallResultArchive());
|
||||||
|
|
|
@ -393,6 +393,7 @@ EmojiListWidget::EmojiListWidget(
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
controller->session().data().stickers().updated(
|
controller->session().data().stickers().updated(
|
||||||
|
Data::StickersType::Emoji
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
refreshCustom();
|
refreshCustom();
|
||||||
resizeToWidth(width());
|
resizeToWidth(width());
|
||||||
|
@ -1372,6 +1373,7 @@ void EmojiListWidget::refreshCustom() {
|
||||||
|
|
||||||
_footer->refreshIcons(
|
_footer->refreshIcons(
|
||||||
fillIcons(),
|
fillIcons(),
|
||||||
|
currentSet(getVisibleTop()),
|
||||||
nullptr,
|
nullptr,
|
||||||
ValidateIconAnimations::None);
|
ValidateIconAnimations::None);
|
||||||
update();
|
update();
|
||||||
|
|
|
@ -643,7 +643,7 @@ void StickersListFooter::resizeEvent(QResizeEvent *e) {
|
||||||
if (_searchField) {
|
if (_searchField) {
|
||||||
resizeSearchControls();
|
resizeSearchControls();
|
||||||
}
|
}
|
||||||
refreshIconsGeometry(ValidateIconAnimations::None);
|
refreshIconsGeometry(_activeByScrollId, ValidateIconAnimations::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersListFooter::resizeSearchControls() {
|
void StickersListFooter::resizeSearchControls() {
|
||||||
|
@ -929,6 +929,7 @@ auto StickersListFooter::getLottieRenderer()
|
||||||
|
|
||||||
void StickersListFooter::refreshIcons(
|
void StickersListFooter::refreshIcons(
|
||||||
std::vector<StickerIcon> icons,
|
std::vector<StickerIcon> icons,
|
||||||
|
uint64 activeSetId,
|
||||||
Fn<std::shared_ptr<Lottie::FrameRenderer>()> renderer,
|
Fn<std::shared_ptr<Lottie::FrameRenderer>()> renderer,
|
||||||
ValidateIconAnimations animations) {
|
ValidateIconAnimations animations) {
|
||||||
_renderer = renderer
|
_renderer = renderer
|
||||||
|
@ -955,7 +956,7 @@ void StickersListFooter::refreshIcons(
|
||||||
}
|
}
|
||||||
|
|
||||||
_icons = std::move(icons);
|
_icons = std::move(icons);
|
||||||
refreshIconsGeometry(animations);
|
refreshIconsGeometry(activeSetId, animations);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersListFooter::refreshScrollableDimensions() {
|
void StickersListFooter::refreshScrollableDimensions() {
|
||||||
|
@ -969,6 +970,7 @@ void StickersListFooter::refreshScrollableDimensions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersListFooter::refreshIconsGeometry(
|
void StickersListFooter::refreshIconsGeometry(
|
||||||
|
uint64 activeSetId,
|
||||||
ValidateIconAnimations animations) {
|
ValidateIconAnimations animations) {
|
||||||
_selected = _pressed = SpecialOver::None;
|
_selected = _pressed = SpecialOver::None;
|
||||||
_iconState.x.finish();
|
_iconState.x.finish();
|
||||||
|
@ -990,11 +992,14 @@ void StickersListFooter::refreshIconsGeometry(
|
||||||
refreshScrollableDimensions();
|
refreshScrollableDimensions();
|
||||||
refreshSubiconsGeometry();
|
refreshSubiconsGeometry();
|
||||||
_iconState.selected = _subiconState.selected = -1;
|
_iconState.selected = _subiconState.selected = -1;
|
||||||
validateSelectedIcon(_activeByScrollId, animations);
|
validateSelectedIcon(activeSetId, animations);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersListFooter::refreshSubiconsGeometry() {
|
void StickersListFooter::refreshSubiconsGeometry() {
|
||||||
|
if (_barSelection) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
using Section = Ui::Emoji::Section;
|
using Section = Ui::Emoji::Section;
|
||||||
_subiconState.x.finish();
|
_subiconState.x.finish();
|
||||||
_subiconState.animationStart = 0;
|
_subiconState.animationStart = 0;
|
||||||
|
|
|
@ -92,6 +92,7 @@ public:
|
||||||
ValidateIconAnimations animations);
|
ValidateIconAnimations animations);
|
||||||
void refreshIcons(
|
void refreshIcons(
|
||||||
std::vector<StickerIcon> icons,
|
std::vector<StickerIcon> icons,
|
||||||
|
uint64 activeSetId,
|
||||||
Fn<std::shared_ptr<Lottie::FrameRenderer>()> renderer,
|
Fn<std::shared_ptr<Lottie::FrameRenderer>()> renderer,
|
||||||
ValidateIconAnimations animations);
|
ValidateIconAnimations animations);
|
||||||
[[nodiscard]] bool hasOnlyFeaturedSets() const;
|
[[nodiscard]] bool hasOnlyFeaturedSets() const;
|
||||||
|
@ -179,7 +180,9 @@ private:
|
||||||
void validateIconWebmAnimation(const StickerIcon &icon);
|
void validateIconWebmAnimation(const StickerIcon &icon);
|
||||||
void validateIconAnimation(const StickerIcon &icon);
|
void validateIconAnimation(const StickerIcon &icon);
|
||||||
|
|
||||||
void refreshIconsGeometry(ValidateIconAnimations animations);
|
void refreshIconsGeometry(
|
||||||
|
uint64 activeSetId,
|
||||||
|
ValidateIconAnimations animations);
|
||||||
void refreshSubiconsGeometry();
|
void refreshSubiconsGeometry();
|
||||||
void refreshScrollableDimensions();
|
void refreshScrollableDimensions();
|
||||||
void updateSelected();
|
void updateSelected();
|
||||||
|
|
|
@ -209,11 +209,8 @@ StickersListWidget::StickersListWidget(
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
session().data().stickers().recentUpdated(
|
session().data().stickers().recentUpdated(
|
||||||
) | rpl::start_with_next([=](Data::Stickers::Recent recent) {
|
_isMasks ? Data::StickersType::Masks : Data::StickersType::Stickers
|
||||||
const auto attached = (recent == Data::Stickers::Recent::Attached);
|
) | rpl::start_with_next([=] {
|
||||||
if (attached != _isMasks) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
refreshRecent();
|
refreshRecent();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
|
@ -2547,6 +2544,7 @@ void StickersListWidget::refreshIcons(ValidateIconAnimations animations) {
|
||||||
if (_footer) {
|
if (_footer) {
|
||||||
_footer->refreshIcons(
|
_footer->refreshIcons(
|
||||||
fillIcons(),
|
fillIcons(),
|
||||||
|
currentSet(getVisibleTop()),
|
||||||
[=] { return getLottieRenderer(); },
|
[=] { return getLottieRenderer(); },
|
||||||
animations);
|
animations);
|
||||||
}
|
}
|
||||||
|
@ -2725,7 +2723,9 @@ object_ptr<Ui::BoxContent> MakeConfirmRemoveSetBox(
|
||||||
if (removeIndex >= 0) {
|
if (removeIndex >= 0) {
|
||||||
orderRef.removeAt(removeIndex);
|
orderRef.removeAt(removeIndex);
|
||||||
}
|
}
|
||||||
if (set->flags & SetFlag::Masks) {
|
if (set->type() == Data::StickersType::Emoji) {
|
||||||
|
session->local().writeInstalledCustomEmoji();
|
||||||
|
} else if (set->type() == Data::StickersType::Masks) {
|
||||||
session->local().writeInstalledMasks();
|
session->local().writeInstalledMasks();
|
||||||
} else {
|
} else {
|
||||||
session->local().writeInstalledStickers();
|
session->local().writeInstalledStickers();
|
||||||
|
@ -2733,7 +2733,7 @@ object_ptr<Ui::BoxContent> MakeConfirmRemoveSetBox(
|
||||||
if (writeRecent) {
|
if (writeRecent) {
|
||||||
session->saveSettings();
|
session->saveSettings();
|
||||||
}
|
}
|
||||||
session->data().stickers().notifyUpdated();
|
session->data().stickers().notifyUpdated(set->type());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.cancelled = [=](Fn<void()> &&close) {
|
.cancelled = [=](Fn<void()> &&close) {
|
||||||
|
|
|
@ -399,7 +399,9 @@ TabbedSelector::TabbedSelector(
|
||||||
|
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
session().premiumPossibleValue() | rpl::to_empty,
|
session().premiumPossibleValue() | rpl::to_empty,
|
||||||
session().data().stickers().updated()
|
session().data().stickers().updated(hasMasksTab()
|
||||||
|
? Data::StickersType::Masks
|
||||||
|
: Data::StickersType::Stickers)
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
refreshStickers();
|
refreshStickers();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
|
@ -146,22 +146,32 @@ Main::Session &Stickers::session() const {
|
||||||
return _owner->session();
|
return _owner->session();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::notifyUpdated() {
|
void Stickers::notifyUpdated(StickersType type) {
|
||||||
_updated.fire({});
|
_updated.fire_copy(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<> Stickers::updated() const {
|
rpl::producer<StickersType> Stickers::updated() const {
|
||||||
return _updated.events();
|
return _updated.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::notifyRecentUpdated(Recent recent) {
|
rpl::producer<> Stickers::updated(StickersType type) const {
|
||||||
_recentUpdated.fire(std::move(recent));
|
using namespace rpl::mappers;
|
||||||
|
return updated() | rpl::filter(_1 == type) | rpl::to_empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<Stickers::Recent> Stickers::recentUpdated() const {
|
void Stickers::notifyRecentUpdated(StickersType type) {
|
||||||
|
_recentUpdated.fire_copy(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<StickersType> Stickers::recentUpdated() const {
|
||||||
return _recentUpdated.events();
|
return _recentUpdated.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<> Stickers::recentUpdated(StickersType type) const {
|
||||||
|
using namespace rpl::mappers;
|
||||||
|
return recentUpdated() | rpl::filter(_1 == type) | rpl::to_empty;
|
||||||
|
}
|
||||||
|
|
||||||
void Stickers::notifySavedGifsUpdated() {
|
void Stickers::notifySavedGifsUpdated() {
|
||||||
_savedGifsUpdated.fire({});
|
_savedGifsUpdated.fire({});
|
||||||
}
|
}
|
||||||
|
@ -297,7 +307,7 @@ void Stickers::incrementSticker(not_null<DocumentData*> document) {
|
||||||
if (writeRecentStickers) {
|
if (writeRecentStickers) {
|
||||||
session().local().writeRecentStickers();
|
session().local().writeRecentStickers();
|
||||||
}
|
}
|
||||||
notifyRecentUpdated();
|
notifyRecentUpdated(StickersType::Stickers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::addSavedGif(
|
void Stickers::addSavedGif(
|
||||||
|
@ -392,8 +402,12 @@ void Stickers::applyArchivedResult(
|
||||||
//Ui::show(
|
//Ui::show(
|
||||||
// Box<StickersBox>(archived, &session()),
|
// Box<StickersBox>(archived, &session()),
|
||||||
// Ui::LayerOption::KeepOther);
|
// Ui::LayerOption::KeepOther);
|
||||||
|
if (stickersCount) {
|
||||||
notifyUpdated();
|
notifyUpdated(StickersType::Stickers);
|
||||||
|
}
|
||||||
|
if (masksCount) {
|
||||||
|
notifyUpdated(StickersType::Masks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::installLocally(uint64 setId) {
|
void Stickers::installLocally(uint64 setId) {
|
||||||
|
@ -458,7 +472,7 @@ void Stickers::installLocally(uint64 setId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notifyUpdated();
|
notifyUpdated(set->type());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::undoInstallLocally(uint64 setId) {
|
void Stickers::undoInstallLocally(uint64 setId) {
|
||||||
|
@ -479,7 +493,7 @@ void Stickers::undoInstallLocally(uint64 setId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
session().local().writeInstalledStickers();
|
session().local().writeInstalledStickers();
|
||||||
notifyUpdated();
|
notifyUpdated(set->type());
|
||||||
|
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Ui::MakeInformBox(tr::lng_stickers_not_found()),
|
Ui::MakeInformBox(tr::lng_stickers_not_found()),
|
||||||
|
@ -592,7 +606,7 @@ void Stickers::setIsFaved(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
session().local().writeFavedStickers();
|
session().local().writeFavedStickers();
|
||||||
notifyUpdated();
|
notifyUpdated(StickersType::Stickers);
|
||||||
notifyStickerSetInstalled(FavedSetId);
|
notifyStickerSetInstalled(FavedSetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,13 +656,13 @@ void Stickers::requestSetToPushFaved(
|
||||||
void Stickers::removeFromRecentSet(not_null<DocumentData*> document) {
|
void Stickers::removeFromRecentSet(not_null<DocumentData*> document) {
|
||||||
RemoveFromSet(setsRef(), document, CloudRecentSetId);
|
RemoveFromSet(setsRef(), document, CloudRecentSetId);
|
||||||
session().local().writeRecentStickers();
|
session().local().writeRecentStickers();
|
||||||
notifyRecentUpdated();
|
notifyRecentUpdated(StickersType::Stickers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::setIsNotFaved(not_null<DocumentData*> document) {
|
void Stickers::setIsNotFaved(not_null<DocumentData*> document) {
|
||||||
RemoveFromSet(setsRef(), document, FavedSetId);
|
RemoveFromSet(setsRef(), document, FavedSetId);
|
||||||
session().local().writeFavedStickers();
|
session().local().writeFavedStickers();
|
||||||
notifyUpdated();
|
notifyUpdated(StickersType::Stickers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::setFaved(
|
void Stickers::setFaved(
|
||||||
|
@ -772,7 +786,7 @@ void Stickers::somethingReceived(
|
||||||
).arg(counted));
|
).arg(counted));
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyUpdated();
|
notifyUpdated(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::setPackAndEmoji(
|
void Stickers::setPackAndEmoji(
|
||||||
|
@ -925,7 +939,9 @@ void Stickers::specialSetReceived(
|
||||||
default: Unexpected("setId in SpecialSetReceived()");
|
default: Unexpected("setId in SpecialSetReceived()");
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyUpdated();
|
notifyUpdated((setId == CloudRecentAttachedSetId)
|
||||||
|
? StickersType::Masks
|
||||||
|
: StickersType::Stickers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::featuredSetsReceived(
|
void Stickers::featuredSetsReceived(
|
||||||
|
@ -1079,7 +1095,7 @@ void Stickers::featuredReceived(
|
||||||
session().local().writeFeaturedStickers();
|
session().local().writeFeaturedStickers();
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyUpdated();
|
notifyUpdated(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::gifsReceived(const QVector<MTPDocument> &items, uint64 hash) {
|
void Stickers::gifsReceived(const QVector<MTPDocument> &items, uint64 hash) {
|
||||||
|
@ -1501,7 +1517,7 @@ void Stickers::feedSetStickers(
|
||||||
session().local().writeArchivedStickers();
|
session().local().writeArchivedStickers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notifyUpdated();
|
notifyUpdated(set->type());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stickers::feedSetCovers(
|
void Stickers::feedSetCovers(
|
||||||
|
|
|
@ -60,15 +60,12 @@ public:
|
||||||
// For setting up megagroup sticker set.
|
// For setting up megagroup sticker set.
|
||||||
static constexpr auto MegagroupSetId = 0xFFFFFFFFFFFFFFEFULL;
|
static constexpr auto MegagroupSetId = 0xFFFFFFFFFFFFFFEFULL;
|
||||||
|
|
||||||
enum Recent {
|
void notifyUpdated(StickersType type);
|
||||||
Regular,
|
[[nodiscard]] rpl::producer<StickersType> updated() const;
|
||||||
Attached,
|
[[nodiscard]] rpl::producer<> updated(StickersType type) const;
|
||||||
};
|
void notifyRecentUpdated(StickersType type);
|
||||||
|
[[nodiscard]] rpl::producer<StickersType> recentUpdated() const;
|
||||||
void notifyUpdated();
|
[[nodiscard]] rpl::producer<> recentUpdated(StickersType type) const;
|
||||||
[[nodiscard]] rpl::producer<> updated() const;
|
|
||||||
void notifyRecentUpdated(Recent recent = Recent::Regular);
|
|
||||||
[[nodiscard]] rpl::producer<Recent> recentUpdated() const;
|
|
||||||
void notifySavedGifsUpdated();
|
void notifySavedGifsUpdated();
|
||||||
[[nodiscard]] rpl::producer<> savedGifsUpdated() const;
|
[[nodiscard]] rpl::producer<> savedGifsUpdated() const;
|
||||||
void notifyStickerSetInstalled(uint64 setId);
|
void notifyStickerSetInstalled(uint64 setId);
|
||||||
|
@ -89,7 +86,7 @@ public:
|
||||||
}
|
}
|
||||||
void setLastRecentUpdate(crl::time update) {
|
void setLastRecentUpdate(crl::time update) {
|
||||||
if (update) {
|
if (update) {
|
||||||
notifyRecentUpdated();
|
notifyRecentUpdated(StickersType::Stickers);
|
||||||
}
|
}
|
||||||
_lastRecentUpdate = update;
|
_lastRecentUpdate = update;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +107,7 @@ public:
|
||||||
}
|
}
|
||||||
void setLastRecentAttachedUpdate(crl::time update) {
|
void setLastRecentAttachedUpdate(crl::time update) {
|
||||||
if (update) {
|
if (update) {
|
||||||
notifyRecentUpdated(Recent::Attached);
|
notifyRecentUpdated(StickersType::Masks);
|
||||||
}
|
}
|
||||||
_lastRecentAttachedUpdate = update;
|
_lastRecentAttachedUpdate = update;
|
||||||
}
|
}
|
||||||
|
@ -293,8 +290,8 @@ private:
|
||||||
StickersType type);
|
StickersType type);
|
||||||
|
|
||||||
const not_null<Session*> _owner;
|
const not_null<Session*> _owner;
|
||||||
rpl::event_stream<> _updated;
|
rpl::event_stream<StickersType> _updated;
|
||||||
rpl::event_stream<Recent> _recentUpdated;
|
rpl::event_stream<StickersType> _recentUpdated;
|
||||||
rpl::event_stream<> _savedGifsUpdated;
|
rpl::event_stream<> _savedGifsUpdated;
|
||||||
rpl::event_stream<uint64> _stickerSetInstalled;
|
rpl::event_stream<uint64> _stickerSetInstalled;
|
||||||
rpl::event_stream<uint64> _emojiSetInstalled;
|
rpl::event_stream<uint64> _emojiSetInstalled;
|
||||||
|
|
|
@ -1335,6 +1335,7 @@ int HistoryWidget::itemTopForHighlight(
|
||||||
|
|
||||||
void HistoryWidget::start() {
|
void HistoryWidget::start() {
|
||||||
session().data().stickers().updated(
|
session().data().stickers().updated(
|
||||||
|
Data::StickersType::Stickers
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
updateStickersByEmoji();
|
updateStickersByEmoji();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
|
@ -1531,6 +1531,7 @@ void ComposeControls::initAutocomplete() {
|
||||||
}, _autocomplete->lifetime());
|
}, _autocomplete->lifetime());
|
||||||
|
|
||||||
_window->session().data().stickers().updated(
|
_window->session().data().stickers().updated(
|
||||||
|
Data::StickersType::Stickers
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
updateStickersByEmoji();
|
updateStickersByEmoji();
|
||||||
}, _autocomplete->lifetime());
|
}, _autocomplete->lifetime());
|
||||||
|
|
|
@ -164,7 +164,9 @@ Session::Session(
|
||||||
local().readRecentMasks();
|
local().readRecentMasks();
|
||||||
local().readFavedStickers();
|
local().readFavedStickers();
|
||||||
local().readSavedGifs();
|
local().readSavedGifs();
|
||||||
data().stickers().notifyUpdated();
|
data().stickers().notifyUpdated(Data::StickersType::Stickers);
|
||||||
|
data().stickers().notifyUpdated(Data::StickersType::Masks);
|
||||||
|
data().stickers().notifyUpdated(Data::StickersType::Emoji);
|
||||||
data().stickers().notifySavedGifsUpdated();
|
data().stickers().notifySavedGifsUpdated();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -577,11 +577,10 @@ void AppendEmojiPacks(
|
||||||
|
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
_session->data().stickers().updated(),
|
_session->data().stickers().updated(
|
||||||
|
Data::StickersType::Stickers),
|
||||||
_session->data().stickers().recentUpdated(
|
_session->data().stickers().recentUpdated(
|
||||||
) | rpl::filter([](Data::Stickers::Recent recent) {
|
Data::StickersType::Stickers)
|
||||||
return (recent != Data::Stickers::Recent::Attached);
|
|
||||||
}) | rpl::to_empty
|
|
||||||
) | rpl::map_to(ScrubberItemType::Sticker),
|
) | rpl::map_to(ScrubberItemType::Sticker),
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
Core::App().settings().recentEmojiUpdated(),
|
Core::App().settings().recentEmojiUpdated(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue