mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Added local event for recent joined chats.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user