Reload stories from viewed messages once in 5 minutes.
This commit is contained in:
parent
ebac96e7ec
commit
04c4e932fe
@ -20102,6 +20102,11 @@ Status MessagesManager::view_messages(DialogId dialog_id, vector<MessageId> mess
|
||||
}
|
||||
}
|
||||
|
||||
auto story_full_id = get_message_content_story_full_id(td_, m->content.get());
|
||||
if (story_full_id.is_valid()) {
|
||||
td_->story_manager_->view_story_message(story_full_id);
|
||||
}
|
||||
|
||||
if (m->message_id.is_server() && d->open_count > 0) {
|
||||
auto &info = dialog_viewed_messages_[dialog_id];
|
||||
if (info == nullptr) {
|
||||
|
@ -1078,6 +1078,17 @@ void StoryManager::close_story(DialogId owner_dialog_id, StoryId story_id, Promi
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
||||
void StoryManager::view_story_message(StoryFullId story_full_id) {
|
||||
const Story *story = get_story(story_full_id);
|
||||
if (story == nullptr || !story_full_id.get_story_id().is_server()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (story->receive_date_ < G()->unix_time() - VIEWED_STORY_POLL_PERIOD) {
|
||||
reload_story(story_full_id, Promise<Unit>());
|
||||
}
|
||||
}
|
||||
|
||||
void StoryManager::schedule_interaction_info_update() {
|
||||
if (interaction_info_update_timeout_.has_timeout()) {
|
||||
return;
|
||||
|
@ -131,6 +131,8 @@ class StoryManager final : public Actor {
|
||||
|
||||
void close_story(DialogId owner_dialog_id, StoryId story_id, Promise<Unit> &&promise);
|
||||
|
||||
void view_story_message(StoryFullId story_full_id);
|
||||
|
||||
void get_story_viewers(StoryId story_id, const td_api::messageViewer *offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::messageViewers>> &&promise);
|
||||
|
||||
@ -190,6 +192,7 @@ class StoryManager final : public Actor {
|
||||
class ReadStoriesOnServerLogEvent;
|
||||
|
||||
static constexpr int32 OPENED_STORY_POLL_PERIOD = 60;
|
||||
static constexpr int32 VIEWED_STORY_POLL_PERIOD = 300;
|
||||
|
||||
void start_up() final;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user