From c42ef54417dd856a74d4197265eb85d195745c09 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 29 Nov 2020 16:59:07 +0300 Subject: [PATCH] Join call instead of creating a new one. --- Telegram/SourceFiles/calls/calls_top_bar.cpp | 7 +++++++ .../history/view/history_view_top_bar_widget.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/calls/calls_top_bar.cpp b/Telegram/SourceFiles/calls/calls_top_bar.cpp index f0200f5035..c8ddf621de 100644 --- a/Telegram/SourceFiles/calls/calls_top_bar.cpp +++ b/Telegram/SourceFiles/calls/calls_top_bar.cpp @@ -219,7 +219,11 @@ void TopBar::subscribeToMembersChanges(not_null call) { }); }) | rpl::flatten_latest( ) | rpl::start_with_next([=](const Ui::GroupCallBarContent &content) { + const auto changed = (_userpics.size() != content.userpics.size()); _userpics = content.userpics; + if (changed) { + updateControlsGeometry(); + } update(); }, lifetime()); } @@ -282,6 +286,9 @@ void TopBar::updateControlsGeometry() { _durationLabel->moveToLeft(left, st::callBarLabelTop); left += _durationLabel->width() + st::callBarSkip; } + if (!_userpics.isNull()) { + left += _userpics.width() / _userpics.devicePixelRatio(); + } if (_signalBars) { _signalBars->moveToLeft(left, (height() - _signalBars->height()) / 2); left += _signalBars->width() + st::callBarSkip; diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 983025d41b..214950959f 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_peer_menu.h" #include "calls/calls_instance.h" #include "data/data_peer_values.h" +#include "data/data_group_call.h" // GroupCall::input. #include "data/data_folder.h" #include "data/data_session.h" #include "data/data_channel.h" @@ -211,7 +212,11 @@ void TopBarWidget::onCall() { if (const auto user = peer->asUser()) { Core::App().calls().startOutgoingCall(user, false); } else if (const auto megagroup = peer->asMegagroup()) { - Core::App().calls().startGroupCall(megagroup); + if (const auto call = megagroup->call()) { + Core::App().calls().joinGroupCall(megagroup, call->input()); + } else { + Core::App().calls().startGroupCall(megagroup); + } } } }