mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-03 18:49:30 +00:00
Star-count button in multi-Forward/CreatePoll.
This commit is contained in:
@@ -817,13 +817,15 @@ CreatePollBox::CreatePollBox(
|
||||
not_null<Window::SessionController*> controller,
|
||||
PollData::Flags chosen,
|
||||
PollData::Flags disabled,
|
||||
rpl::producer<int> starsRequired,
|
||||
Api::SendType sendType,
|
||||
SendMenu::Details sendMenuDetails)
|
||||
: _controller(controller)
|
||||
, _chosen(chosen)
|
||||
, _disabled(disabled)
|
||||
, _sendType(sendType)
|
||||
, _sendMenuDetails([result = sendMenuDetails] { return result; }) {
|
||||
, _sendMenuDetails([result = sendMenuDetails] { return result; })
|
||||
, _starsRequired(std::move(starsRequired)) {
|
||||
}
|
||||
|
||||
rpl::producer<CreatePollBox::Result> CreatePollBox::submitRequests() const {
|
||||
@@ -1226,10 +1228,18 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||
_sendMenuDetails());
|
||||
};
|
||||
const auto submit = addButton(
|
||||
(isNormal
|
||||
? tr::lng_polls_create_button()
|
||||
: tr::lng_schedule_button()),
|
||||
tr::lng_polls_create_button(),
|
||||
[=] { isNormal ? send({}) : schedule(); });
|
||||
submit->setText(_starsRequired.value() | rpl::map([=](int stars) {
|
||||
using namespace Ui;
|
||||
if (!stars) {
|
||||
return (isNormal
|
||||
? tr::lng_polls_create_button
|
||||
: tr::lng_schedule_button)(tr::now, Text::WithEntities);
|
||||
}
|
||||
return Text::IconEmoji(&st::boxStarIconEmoji).append(
|
||||
Lang::FormatCountToShort(stars).string);
|
||||
}));
|
||||
const auto sendMenuDetails = [=] {
|
||||
collectError();
|
||||
return (*error) ? SendMenu::Details() : _sendMenuDetails();
|
||||
|
||||
Reference in New Issue
Block a user