mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-26 15:33:02 +02:00
Support polls with 12 options.
This commit is contained in:
parent
d7c964afc5
commit
2a153214f6
4 changed files with 16 additions and 4 deletions
|
@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/stickers/data_custom_emoji.h"
|
#include "data/stickers/data_custom_emoji.h"
|
||||||
#include "history/view/history_view_schedule_box.h"
|
#include "history/view/history_view_schedule_box.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "main/main_app_config.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "menu/menu_send.h"
|
#include "menu/menu_send.h"
|
||||||
#include "ui/controls/emoji_button.h"
|
#include "ui/controls/emoji_button.h"
|
||||||
|
@ -510,7 +511,8 @@ Options::Options(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Options::full() const {
|
bool Options::full() const {
|
||||||
return (_list.size() == kMaxOptionsCount);
|
const auto limit = _controller->session().appConfig().pollOptionsLimit();
|
||||||
|
return (_list.size() >= limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Options::hasOptions() const {
|
bool Options::hasOptions() const {
|
||||||
|
@ -1028,8 +1030,10 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||||
setCloseByEscape(!count);
|
setCloseByEscape(!count);
|
||||||
setCloseByOutsideClick(!count);
|
setCloseByOutsideClick(!count);
|
||||||
}) | rpl::map([=](int count) {
|
}) | rpl::map([=](int count) {
|
||||||
return (count < kMaxOptionsCount)
|
const auto appConfig = &_controller->session().appConfig();
|
||||||
? tr::lng_polls_create_limit(tr::now, lt_count, kMaxOptionsCount - count)
|
const auto max = appConfig->pollOptionsLimit();
|
||||||
|
return (count < max)
|
||||||
|
? tr::lng_polls_create_limit(tr::now, lt_count, max - count)
|
||||||
: tr::lng_polls_create_maximum(tr::now);
|
: tr::lng_polls_create_maximum(tr::now);
|
||||||
}) | rpl::after_next([=] {
|
}) | rpl::after_next([=] {
|
||||||
container->resizeToWidth(container->widthNoMargins());
|
container->resizeToWidth(container->widthNoMargins());
|
||||||
|
|
|
@ -75,7 +75,7 @@ struct PollData {
|
||||||
int totalVoters = 0;
|
int totalVoters = 0;
|
||||||
int version = 0;
|
int version = 0;
|
||||||
|
|
||||||
static constexpr auto kMaxOptions = 10;
|
static constexpr auto kMaxOptions = 32;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool applyResultToAnswers(
|
bool applyResultToAnswers(
|
||||||
|
|
|
@ -140,6 +140,12 @@ int AppConfig::giftResaleReceiveThousandths() const {
|
||||||
return get<int>(u"stars_stargift_resale_commission_permille"_q, 800);
|
return get<int>(u"stars_stargift_resale_commission_permille"_q, 800);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AppConfig::pollOptionsLimit() const {
|
||||||
|
return get<int>(
|
||||||
|
u"poll_answers_max"_q,
|
||||||
|
_account->mtp().isTestMode() ? 12 : 10);
|
||||||
|
}
|
||||||
|
|
||||||
void AppConfig::refresh(bool force) {
|
void AppConfig::refresh(bool force) {
|
||||||
if (_requestId || !_api) {
|
if (_requestId || !_api) {
|
||||||
if (force) {
|
if (force) {
|
||||||
|
|
|
@ -82,6 +82,8 @@ public:
|
||||||
[[nodiscard]] int giftResalePriceMin() const;
|
[[nodiscard]] int giftResalePriceMin() const;
|
||||||
[[nodiscard]] int giftResaleReceiveThousandths() const;
|
[[nodiscard]] int giftResaleReceiveThousandths() const;
|
||||||
|
|
||||||
|
[[nodiscard]] int pollOptionsLimit() const;
|
||||||
|
|
||||||
void refresh(bool force = false);
|
void refresh(bool force = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Reference in a new issue