From edc6cfe2101ed52851ebfce8e6ed63bd56dbfdfe Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 23 Nov 2024 10:04:55 +0400 Subject: [PATCH] Replace non-started calls. --- Telegram/SourceFiles/calls/calls_instance.cpp | 3 ++- Telegram/SourceFiles/calls/calls_panel.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index 118532d16..7d5793727 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -669,7 +669,8 @@ bool Instance::inCall() const { return false; } const auto state = _currentCall->state(); - return (state != Call::State::Busy); + return (state != Call::State::Busy) + && (state != Call::State::WaitingUserConfirmation); } bool Instance::inGroupCall() const { diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 6f0ab0f6a..74ddcb8f2 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -993,7 +993,12 @@ void Panel::paint(QRect clip) { bool Panel::handleClose() const { if (_call) { - window()->hide(); + if (_call->state() == Call::State::WaitingUserConfirmation + || _call->state() == Call::State::Busy) { + _call->hangup(); + } else { + window()->hide(); + } return true; } return false; @@ -1028,6 +1033,7 @@ void Panel::stateChanged(State state) { _startVideo = base::make_unique_q( widget(), st::callStartVideo); + _startVideo->show(); _startVideo->setText(tr::lng_call_start_video()); _startVideo->clicks() | rpl::map_to(true) | rpl::start_to_stream( _startOutgoingRequests,