diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index ec6d0fca0..7c5584186 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -202,23 +202,11 @@ void Instance::startOutgoingCall(not_null user, bool video) { }), video); } -void Instance::startOrJoinGroupCall( +void Instance::showStartOrJoinGroupCall( std::shared_ptr show, not_null peer, const StartGroupCallArgs &args) { using JoinConfirm = StartGroupCallArgs::JoinConfirm; - if (args.rtmpNeeded) { - _startWithRtmp->start(peer, [=](object_ptr 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 show, + not_null peer) { + _startWithRtmp->start(peer, [=](object_ptr 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({}, {})); }); } diff --git a/Telegram/SourceFiles/calls/calls_instance.h b/Telegram/SourceFiles/calls/calls_instance.h index 1bdfaa618..f3f93532a 100644 --- a/Telegram/SourceFiles/calls/calls_instance.h +++ b/Telegram/SourceFiles/calls/calls_instance.h @@ -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 user, bool video); - void startOrJoinGroupCall( + void showStartOrJoinGroupCall( std::shared_ptr show, not_null peer, const StartGroupCallArgs &args); + void showStartWithRtmp( + std::shared_ptr show, + not_null peer); void handleUpdate( not_null session, const MTPUpdate &update); diff --git a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp index 6a332314e..9859387d7 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp @@ -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, })); diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 1a042d53a..efa1f952c 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -328,24 +328,29 @@ void TopBarWidget::showGroupCallMenu(not_null peer) { const auto callback = [=](Calls::StartGroupCallArgs &&args) { controller->startOrJoinGroupCall(peer, std::move(args)); }; + const auto rtmpCallback = [=] { + Core::App().calls().showStartWithRtmp( + std::make_shared(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( diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index d4990098e..97f30ba3c 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -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(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(this), peer, args);