| 4107 | } |
| 4108 | |
| 4109 | bool FillVideoChatMenu( |
| 4110 | not_null<SessionController*> controller, |
| 4111 | Dialogs::EntryState request, |
| 4112 | const PeerMenuCallback &addAction) { |
| 4113 | const auto peer = request.key.peer(); |
| 4114 | if (!peer || peer->isUser()) { |
| 4115 | return false; |
| 4116 | } |
| 4117 | |
| 4118 | const auto callback = [=](Calls::StartGroupCallArgs &&args) { |
| 4119 | controller->startOrJoinGroupCall(peer, std::move(args)); |
| 4120 | }; |
| 4121 | const auto rtmpCallback = [=] { |
| 4122 | Core::App().calls().showStartWithRtmp(controller->uiShow(), peer); |
| 4123 | }; |
| 4124 | const auto livestream = !peer->isMegagroup() && peer->isChannel(); |
| 4125 | const auto has = (peer->groupCall() != nullptr); |
| 4126 | const auto manager = peer->canManageGroupCall(); |
| 4127 | if (has) { |
| 4128 | addAction( |
| 4129 | tr::lng_menu_start_group_call_join(tr::now), |
| 4130 | [=] { callback({}); }, |
| 4131 | &st::menuIconVideoChat); |
| 4132 | } else if (manager) { |
| 4133 | addAction( |
| 4134 | (livestream |
| 4135 | ? tr::lng_menu_start_group_call_channel |
| 4136 | : tr::lng_menu_start_group_call)(tr::now), |
| 4137 | [=] { callback({}); }, |
| 4138 | &st::menuIconStartStream); |
| 4139 | } |
| 4140 | if (!has && manager) { |
| 4141 | addAction( |
| 4142 | (livestream |
| 4143 | ? tr::lng_menu_start_group_call_scheduled_channel |
| 4144 | : tr::lng_menu_start_group_call_scheduled)(tr::now), |
| 4145 | [=] { callback({ .scheduleNeeded = true }); }, |
| 4146 | &st::menuIconReschedule); |
| 4147 | addAction( |
| 4148 | (livestream |
| 4149 | ? tr::lng_menu_start_group_call_with_channel |
| 4150 | : tr::lng_menu_start_group_call_with)(tr::now), |
| 4151 | rtmpCallback, |
| 4152 | &st::menuIconStartStreamWith); |
| 4153 | } |
| 4154 | return has || manager; |
| 4155 | } |
| 4156 | |
| 4157 | void FillSenderUserpicMenu( |
| 4158 | not_null<SessionController*> controller, |
no test coverage detected