From e00016312ed538014c1603b458bea9518b72edaa Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 24 Oct 2023 13:54:52 +0300 Subject: [PATCH] Added button for giveaway creating to boosts info. --- Telegram/Resources/langs/lang.strings | 2 ++ .../info/boosts/info_boosts_inner_widget.cpp | 29 +++++++++++++++++++ .../SourceFiles/statistics/statistics.style | 6 ++++ 3 files changed, 37 insertions(+) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 183b86acd..b8e1b160b 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -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 diff --git a/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp b/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp index 89dc03081..da6e11c48 100644 --- a/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp +++ b/Telegram/SourceFiles/info/boosts/info_boosts_inner_widget.cpp @@ -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 content, + std::shared_ptr show, + not_null 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( + 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({}); }); } diff --git a/Telegram/SourceFiles/statistics/statistics.style b/Telegram/SourceFiles/statistics/statistics.style index f797dbc1a..c631a4f30 100644 --- a/Telegram/SourceFiles/statistics/statistics.style +++ b/Telegram/SourceFiles/statistics/statistics.style @@ -142,3 +142,9 @@ boostsButton: SettingsButton(defaultSettingsButton) { textFg: lightButtonFg; textFgOver: lightButtonFgOver; } + +getBoostsButton: SettingsButton(reportReasonButton) { + textFg: lightButtonFg; + textFgOver: lightButtonFg; +} +getBoostsButtonIcon: icon {{ "menu/gift_premium", lightButtonFg }};