mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-03 21:54:05 +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#other" = "**{count} people** were removed from the call.";
|
||||
"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.";
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ void ConferenceCallJoinConfirm(
|
|||
not_null<Ui::GenericBox*> box,
|
||||
std::shared_ptr<Data::GroupCall> call,
|
||||
UserData *maybeInviter,
|
||||
Fn<void()> join) {
|
||||
Fn<void(Fn<void()> close)> join) {
|
||||
box->setStyle(st::confcallJoinBox);
|
||||
box->setWidth(st::boxWideWidth);
|
||||
box->setNoContentMargin(true);
|
||||
|
@ -223,11 +223,11 @@ void ConferenceCallJoinConfirm(
|
|||
)->setTryMakeSimilarLines(true);
|
||||
}
|
||||
const auto joinAndClose = [=] {
|
||||
const auto weak = Ui::MakeWeak(box);
|
||||
join();
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
join([weak = Ui::MakeWeak(box)] {
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
});
|
||||
};
|
||||
Info::BotStarRef::AddFullWidthButton(
|
||||
box,
|
||||
|
|
|
@ -163,7 +163,7 @@ void ConferenceCallJoinConfirm(
|
|||
not_null<Ui::GenericBox*> box,
|
||||
std::shared_ptr<Data::GroupCall> call,
|
||||
UserData *maybeInviter,
|
||||
Fn<void()> join);
|
||||
Fn<void(Fn<void()> close)> join);
|
||||
|
||||
struct ConferenceCallLinkStyleOverrides {
|
||||
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_group_call.h"
|
||||
#include "info/profile/info_profile_icon.h"
|
||||
#include "main/main_session.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/text/text_utilities.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
|
@ -306,8 +307,8 @@ void ConfInviteController::toggleRowSelected(
|
|||
not_null<PeerListRow*> row,
|
||||
bool video) {
|
||||
auto count = fullCount();
|
||||
auto limit = Data::kMaxConferenceMembers;
|
||||
if (count < limit || row->checked()) {
|
||||
const auto conferenceLimit = session().appConfig().confcallSizeLimit();
|
||||
if (count < conferenceLimit || row->checked()) {
|
||||
const auto real = static_cast<ConfInviteRow*>(row.get());
|
||||
if (!row->checked()) {
|
||||
real->setVideo(video);
|
||||
|
|
|
@ -48,6 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_session.h"
|
||||
#include "data/data_changes.h"
|
||||
#include "main/session/session_show.h"
|
||||
#include "main/main_app_config.h"
|
||||
#include "main/main_session.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "base/unixtime.h"
|
||||
|
@ -1569,8 +1570,10 @@ void Panel::showMainMenu() {
|
|||
}
|
||||
|
||||
void Panel::addMembers() {
|
||||
const auto &appConfig = _call->peer()->session().appConfig();
|
||||
const auto conferenceLimit = appConfig.confcallSizeLimit();
|
||||
if (_call->conference()
|
||||
&& _call->conferenceCall()->fullCount() >= Data::kMaxConferenceMembers) {
|
||||
&& _call->conferenceCall()->fullCount() >= conferenceLimit) {
|
||||
showToast({ tr::lng_group_call_invite_limit(tr::now) });
|
||||
}
|
||||
const auto showToastCallback = [=](TextWithEntities &&text) {
|
||||
|
|
|
@ -30,8 +30,6 @@ namespace Data {
|
|||
|
||||
[[nodiscard]] const std::string &RtmpEndpointId();
|
||||
|
||||
inline constexpr auto kMaxConferenceMembers = 200;
|
||||
|
||||
struct LastSpokeTimes {
|
||||
crl::time anything = 0;
|
||||
crl::time voice = 0;
|
||||
|
|
|
@ -108,9 +108,16 @@ int AppConfig::pinnedGiftsLimit() const {
|
|||
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 {
|
||||
AssertIsDebug();
|
||||
return true;
|
||||
return get<bool>(u"confcall_use_vp8"_q, false);
|
||||
}
|
||||
|
||||
void AppConfig::refresh(bool force) {
|
||||
|
|
|
@ -79,6 +79,7 @@ public:
|
|||
|
||||
[[nodiscard]] int pinnedGiftsLimit() const;
|
||||
|
||||
[[nodiscard]] int confcallSizeLimit() const;
|
||||
[[nodiscard]] bool confcallPrioritizeVP8() const;
|
||||
|
||||
void refresh(bool force = false);
|
||||
|
|
|
@ -881,12 +881,19 @@ void SessionNavigation::resolveConferenceCall(
|
|||
data.vid().v,
|
||||
data.vaccess_hash().v);
|
||||
call->processFullCall(result);
|
||||
const auto join = [=] {
|
||||
Core::App().calls().startOrJoinConferenceCall({
|
||||
.call = call,
|
||||
.linkSlug = slug,
|
||||
.joinMessageId = inviteMsgId,
|
||||
});
|
||||
const auto join = [=](Fn<void()> close) {
|
||||
const auto &appConfig = call->peer()->session().appConfig();
|
||||
const auto conferenceLimit = appConfig.confcallSizeLimit();
|
||||
if (call->fullCount() >= conferenceLimit) {
|
||||
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 inviter = context
|
||||
|
|
Loading…
Add table
Reference in a new issue