From 582df3f39f16b931b0e72c1be9fdd81e312bc567 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 1 Mar 2023 21:53:08 +0300 Subject: [PATCH] Removed sound for cancel of unconfirmed peer calls. --- Telegram/SourceFiles/calls/calls_call.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index 92bf19b69..da0d591db 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -1039,14 +1039,15 @@ bool Call::checkCallFields(const MTPDphoneCallAccepted &call) { } void Call::setState(State state) { - if (_state.current() == State::Failed) { + const auto was = _state.current(); + if (was == State::Failed) { return; } - if (_state.current() == State::FailedHangingUp + if (was == State::FailedHangingUp && state != State::Failed) { return; } - if (_state.current() != state) { + if (was != state) { _state = state; if (true @@ -1074,7 +1075,9 @@ void Call::setState(State state) { _delegate->callPlaySound(Delegate::CallSound::Connecting); break; case State::Ended: - _delegate->callPlaySound(Delegate::CallSound::Ended); + if (was != State::WaitingUserConfirmation) { + _delegate->callPlaySound(Delegate::CallSound::Ended); + } [[fallthrough]]; case State::EndedByOtherDevice: _delegate->callFinished(this);