Join call instead of creating a new one.

This commit is contained in:
John Preston 2020-11-29 16:59:07 +03:00
parent 5339523824
commit c42ef54417
2 changed files with 13 additions and 1 deletions

View File

@ -219,7 +219,11 @@ void TopBar::subscribeToMembersChanges(not_null<GroupCall*> 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;

View File

@ -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);
}
}
}
}