Added local event for recent joined chats.

This commit is contained in:
23rd
2025-11-01 16:00:03 +03:00
parent 581ec70bf3
commit 679c932697
3 changed files with 22 additions and 0 deletions
+5
View File
@@ -1740,6 +1740,11 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
)).done([=](const MTPUpdates &result) {
_channelAmInRequests.remove(channel);
applyUpdates(result);
session().data().addRecentJoinChat({
.fromPeerId = channel->id,
.joinedPeerId = channel->id,
});
}).fail([=](const MTP::Error &error) {
const auto &type = error.type();
@@ -5299,6 +5299,14 @@ rpl::producer<RecentSelfForwards> Session::recentSelfForwards() const {
return _recentSelfForwards.events();
}
void Session::addRecentJoinChat(const RecentJoinChat &data) {
_recentJoinChat.fire_copy(data);
}
rpl::producer<RecentJoinChat> Session::recentJoinChat() const {
return _recentJoinChat.events();
}
void Session::clearLocalStorage() {
_cache->close();
_cache->clear();
+9
View File
@@ -126,6 +126,11 @@ struct RecentSelfForwards {
MessageIdsList ids;
};
struct RecentJoinChat {
PeerId fromPeerId = 0;
PeerId joinedPeerId = 0;
};
class Session final {
public:
using ViewElement = HistoryView::Element;
@@ -895,6 +900,9 @@ public:
void addRecentSelfForwards(const RecentSelfForwards &data);
[[nodiscard]] rpl::producer<RecentSelfForwards> recentSelfForwards() const;
void addRecentJoinChat(const RecentJoinChat &data);
[[nodiscard]] rpl::producer<RecentJoinChat> recentJoinChat() const;
void clearLocalStorage();
private:
@@ -1264,6 +1272,7 @@ private:
NextToUpgradeGift> _nextForUpgradeGifts;
rpl::event_stream<RecentSelfForwards> _recentSelfForwards;
rpl::event_stream<RecentJoinChat> _recentJoinChat;
rpl::lifetime _lifetime;