Leave voice chat without confirmation.

This commit is contained in:
John Preston 2020-12-15 14:49:31 +04:00
parent b550eb5ab2
commit 703b21b4e5
3 changed files with 16 additions and 9 deletions

View File

@ -315,14 +315,17 @@ void GroupPanel::initWidget() {
}, widget()->lifetime());
}
void GroupPanel::hangup(bool discardCallChecked) {
void GroupPanel::endCall() {
if (!_call) {
return;
} else if (!_call->peer()->canManageGroupCall()) {
_call->hangup();
return;
}
_layerBg->showBox(Box(
LeaveGroupCallBox,
_call,
discardCallChecked,
false,
BoxContext::GroupCallPanel));
}
@ -338,7 +341,7 @@ void GroupPanel::initControls() {
: MuteState::Muted);
}, _mute->lifetime());
_hangup->setClickedCallback([=] { hangup(false); });
_hangup->setClickedCallback([=] { endCall(); });
_settings->setClickedCallback([=] {
if (_call) {
_layerBg->showBox(Box(GroupCallSettingsBox, _call));

View File

@ -90,7 +90,7 @@ private:
void updateControlsGeometry();
void showControls();
void hangup(bool discardCallChecked);
void endCall();
void addMembers();
void kickMember(not_null<UserData*> user);

View File

@ -337,11 +337,15 @@ void TopBar::initControls() {
if (const auto call = _call.get()) {
call->hangup();
} else if (const auto group = _groupCall.get()) {
Ui::show(Box(
LeaveGroupCallBox,
group,
false,
BoxContext::MainWindow));
if (!group->peer()->canManageGroupCall()) {
group->hangup();
} else {
Ui::show(Box(
LeaveGroupCallBox,
group,
false,
BoxContext::MainWindow));
}
}
});
updateDurationText();