From 41edd41b924c38d08a3faef23dea24b96fe635fa Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 1 Jun 2023 20:12:42 +0400 Subject: [PATCH] Pause story while viewing the viewers list. --- .../media/stories/media_stories_controller.cpp | 10 +++++++++- .../media/stories/media_stories_controller.h | 2 ++ .../media/stories/media_stories_recent_views.cpp | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/media/stories/media_stories_controller.cpp b/Telegram/SourceFiles/media/stories/media_stories_controller.cpp index 3fc642b0a..55062a7d3 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_controller.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_controller.cpp @@ -476,7 +476,8 @@ void Controller::updatePlayingAllowed() { && _windowActive && !_paused && !_replyActive - && !_layerShown); + && !_layerShown + && !_menuShown); } void Controller::setPlayingAllowed(bool allowed) { @@ -656,6 +657,13 @@ void Controller::togglePaused(bool paused) { } } +void Controller::setMenuShown(bool shown) { + if (_menuShown != shown) { + _menuShown = shown; + updatePlayingAllowed(); + } +} + bool Controller::canDownload() const { return _list && _list->user->isSelf(); } diff --git a/Telegram/SourceFiles/media/stories/media_stories_controller.h b/Telegram/SourceFiles/media/stories/media_stories_controller.h index 161a6971e..b8954e9e3 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_controller.h +++ b/Telegram/SourceFiles/media/stories/media_stories_controller.h @@ -113,6 +113,7 @@ public: [[nodiscard]] bool jumpFor(int delta); [[nodiscard]] bool paused() const; void togglePaused(bool paused); + void setMenuShown(bool shown); [[nodiscard]] bool canDownload() const; @@ -174,6 +175,7 @@ private: bool _replyFocused = false; bool _replyActive = false; bool _layerShown = false; + bool _menuShown = false; bool _paused = false; FullStoryId _shown; diff --git a/Telegram/SourceFiles/media/stories/media_stories_recent_views.cpp b/Telegram/SourceFiles/media/stories/media_stories_recent_views.cpp index 3703d474f..98f8ca9a8 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_recent_views.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_recent_views.cpp @@ -286,7 +286,9 @@ void RecentViews::showMenu() { rebuildMenuTail(); }, _menuShortLifetime); + _controller->setMenuShown(true); _menu->setDestroyedCallback(crl::guard(_widget.get(), [=] { + _controller->setMenuShown(false); _menuShortLifetime.destroy(); _menuEntries.clear(); _menuEntriesCount = 0;