Reload active story lists by timeout.

This commit is contained in:
levlam 2023-07-06 18:22:20 +03:00
parent aff810db0d
commit 25c73f32f5
3 changed files with 15 additions and 1 deletions

View File

@ -990,9 +990,12 @@ void StoryManager::load_active_stories(const td_api::object_ptr<td_api::StoryLis
if (story_list.list_last_story_date_ == MAX_DIALOG_DATE) {
return promise.set_error(Status::Error(404, "Not found"));
}
load_active_stories(story_list, is_hidden, !story_list.state_.empty(), std::move(promise));
}
void StoryManager::load_active_stories(StoryList &story_list, bool is_hidden, bool is_next, Promise<Unit> &&promise) {
story_list.load_list_queries_.push_back(std::move(promise));
if (story_list.load_list_queries_.size() == 1u) {
bool is_next = !story_list.state_.empty();
auto query_promise =
PromiseCreator::lambda([actor_id = actor_id(this), is_hidden, is_next](
Result<telegram_api::object_ptr<telegram_api::stories_AllStories>> r_all_stories) {
@ -1002,6 +1005,12 @@ void StoryManager::load_active_stories(const td_api::object_ptr<td_api::StoryLis
}
}
void StoryManager::reload_active_stories() {
for (int is_hidden = 0; is_hidden < 2; is_hidden++) {
load_active_stories(story_lists_[is_hidden], is_hidden != 0, false, Promise<Unit>());
}
}
void StoryManager::on_load_active_stories(
bool is_hidden, bool is_next, Result<telegram_api::object_ptr<telegram_api::stories_AllStories>> r_all_stories) {
G()->ignore_result_if_closing(r_all_stories);

View File

@ -155,6 +155,8 @@ class StoryManager final : public Actor {
void load_active_stories(const td_api::object_ptr<td_api::StoryList> &story_list_ptr, Promise<Unit> &&promise);
void reload_active_stories();
void toggle_dialog_stories_hidden(DialogId dialog_id, bool are_hidden, Promise<Unit> &&promise);
void get_dialog_pinned_stories(DialogId owner_dialog_id, StoryId from_story_id, int32 limit,
@ -324,6 +326,8 @@ class StoryManager final : public Actor {
void on_load_dialog_expiring_stories(DialogId owner_dialog_id);
void load_active_stories(StoryList &story_list, bool is_hidden, bool is_next, Promise<Unit> &&promise);
void on_load_active_stories(bool is_hidden, bool is_next,
Result<telegram_api::object_ptr<telegram_api::stories_AllStories>> r_all_stories);

View File

@ -2170,6 +2170,7 @@ void UpdatesManager::try_reload_data() {
td_->stickers_manager_->reload_special_sticker_set_by_type(SpecialStickerSetType::default_topic_icons());
td_->stickers_manager_->get_default_dialog_photo_custom_emoji_stickers(false, true, Auto());
td_->stickers_manager_->get_default_dialog_photo_custom_emoji_stickers(true, true, Auto());
td_->story_manager_->reload_active_stories();
schedule_data_reload();
}