Add StoryManager::get_story_duration.
This commit is contained in:
parent
f4a2dbde41
commit
f869eca9c4
@ -544,6 +544,21 @@ bool StoryManager::have_story(StoryFullId story_full_id) const {
|
|||||||
return get_story(story_full_id) != nullptr;
|
return get_story(story_full_id) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 StoryManager::get_story_duration(StoryFullId story_full_id) const {
|
||||||
|
auto story = get_story(story_full_id);
|
||||||
|
if (story == nullptr) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
auto *content = story->content_.get();
|
||||||
|
auto it = being_edited_stories_.find(story_full_id);
|
||||||
|
if (it != being_edited_stories_.end()) {
|
||||||
|
if (it->second->content_ != nullptr) {
|
||||||
|
content = it->second->content_.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return get_story_content_duration(td_, content);
|
||||||
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::story> StoryManager::get_story_object(StoryFullId story_full_id) const {
|
td_api::object_ptr<td_api::story> StoryManager::get_story_object(StoryFullId story_full_id) const {
|
||||||
return get_story_object(story_full_id, get_story(story_full_id));
|
return get_story_object(story_full_id, get_story(story_full_id));
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,8 @@ class StoryManager final : public Actor {
|
|||||||
|
|
||||||
bool have_story(StoryFullId story_full_id) const;
|
bool have_story(StoryFullId story_full_id) const;
|
||||||
|
|
||||||
|
int32 get_story_duration(StoryFullId story_full_id) const;
|
||||||
|
|
||||||
td_api::object_ptr<td_api::story> get_story_object(StoryFullId story_full_id) const;
|
td_api::object_ptr<td_api::story> get_story_object(StoryFullId story_full_id) const;
|
||||||
|
|
||||||
td_api::object_ptr<td_api::stories> get_stories_object(int32 total_count,
|
td_api::object_ptr<td_api::stories> get_stories_object(int32 total_count,
|
||||||
|
Loading…
Reference in New Issue
Block a user