mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Improve mute/video migration to confcall.
This commit is contained in:
parent
e9280777fd
commit
502045f1fa
6 changed files with 35 additions and 22 deletions
|
@ -427,6 +427,14 @@ void Call::answer() {
|
||||||
}), video);
|
}), video);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StartConferenceInfo Call::migrateConferenceInfo(StartConferenceInfo extend) {
|
||||||
|
extend.migrating = true;
|
||||||
|
extend.muted = muted();
|
||||||
|
extend.videoCapture = isSharingVideo() ? _videoCapture : nullptr;
|
||||||
|
extend.videoCaptureScreenId = screenSharingDeviceId();
|
||||||
|
return extend;
|
||||||
|
}
|
||||||
|
|
||||||
void Call::acceptConferenceInvite() {
|
void Call::acceptConferenceInvite() {
|
||||||
Expects(conferenceInvite());
|
Expects(conferenceInvite());
|
||||||
|
|
||||||
|
@ -436,29 +444,24 @@ void Call::acceptConferenceInvite() {
|
||||||
setState(State::ExchangingKeys);
|
setState(State::ExchangingKeys);
|
||||||
const auto limit = 5;
|
const auto limit = 5;
|
||||||
const auto messageId = _conferenceInviteMsgId;
|
const auto messageId = _conferenceInviteMsgId;
|
||||||
const auto session = &_user->session();
|
_api.request(MTPphone_GetGroupCall(
|
||||||
auto info = StartConferenceInfo{
|
|
||||||
.joinMessageId = messageId,
|
|
||||||
.migrating = true,
|
|
||||||
.muted = muted(),
|
|
||||||
.videoCapture = isSharingVideo() ? _videoCapture : nullptr,
|
|
||||||
.videoCaptureScreenId = screenSharingDeviceId(),
|
|
||||||
};
|
|
||||||
session->api().request(MTPphone_GetGroupCall(
|
|
||||||
MTP_inputGroupCallInviteMessage(MTP_int(messageId.bare)),
|
MTP_inputGroupCallInviteMessage(MTP_int(messageId.bare)),
|
||||||
MTP_int(limit)
|
MTP_int(limit)
|
||||||
)).done([session, messageId, info](const MTPphone_GroupCall &result) {
|
)).done([=](const MTPphone_GroupCall &result) {
|
||||||
result.data().vcall().match([&](const auto &data) {
|
result.data().vcall().match([&](const auto &data) {
|
||||||
auto copy = info;
|
auto call = _user->owner().sharedConferenceCall(
|
||||||
copy.call = session->data().sharedConferenceCall(
|
|
||||||
data.vid().v,
|
data.vid().v,
|
||||||
data.vaccess_hash().v);
|
data.vaccess_hash().v);
|
||||||
copy.call->processFullCall(result);
|
call->processFullCall(result);
|
||||||
Core::App().calls().startOrJoinConferenceCall(std::move(copy));
|
Core::App().calls().startOrJoinConferenceCall(
|
||||||
|
migrateConferenceInfo({
|
||||||
|
.call = std::move(call),
|
||||||
|
.joinMessageId = messageId,
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
}).fail(crl::guard(this, [=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
handleRequestError(error.type());
|
handleRequestError(error.type());
|
||||||
})).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Call::actuallyAnswer() {
|
void Call::actuallyAnswer() {
|
||||||
|
@ -892,10 +895,11 @@ void Call::finishByMigration(const QString &slug) {
|
||||||
data.vid().v,
|
data.vid().v,
|
||||||
data.vaccess_hash().v);
|
data.vaccess_hash().v);
|
||||||
call->processFullCall(result);
|
call->processFullCall(result);
|
||||||
Core::App().calls().startOrJoinConferenceCall({
|
Core::App().calls().startOrJoinConferenceCall(
|
||||||
.call = call,
|
migrateConferenceInfo({
|
||||||
.linkSlug = slug,
|
.call = call,
|
||||||
});
|
.linkSlug = slug,
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
}).fail(crl::guard(this, [=] {
|
}).fail(crl::guard(this, [=] {
|
||||||
setState(State::Failed);
|
setState(State::Failed);
|
||||||
|
|
|
@ -40,6 +40,8 @@ struct DeviceResolvedId;
|
||||||
|
|
||||||
namespace Calls {
|
namespace Calls {
|
||||||
|
|
||||||
|
struct StartConferenceInfo;
|
||||||
|
|
||||||
struct DhConfig {
|
struct DhConfig {
|
||||||
int32 version = 0;
|
int32 version = 0;
|
||||||
int32 g = 0;
|
int32 g = 0;
|
||||||
|
@ -312,6 +314,9 @@ private:
|
||||||
tgcalls::AudioState audio,
|
tgcalls::AudioState audio,
|
||||||
tgcalls::VideoState video);
|
tgcalls::VideoState video);
|
||||||
|
|
||||||
|
[[nodiscard]] StartConferenceInfo migrateConferenceInfo(
|
||||||
|
StartConferenceInfo extend);
|
||||||
|
|
||||||
const not_null<Delegate*> _delegate;
|
const not_null<Delegate*> _delegate;
|
||||||
const not_null<UserData*> _user;
|
const not_null<UserData*> _user;
|
||||||
MTP::Sender _api;
|
MTP::Sender _api;
|
||||||
|
|
|
@ -254,7 +254,7 @@ void Instance::startOrJoinConferenceCall(StartConferenceInfo args) {
|
||||||
_currentGroupCallChanges.fire_copy(raw);
|
_currentGroupCallChanges.fire_copy(raw);
|
||||||
if (!args.invite.empty()) {
|
if (!args.invite.empty()) {
|
||||||
_currentGroupCallPanel->migrationInviteUsers(std::move(args.invite));
|
_currentGroupCallPanel->migrationInviteUsers(std::move(args.invite));
|
||||||
} else if (args.migrating && !args.linkSlug.isEmpty()) {
|
} else if (args.sharingLink && !args.linkSlug.isEmpty()) {
|
||||||
_currentGroupCallPanel->migrationShowShareLink();
|
_currentGroupCallPanel->migrationShowShareLink();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,12 +474,14 @@ void Panel::initControls() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*creating = true;
|
*creating = true;
|
||||||
|
const auto sharingLink = users.empty();
|
||||||
Group::MakeConferenceCall({
|
Group::MakeConferenceCall({
|
||||||
.show = uiShow(),
|
.show = uiShow(),
|
||||||
.finished = finish,
|
.finished = finish,
|
||||||
.joining = true,
|
.joining = true,
|
||||||
.info = {
|
.info = {
|
||||||
.invite = std::move(users),
|
.invite = std::move(users),
|
||||||
|
.sharingLink = sharingLink,
|
||||||
.migrating = true,
|
.migrating = true,
|
||||||
.muted = call->muted(),
|
.muted = call->muted(),
|
||||||
.videoCapture = (call->isSharingVideo()
|
.videoCapture = (call->isSharingVideo()
|
||||||
|
|
|
@ -406,7 +406,8 @@ void ExportConferenceCallLink(
|
||||||
auto copy = info;
|
auto copy = info;
|
||||||
copy.call = call;
|
copy.call = call;
|
||||||
copy.linkSlug = std::move(slug);
|
copy.linkSlug = std::move(slug);
|
||||||
Core::App().calls().startOrJoinConferenceCall(info);
|
Core::App().calls().startOrJoinConferenceCall(
|
||||||
|
std::move(copy));
|
||||||
}
|
}
|
||||||
if (const auto onstack = finished) {
|
if (const auto onstack = finished) {
|
||||||
finished(QString());
|
finished(QString());
|
||||||
|
|
|
@ -64,6 +64,7 @@ struct StartConferenceInfo {
|
||||||
QString linkSlug;
|
QString linkSlug;
|
||||||
MsgId joinMessageId;
|
MsgId joinMessageId;
|
||||||
std::vector<InviteRequest> invite;
|
std::vector<InviteRequest> invite;
|
||||||
|
bool sharingLink = false;
|
||||||
bool migrating = false;
|
bool migrating = false;
|
||||||
bool muted = false;
|
bool muted = false;
|
||||||
std::shared_ptr<tgcalls::VideoCaptureInterface> videoCapture;
|
std::shared_ptr<tgcalls::VideoCaptureInterface> videoCapture;
|
||||||
|
|
Loading…
Add table
Reference in a new issue