2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 15:15:13 +00:00

Support voice chats in legacy groups, with migration.

This commit is contained in:
John Preston
2020-12-14 16:52:18 +04:00
parent cd3b989e70
commit 1b624d67b8
30 changed files with 584 additions and 389 deletions

View File

@@ -933,9 +933,10 @@ void SessionController::closeThirdSection() {
}
void SessionController::startOrJoinGroupCall(
not_null<ChannelData*> megagroup,
not_null<PeerData*> peer,
bool confirmedLeaveOther) {
if (megagroup->amAnonymous()) {
const auto channel = peer->asChannel();
if (channel && channel->amAnonymous()) {
Ui::ShowMultilineToast({
.text = tr::lng_group_call_no_anonymous(tr::now),
});
@@ -945,7 +946,7 @@ void SessionController::startOrJoinGroupCall(
const auto confirm = [&](QString text, QString button) {
Ui::show(Box<ConfirmBox>(text, button, crl::guard(this, [=] {
Ui::hideLayer();
startOrJoinGroupCall(megagroup, true);
startOrJoinGroupCall(peer, true);
})));
};
if (!confirmedLeaveOther && calls.inCall()) {
@@ -954,19 +955,19 @@ void SessionController::startOrJoinGroupCall(
tr::lng_call_leave_to_other_sure(tr::now),
tr::lng_call_bar_hangup(tr::now));
} else if (!confirmedLeaveOther && calls.inGroupCall()) {
if (calls.currentGroupCall()->channel() == megagroup) {
if (calls.currentGroupCall()->peer() == peer) {
calls.activateCurrentCall();
} else {
confirm(
tr::lng_group_call_leave_to_other_sure(tr::now),
tr::lng_group_call_leave(tr::now));
}
} else if (!confirmedLeaveOther && !megagroup->call()) {
} else if (!confirmedLeaveOther && !peer->groupCall()) {
confirm(
tr::lng_group_call_create_sure(tr::now),
tr::lng_continue(tr::now));
} else {
calls.startOrJoinGroupCall(megagroup);
calls.startOrJoinGroupCall(peer);
}
}