Added button for giveaway creating to boosts info.

This commit is contained in:
23rd 2023-10-24 13:54:52 +03:00 committed by John Preston
parent 9df551a145
commit e00016312e
3 changed files with 37 additions and 0 deletions

View file

@ -4316,6 +4316,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_boosts_list_status" = "boost expires on {date}";
"lng_boosts_link_title" = "Link for boosting";
"lng_boosts_link_subtext" = "Share this link with your subscribers to get more boosts.";
"lng_boosts_get_boosts" = "Get Boosts via Gifts";
"lng_boosts_get_boosts_subtext" = "Get more boosts for your channel by gifting Telegram Premium to your subscribers.";
// Wnd specific

View file

@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/peers/edit_peer_invite_link.h"
#include "info/boosts/info_boosts_widget.h"
#include "info/info_controller.h"
#include "info/profile/info_profile_icon.h"
#include "info/statistics/info_statistics_list_controllers.h"
#include "lang/lang_keys.h"
#include "settings/settings_common.h"
@ -19,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/controls/invite_link_buttons.h"
#include "ui/controls/invite_link_label.h"
#include "ui/rect.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
#include "styles/style_info.h"
#include "styles/style_statistics.h"
@ -174,6 +176,28 @@ void FillShareLink(
::Settings::AddSkip(content, st::boostsLinkFieldPadding.bottom());
}
void FillGetBoostsButton(
not_null<Ui::VerticalLayout*> content,
std::shared_ptr<Ui::Show> show,
not_null<PeerData*> peer) {
const auto &st = st::getBoostsButton;
const auto &icon = st::getBoostsButtonIcon;
const auto button = content->add(
::Settings::CreateButton(
content.get(),
tr::lng_boosts_get_boosts(),
st));
button->setClickedCallback([=] {
});
Ui::CreateChild<Info::Profile::FloatingIcon>(
button,
icon,
QPoint{
st::infoSharedMediaButtonIconPosition.x(),
(st.height + rect::m::sum::v(st.padding) - icon.height()) / 2,
})->show();
}
} // namespace
InnerWidget::InnerWidget(
@ -266,6 +290,11 @@ void InnerWidget::fill() {
::Settings::AddSkip(inner);
::Settings::AddDividerText(inner, tr::lng_boosts_link_subtext());
::Settings::AddSkip(inner);
FillGetBoostsButton(inner, _show, _peer);
::Settings::AddSkip(inner);
::Settings::AddDividerText(inner, tr::lng_boosts_get_boosts_subtext());
resizeToWidth(width());
crl::on_main([=]{ fakeShowed->fire({}); });
}

View file

@ -142,3 +142,9 @@ boostsButton: SettingsButton(defaultSettingsButton) {
textFg: lightButtonFg;
textFgOver: lightButtonFgOver;
}
getBoostsButton: SettingsButton(reportReasonButton) {
textFg: lightButtonFg;
textFgOver: lightButtonFg;
}
getBoostsButtonIcon: icon {{ "menu/gift_premium", lightButtonFg }};