2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Notify about feed channels list changes.

This commit is contained in:
John Preston
2018-01-29 16:52:09 +03:00
parent 3a5a002be2
commit 366ea1edc3
8 changed files with 87 additions and 8 deletions

View File

@@ -327,6 +327,16 @@ rpl::producer<not_null<UserData*>> Session::megagroupParticipantAdded(
});
}
void Session::notifyFeedUpdated(
not_null<Feed*> feed,
FeedUpdateFlag update) {
_feedUpdates.fire({ feed, update });
}
rpl::producer<FeedUpdate> Session::feedUpdated() const {
return _feedUpdates.events();
}
void Session::notifyStickersUpdated() {
_stickersUpdated.fire({});
}
@@ -1422,17 +1432,17 @@ void Session::unregisterItemView(not_null<ViewElement*> view) {
}
}
not_null<Data::Feed*> Session::feed(FeedId id) {
not_null<Feed*> Session::feed(FeedId id) {
if (const auto result = feedLoaded(id)) {
return result;
}
const auto [it, ok] = _feeds.emplace(
id,
std::make_unique<Data::Feed>(id, this));
std::make_unique<Feed>(id, this));
return it->second.get();
}
Data::Feed *Session::feedLoaded(FeedId id) {
Feed *Session::feedLoaded(FeedId id) {
const auto it = _feeds.find(id);
return (it == end(_feeds)) ? nullptr : it->second.get();
}