2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 00:46:08 +00:00

Track stories deletion and refresh views.

This commit is contained in:
John Preston
2023-06-30 11:48:18 +04:00
parent 1d5b57c39c
commit 074a4e3c92
6 changed files with 64 additions and 6 deletions

View File

@@ -3881,6 +3881,33 @@ void Session::destroyAllCallItems() {
}
}
void Session::registerStoryItem(
FullStoryId id,
not_null<HistoryItem*> item) {
_storyItems[id].emplace(item);
}
void Session::unregisterStoryItem(
FullStoryId id,
not_null<HistoryItem*> item) {
const auto i = _storyItems.find(id);
if (i != _storyItems.end()) {
auto &items = i->second;
if (items.remove(item) && items.empty()) {
_storyItems.erase(i);
}
}
}
void Session::refreshStoryItemViews(FullStoryId id) {
const auto i = _storyItems.find(id);
if (i != _storyItems.end()) {
for (const auto item : i->second) {
requestItemViewRefresh(item);
}
}
}
void Session::documentMessageRemoved(not_null<DocumentData*> document) {
if (_documentItems.find(document) != _documentItems.end()) {
return;