mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
parent
068eb3fcd1
commit
3a3341fef8
5 changed files with 41 additions and 35 deletions
|
@ -202,23 +202,11 @@ void Instance::startOutgoingCall(not_null<UserData*> user, bool video) {
|
|||
}), video);
|
||||
}
|
||||
|
||||
void Instance::startOrJoinGroupCall(
|
||||
void Instance::showStartOrJoinGroupCall(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
not_null<PeerData*> peer,
|
||||
const StartGroupCallArgs &args) {
|
||||
using JoinConfirm = StartGroupCallArgs::JoinConfirm;
|
||||
if (args.rtmpNeeded) {
|
||||
_startWithRtmp->start(peer, [=](object_ptr<Ui::BoxContent> box) {
|
||||
show->showBox(std::move(box), Ui::LayerOption::KeepOther);
|
||||
}, [=](QString text) {
|
||||
Ui::Toast::Show(show->toastParent(), text);
|
||||
}, [=](Group::JoinInfo info) {
|
||||
createGroupCall(
|
||||
std::move(info),
|
||||
MTP_inputGroupCall(MTPlong(), MTPlong()));
|
||||
});
|
||||
return;
|
||||
}
|
||||
const auto context = (args.confirm == JoinConfirm::Always)
|
||||
? Group::ChooseJoinAsProcess::Context::JoinWithConfirm
|
||||
: peer->groupCall()
|
||||
|
@ -238,7 +226,19 @@ void Instance::startOrJoinGroupCall(
|
|||
}
|
||||
createGroupCall(
|
||||
std::move(info),
|
||||
call ? call->input() : MTP_inputGroupCall(MTPlong(), MTPlong()));
|
||||
call ? call->input() : MTP_inputGroupCall({}, {}));
|
||||
});
|
||||
}
|
||||
|
||||
void Instance::showStartWithRtmp(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
not_null<PeerData*> peer) {
|
||||
_startWithRtmp->start(peer, [=](object_ptr<Ui::BoxContent> box) {
|
||||
show->showBox(std::move(box), Ui::LayerOption::KeepOther);
|
||||
}, [=](QString text) {
|
||||
Ui::Toast::Show(show->toastParent(), text);
|
||||
}, [=](Group::JoinInfo info) {
|
||||
createGroupCall(std::move(info), MTP_inputGroupCall({}, {}));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,6 @@ struct StartGroupCallArgs {
|
|||
QString joinHash;
|
||||
JoinConfirm confirm = JoinConfirm::IfNowInAnother;
|
||||
bool scheduleNeeded = false;
|
||||
bool rtmpNeeded = false;
|
||||
bool useRtmp = false;
|
||||
};
|
||||
|
||||
class Instance final : public base::has_weak_ptr {
|
||||
|
@ -67,10 +65,13 @@ public:
|
|||
~Instance();
|
||||
|
||||
void startOutgoingCall(not_null<UserData*> user, bool video);
|
||||
void startOrJoinGroupCall(
|
||||
void showStartOrJoinGroupCall(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
not_null<PeerData*> peer,
|
||||
const StartGroupCallArgs &args);
|
||||
void showStartWithRtmp(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
not_null<PeerData*> peer);
|
||||
void handleUpdate(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPUpdate &update);
|
||||
|
|
|
@ -341,7 +341,7 @@ void StartRtmpProcess::FillRtmpRows(
|
|||
close();
|
||||
},
|
||||
.confirmText = tr::lng_from_request_understand(),
|
||||
.cancelText = tr::lng_close(),
|
||||
.cancelText = tr::lng_cancel(),
|
||||
.confirmStyle = attentionButtonStyle,
|
||||
.labelStyle = labelStyle,
|
||||
}));
|
||||
|
|
|
@ -328,24 +328,29 @@ void TopBarWidget::showGroupCallMenu(not_null<PeerData*> peer) {
|
|||
const auto callback = [=](Calls::StartGroupCallArgs &&args) {
|
||||
controller->startOrJoinGroupCall(peer, std::move(args));
|
||||
};
|
||||
const auto rtmpCallback = [=] {
|
||||
Core::App().calls().showStartWithRtmp(
|
||||
std::make_shared<Window::Show>(controller),
|
||||
peer);
|
||||
};
|
||||
const auto livestream = !peer->isMegagroup() && peer->isChannel();
|
||||
_menu->addAction(
|
||||
livestream
|
||||
? tr::lng_menu_start_group_call_channel(tr::now)
|
||||
: tr::lng_menu_start_group_call(tr::now),
|
||||
(livestream
|
||||
? tr::lng_menu_start_group_call_channel
|
||||
: tr::lng_menu_start_group_call)(tr::now),
|
||||
[=] { callback({}); },
|
||||
&st::menuIconStartStream);
|
||||
_menu->addAction(
|
||||
livestream
|
||||
? tr::lng_menu_start_group_call_scheduled_channel(tr::now)
|
||||
: tr::lng_menu_start_group_call_scheduled(tr::now),
|
||||
(livestream
|
||||
? tr::lng_menu_start_group_call_scheduled_channel
|
||||
: tr::lng_menu_start_group_call_scheduled)(tr::now),
|
||||
[=] { callback({ .scheduleNeeded = true }); },
|
||||
&st::menuIconReschedule);
|
||||
_menu->addAction(
|
||||
livestream
|
||||
? tr::lng_menu_start_group_call_with_channel(tr::now)
|
||||
: tr::lng_menu_start_group_call_with(tr::now),
|
||||
[=] { callback({ .rtmpNeeded = true }); },
|
||||
(livestream
|
||||
? tr::lng_menu_start_group_call_with_channel
|
||||
: tr::lng_menu_start_group_call_with)(tr::now),
|
||||
rtmpCallback,
|
||||
&st::menuIconStartStreamWith);
|
||||
_menu->setForcedOrigin(Ui::PanelAnimation::Origin::TopRight);
|
||||
_menu->popup(mapToGlobal(QPoint(
|
||||
|
|
|
@ -1276,12 +1276,15 @@ void SessionController::startOrJoinGroupCall(
|
|||
const Calls::StartGroupCallArgs &args) {
|
||||
using JoinConfirm = Calls::StartGroupCallArgs::JoinConfirm;
|
||||
auto &calls = Core::App().calls();
|
||||
auto confirmedArgs = args;
|
||||
confirmedArgs.confirm = JoinConfirm::None;
|
||||
|
||||
const auto askConfirmation = [&](QString text, QString button) {
|
||||
show(Ui::MakeConfirmBox({
|
||||
.text = text,
|
||||
.confirmed = crl::guard(this,[=, hash = args.joinHash] {
|
||||
.confirmed = crl::guard(this,[=] {
|
||||
hideLayer();
|
||||
startOrJoinGroupCall(peer, { hash, JoinConfirm::None });
|
||||
startOrJoinGroupCall(peer, confirmedArgs);
|
||||
}),
|
||||
.confirmText = button,
|
||||
}));
|
||||
|
@ -1300,10 +1303,7 @@ void SessionController::startOrJoinGroupCall(
|
|||
if (now == peer) {
|
||||
calls.activateCurrentCall(args.joinHash);
|
||||
} else if (calls.currentGroupCall()->scheduleDate()) {
|
||||
calls.startOrJoinGroupCall(
|
||||
std::make_shared<Show>(this),
|
||||
peer,
|
||||
{args.joinHash});
|
||||
startOrJoinGroupCall(peer, confirmedArgs);
|
||||
} else {
|
||||
askConfirmation(
|
||||
((peer->isBroadcast() && now->isBroadcast())
|
||||
|
@ -1316,7 +1316,7 @@ void SessionController::startOrJoinGroupCall(
|
|||
tr::lng_group_call_leave(tr::now));
|
||||
}
|
||||
} else {
|
||||
calls.startOrJoinGroupCall(
|
||||
calls.showStartOrJoinGroupCall(
|
||||
std::make_shared<Show>(this),
|
||||
peer,
|
||||
args);
|
||||
|
|
Loading…
Add table
Reference in a new issue