diff --git a/Telegram/SourceFiles/calls/calls_group_call.cpp b/Telegram/SourceFiles/calls/calls_group_call.cpp index df582ada3..d2fd97e7e 100644 --- a/Telegram/SourceFiles/calls/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/calls_group_call.cpp @@ -272,11 +272,6 @@ void GroupCall::setState(State state) { if (state == State::Joined) { stopConnectingSound(); - if (!_hadJoinedState) { - _hadJoinedState = true; - applyGlobalShortcutChanges(); - _delegate->groupCallPlaySound(Delegate::GroupCallSound::Started); - } if (const auto call = _peer->groupCall(); call && call->id() == _id) { call->setInCall(); } @@ -479,6 +474,7 @@ void GroupCall::rejoin(not_null as) { applyMeInCallLocally(); maybeSendMutedUpdate(wasMuteState); _peer->session().api().applyUpdates(updates); + checkFirstTimeJoined(); }).fail([=](const MTP::Error &error) { const auto type = error.type(); LOG(("Call Error: Could not join, error: %1").arg(type)); @@ -1312,9 +1308,24 @@ void GroupCall::setInstanceConnected( if (nowCanSpeak) { notifyAboutAllowedToSpeak(); } + if (!_hadJoinedState && state() == State::Joined) { + checkFirstTimeJoined(); + } +} + +void GroupCall::checkFirstTimeJoined() { + if (_hadJoinedState || state() != State::Joined) { + return; + } + _hadJoinedState = true; + applyGlobalShortcutChanges(); + _delegate->groupCallPlaySound(Delegate::GroupCallSound::Started); } void GroupCall::notifyAboutAllowedToSpeak() { + if (!_hadJoinedState) { + return; + } _delegate->groupCallPlaySound( Delegate::GroupCallSound::AllowedToSpeak); _allowedToSpeakNotifications.fire({}); diff --git a/Telegram/SourceFiles/calls/calls_group_call.h b/Telegram/SourceFiles/calls/calls_group_call.h index 2f72d4f54..e0ad0955d 100644 --- a/Telegram/SourceFiles/calls/calls_group_call.h +++ b/Telegram/SourceFiles/calls/calls_group_call.h @@ -250,6 +250,7 @@ private: void checkGlobalShortcutAvailability(); void checkJoined(); + void checkFirstTimeJoined(); void notifyAboutAllowedToSpeak(); void playConnectingSound();