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