mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Check confcall size limit.
This commit is contained in:
parent
b036bedbc3
commit
d50fad615f
9 changed files with 37 additions and 19 deletions
|
@ -4959,6 +4959,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_confcall_invite_kicked_many#one" = "**{count} person** was removed from the call.";
|
"lng_confcall_invite_kicked_many#one" = "**{count} person** was removed from the call.";
|
||||||
"lng_confcall_invite_kicked_many#other" = "**{count} people** were removed from the call.";
|
"lng_confcall_invite_kicked_many#other" = "**{count} people** were removed from the call.";
|
||||||
"lng_confcall_not_accessible" = "This call is no longer accessible.";
|
"lng_confcall_not_accessible" = "This call is no longer accessible.";
|
||||||
|
"lng_confcall_participants_limit" = "This call reached the participants limit.";
|
||||||
|
|
||||||
"lng_no_mic_permission" = "Telegram needs microphone access so that you can make calls and record voice messages.";
|
"lng_no_mic_permission" = "Telegram needs microphone access so that you can make calls and record voice messages.";
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ void ConferenceCallJoinConfirm(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
std::shared_ptr<Data::GroupCall> call,
|
std::shared_ptr<Data::GroupCall> call,
|
||||||
UserData *maybeInviter,
|
UserData *maybeInviter,
|
||||||
Fn<void()> join) {
|
Fn<void(Fn<void()> close)> join) {
|
||||||
box->setStyle(st::confcallJoinBox);
|
box->setStyle(st::confcallJoinBox);
|
||||||
box->setWidth(st::boxWideWidth);
|
box->setWidth(st::boxWideWidth);
|
||||||
box->setNoContentMargin(true);
|
box->setNoContentMargin(true);
|
||||||
|
@ -223,11 +223,11 @@ void ConferenceCallJoinConfirm(
|
||||||
)->setTryMakeSimilarLines(true);
|
)->setTryMakeSimilarLines(true);
|
||||||
}
|
}
|
||||||
const auto joinAndClose = [=] {
|
const auto joinAndClose = [=] {
|
||||||
const auto weak = Ui::MakeWeak(box);
|
join([weak = Ui::MakeWeak(box)] {
|
||||||
join();
|
if (const auto strong = weak.data()) {
|
||||||
if (const auto strong = weak.data()) {
|
strong->closeBox();
|
||||||
strong->closeBox();
|
}
|
||||||
}
|
});
|
||||||
};
|
};
|
||||||
Info::BotStarRef::AddFullWidthButton(
|
Info::BotStarRef::AddFullWidthButton(
|
||||||
box,
|
box,
|
||||||
|
|
|
@ -163,7 +163,7 @@ void ConferenceCallJoinConfirm(
|
||||||
not_null<Ui::GenericBox*> box,
|
not_null<Ui::GenericBox*> box,
|
||||||
std::shared_ptr<Data::GroupCall> call,
|
std::shared_ptr<Data::GroupCall> call,
|
||||||
UserData *maybeInviter,
|
UserData *maybeInviter,
|
||||||
Fn<void()> join);
|
Fn<void(Fn<void()> close)> join);
|
||||||
|
|
||||||
struct ConferenceCallLinkStyleOverrides {
|
struct ConferenceCallLinkStyleOverrides {
|
||||||
const style::Box *box = nullptr;
|
const style::Box *box = nullptr;
|
||||||
|
|
|
@ -18,8 +18,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_group_call.h"
|
#include "data/data_group_call.h"
|
||||||
#include "info/profile/info_profile_icon.h"
|
#include "info/profile/info_profile_icon.h"
|
||||||
#include "main/main_session.h"
|
|
||||||
#include "main/session/session_show.h"
|
#include "main/session/session_show.h"
|
||||||
|
#include "main/main_app_config.h"
|
||||||
|
#include "main/main_session.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/layers/generic_box.h"
|
#include "ui/layers/generic_box.h"
|
||||||
|
@ -306,8 +307,8 @@ void ConfInviteController::toggleRowSelected(
|
||||||
not_null<PeerListRow*> row,
|
not_null<PeerListRow*> row,
|
||||||
bool video) {
|
bool video) {
|
||||||
auto count = fullCount();
|
auto count = fullCount();
|
||||||
auto limit = Data::kMaxConferenceMembers;
|
const auto conferenceLimit = session().appConfig().confcallSizeLimit();
|
||||||
if (count < limit || row->checked()) {
|
if (count < conferenceLimit || row->checked()) {
|
||||||
const auto real = static_cast<ConfInviteRow*>(row.get());
|
const auto real = static_cast<ConfInviteRow*>(row.get());
|
||||||
if (!row->checked()) {
|
if (!row->checked()) {
|
||||||
real->setVideo(video);
|
real->setVideo(video);
|
||||||
|
|
|
@ -48,6 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_changes.h"
|
#include "data/data_changes.h"
|
||||||
#include "main/session/session_show.h"
|
#include "main/session/session_show.h"
|
||||||
|
#include "main/main_app_config.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "base/event_filter.h"
|
#include "base/event_filter.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
|
@ -1569,8 +1570,10 @@ void Panel::showMainMenu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::addMembers() {
|
void Panel::addMembers() {
|
||||||
|
const auto &appConfig = _call->peer()->session().appConfig();
|
||||||
|
const auto conferenceLimit = appConfig.confcallSizeLimit();
|
||||||
if (_call->conference()
|
if (_call->conference()
|
||||||
&& _call->conferenceCall()->fullCount() >= Data::kMaxConferenceMembers) {
|
&& _call->conferenceCall()->fullCount() >= conferenceLimit) {
|
||||||
showToast({ tr::lng_group_call_invite_limit(tr::now) });
|
showToast({ tr::lng_group_call_invite_limit(tr::now) });
|
||||||
}
|
}
|
||||||
const auto showToastCallback = [=](TextWithEntities &&text) {
|
const auto showToastCallback = [=](TextWithEntities &&text) {
|
||||||
|
|
|
@ -30,8 +30,6 @@ namespace Data {
|
||||||
|
|
||||||
[[nodiscard]] const std::string &RtmpEndpointId();
|
[[nodiscard]] const std::string &RtmpEndpointId();
|
||||||
|
|
||||||
inline constexpr auto kMaxConferenceMembers = 200;
|
|
||||||
|
|
||||||
struct LastSpokeTimes {
|
struct LastSpokeTimes {
|
||||||
crl::time anything = 0;
|
crl::time anything = 0;
|
||||||
crl::time voice = 0;
|
crl::time voice = 0;
|
||||||
|
|
|
@ -108,9 +108,16 @@ int AppConfig::pinnedGiftsLimit() const {
|
||||||
return get<int>(u"stargifts_pinned_to_top_limit"_q, 6);
|
return get<int>(u"stargifts_pinned_to_top_limit"_q, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AppConfig::confcallSizeLimit() const {
|
||||||
|
return get<int>(
|
||||||
|
u"conference_call_size_limit"_q,
|
||||||
|
_account->mtp().isTestMode() ? 5 : 100);
|
||||||
|
}
|
||||||
|
|
||||||
bool AppConfig::confcallPrioritizeVP8() const {
|
bool AppConfig::confcallPrioritizeVP8() const {
|
||||||
AssertIsDebug();
|
AssertIsDebug();
|
||||||
return true;
|
return true;
|
||||||
|
return get<bool>(u"confcall_use_vp8"_q, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppConfig::refresh(bool force) {
|
void AppConfig::refresh(bool force) {
|
||||||
|
|
|
@ -79,6 +79,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] int pinnedGiftsLimit() const;
|
[[nodiscard]] int pinnedGiftsLimit() const;
|
||||||
|
|
||||||
|
[[nodiscard]] int confcallSizeLimit() const;
|
||||||
[[nodiscard]] bool confcallPrioritizeVP8() const;
|
[[nodiscard]] bool confcallPrioritizeVP8() const;
|
||||||
|
|
||||||
void refresh(bool force = false);
|
void refresh(bool force = false);
|
||||||
|
|
|
@ -881,12 +881,19 @@ void SessionNavigation::resolveConferenceCall(
|
||||||
data.vid().v,
|
data.vid().v,
|
||||||
data.vaccess_hash().v);
|
data.vaccess_hash().v);
|
||||||
call->processFullCall(result);
|
call->processFullCall(result);
|
||||||
const auto join = [=] {
|
const auto join = [=](Fn<void()> close) {
|
||||||
Core::App().calls().startOrJoinConferenceCall({
|
const auto &appConfig = call->peer()->session().appConfig();
|
||||||
.call = call,
|
const auto conferenceLimit = appConfig.confcallSizeLimit();
|
||||||
.linkSlug = slug,
|
if (call->fullCount() >= conferenceLimit) {
|
||||||
.joinMessageId = inviteMsgId,
|
showToast(tr::lng_confcall_participants_limit(tr::now));
|
||||||
});
|
} else {
|
||||||
|
Core::App().calls().startOrJoinConferenceCall({
|
||||||
|
.call = call,
|
||||||
|
.linkSlug = slug,
|
||||||
|
.joinMessageId = inviteMsgId,
|
||||||
|
});
|
||||||
|
close();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const auto context = session().data().message(contextId);
|
const auto context = session().data().message(contextId);
|
||||||
const auto inviter = context
|
const auto inviter = context
|
||||||
|
|
Loading…
Add table
Reference in a new issue