From 0248be5543a3598b2d37d7d7ac44c7a829eedeaf Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sat, 16 Nov 2024 07:33:44 +0300 Subject: [PATCH] Removed from display extended credits topup options by default. --- Telegram/Resources/langs/lang.strings | 1 + .../settings/settings_credits_graphics.cpp | 40 +++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 6b143da2c..82e45d90f 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2413,6 +2413,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_credits_summary_history_tab_out" = "Outgoing"; "lng_credits_summary_history_entry_inner_in" = "In-App Purchase"; "lng_credits_summary_balance" = "Balance"; +"lng_credits_more_options" = "More Options"; "lng_credits_gift_button" = "Gift Stars to Friends"; "lng_credits_box_out_title" = "Confirm Your Purchase"; "lng_credits_box_out_sure#one" = "Do you want to buy **\"{text}\"** in **{bot}** for **{count} Star**?"; diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index 849a08120..ba0f18b92 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -58,6 +58,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/premium_graphics.h" #include "ui/effects/premium_stars_colored.h" #include "ui/effects/premium_top_bar.h" +#include "ui/effects/toggle_arrow.h" #include "ui/image/image_prepare.h" #include "ui/layers/generic_box.h" #include "ui/painter.h" @@ -417,6 +418,23 @@ void FillCreditOptions( Ui::AddSubsectionTitle( content, tr::lng_credits_summary_options_subtitle()); + + const auto buttons = content->add( + object_ptr(content)); + + const auto showMoreWrap = content->add( + object_ptr>( + content, + object_ptr( + content, + tr::lng_credits_more_options(), + st::statisticsShowMoreButton))); + const auto showMore = showMoreWrap->entity(); + showMore->setClickedCallback([=] { + showMoreWrap->toggle(false, anim::type::instant); + }); + Ui::AddToggleUpDownArrowToMoreButton(showMore); + const auto &st = st::creditsTopupButton; const auto diffBetweenTextAndStar = st.padding.left() - st.iconLeft @@ -431,10 +449,24 @@ void FillCreditOptions( if (option.credits < minCredits) { continue; } - const auto button = content->add(object_ptr( - content, - rpl::never(), - st)); + const auto button = [&] { + auto owned = object_ptr( + buttons, + rpl::never(), + st); + if (!option.extended) { + return buttons->add(std::move(owned)); + } + const auto wrap = buttons->add( + object_ptr>( + buttons, + std::move(owned))); + wrap->toggle(false, anim::type::instant); + showMore->clicks() | rpl::start_with_next([=] { + wrap->toggle(true, anim::type::normal); + }, wrap->lifetime()); + return wrap->entity(); + }(); const auto text = button->lifetime().make_state( st.style, tr::lng_credits_summary_options_credits(