From 40d97bc6a47c1dc43b86b59ba4c3d65e8511b30a Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 28 Feb 2022 12:43:26 +0300 Subject: [PATCH] Added ability to start video chat with RTMP as well. --- Telegram/Resources/langs/lang.strings | 7 +++++-- .../calls/group/calls_choose_join_as.cpp | 4 +++- .../view/history_view_top_bar_widget.cpp | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 8384627416..3863f3d6ff 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2381,9 +2381,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_group_call_join_as_changed" = "Members of this voice chat will now see you as {name}"; "lng_group_call_join_as_changed_channel" = "Members of this live stream will now see you as {name}"; -"lng_menu_start_group_call" = "Start live stream"; -"lng_menu_start_group_call_scheduled" = "Schedule live stream"; +"lng_menu_start_group_call" = "Start video chat"; +"lng_menu_start_group_call_scheduled" = "Schedule video chat"; "lng_menu_start_group_call_with" = "Stream with..."; +"lng_menu_start_group_call_channel" = "Start live stream"; +"lng_menu_start_group_call_scheduled_channel" = "Schedule live stream"; +"lng_menu_start_group_call_with_channel" = "Stream with..."; "lng_group_call_rtmp_title" = "Stream with other apps"; "lng_group_call_rtmp_url_subtitle" = "Server URL"; diff --git a/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp b/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp index 00bd861dd3..7793884db7 100644 --- a/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp +++ b/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp @@ -243,7 +243,8 @@ void ChooseJoinAsBox( auto next = (context == Context::Switch) ? tr::lng_settings_save() : tr::lng_continue(); - if ((context == Context::Create) && !livestream) { +#if 0 + if ((context == Context::Create)) { const auto makeLink = [](const QString &text) { return Ui::Text::Link(text); }; @@ -264,6 +265,7 @@ void ChooseJoinAsBox( return false; }); } +#endif box->addButton(std::move(next), [=] { auto copy = info; copy.joinAs = controller->selected(); 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 080f6cf17b..1e51616070 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -65,9 +65,8 @@ constexpr auto kEmojiInteractionSeenDuration = 3 * crl::time(1000); inline bool HasGroupCallMenu(const not_null &peer) { return !peer->groupCall() - && peer->isChannel() - && !peer->isMegagroup() - && peer->asChannel()->amCreator(); + && ((peer->isChannel() && peer->asChannel()->amCreator()) + || (peer->isChat() && peer->asChat()->amCreator())); } } // namespace @@ -345,16 +344,23 @@ void TopBarWidget::showGroupCallMenu(not_null peer) { const auto callback = [=](Calls::StartGroupCallArgs &&args) { controller->startOrJoinGroupCall(peer, std::move(args)); }; + const auto livestream = !peer->isMegagroup() && peer->isChannel(); _menu->addAction( - tr::lng_menu_start_group_call(tr::now), + livestream + ? tr::lng_menu_start_group_call_channel(tr::now) + : tr::lng_menu_start_group_call(tr::now), [=] { callback({}); }, &st::menuIconStartStream); _menu->addAction( - tr::lng_menu_start_group_call_scheduled(tr::now), + livestream + ? tr::lng_menu_start_group_call_scheduled_channel(tr::now) + : tr::lng_menu_start_group_call_scheduled(tr::now), [=] { callback({ .scheduleNeeded = true }); }, &st::menuIconReschedule); _menu->addAction( - tr::lng_menu_start_group_call_with(tr::now), + livestream + ? tr::lng_menu_start_group_call_with_channel(tr::now) + : tr::lng_menu_start_group_call_with(tr::now), [=] { callback({ .rtmpNeeded = true }); }, &st::menuIconStartStreamWith); _menu->moveToRight(