diff --git a/Telegram/SourceFiles/calls/calls_group_members.cpp b/Telegram/SourceFiles/calls/calls_group_members.cpp index 618b3959ca..15de07f965 100644 --- a/Telegram/SourceFiles/calls/calls_group_members.cpp +++ b/Telegram/SourceFiles/calls/calls_group_members.cpp @@ -250,6 +250,9 @@ private: base::flat_map> _speakingRowBySsrc; Ui::Animations::Basic _speakingAnimation; + crl::time _speakingAnimationHideLastTime = 0; + bool _skipRowLevelUpdate = false; + Ui::CrossLineAnimation _inactiveCrossLine; Ui::CrossLineAnimation _coloredCrossLine; @@ -513,7 +516,27 @@ MembersController::MembersController( _coloredCrossLine.invalidate(); }, _lifetime); + Core::App().appDeactivates( + ) | rpl::start_with_next([=](bool hide) { + _speakingAnimationHideLastTime = hide ? crl::now() : 0; + for (const auto [_, row] : _speakingRowBySsrc) { + if (hide) { + row->updateLevel(0.); + } + updateRowLevel(row, 0.); + if (!hide && !_speakingAnimation.animating()) { + _speakingAnimation.start(); + } + } + _skipRowLevelUpdate = hide; + }, _lifetime); + _speakingAnimation.init([=](crl::time now) { + if (const auto &last = _speakingAnimationHideLastTime; (last > 0) + && (now - last >= Ui::Paint::Blobs::kHideBlobsDuration)) { + _speakingAnimation.stop(); + return false; + } for (const auto [ssrc, row] : _speakingRowBySsrc) { row->updateBlobAnimation(now); delegate()->peerListUpdateRow(row); @@ -683,6 +706,9 @@ void MembersController::removeRow(not_null row) { void MembersController::updateRowLevel( not_null row, float level) { + if (_skipRowLevelUpdate) { + return; + } row->updateLevel(level); } diff --git a/Telegram/SourceFiles/calls/calls_group_panel.cpp b/Telegram/SourceFiles/calls/calls_group_panel.cpp index 6543b976d3..6e66af6c00 100644 --- a/Telegram/SourceFiles/calls/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_group_panel.cpp @@ -223,6 +223,7 @@ GroupPanel::GroupPanel(not_null call) , _settings(widget(), st::groupCallSettings) , _mute(std::make_unique( widget(), + Core::App().appDeactivates(), Ui::CallMuteButtonState{ .text = tr::lng_group_call_connecting(tr::now), .type = Ui::CallMuteButtonType::Connecting, diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index d27610990f..211316c7b2 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -247,7 +247,7 @@ void Application::run() { QCoreApplication::instance()->installEventFilter(this); - appDeactivated( + appDeactivates( ) | rpl::start_with_next([=](bool deactivated) { if (deactivated) { handleAppDeactivated(); @@ -652,7 +652,7 @@ void Application::handleAppDeactivated() { Ui::Tooltip::Hide(); } -rpl::producer Application::appDeactivated() const { +rpl::producer Application::appDeactivates() const { return base::qt_signal_producer( static_cast(QCoreApplication::instance()), &QGuiApplication::applicationStateChanged diff --git a/Telegram/SourceFiles/core/application.h b/Telegram/SourceFiles/core/application.h index 059e33bf4f..1238bd39db 100644 --- a/Telegram/SourceFiles/core/application.h +++ b/Telegram/SourceFiles/core/application.h @@ -271,7 +271,7 @@ public: void handleAppActivated(); void handleAppDeactivated(); - [[nodiscard]] rpl::producer appDeactivated() const; + [[nodiscard]] rpl::producer appDeactivates() const; void switchDebugMode(); void switchFreeType();