diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index e7cff1fa3d..c5481df459 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3611,8 +3611,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_gift_hidden_hint_channel" = "This gift is hidden from visitors of your channel."; "lng_gift_visible_hint_channel" = "This gift is visible in your channel's Gifts."; "lng_gift_in_blockchain" = "This gift is in TON blockchain. {link}"; -"lng_gift_in_blockchain_link" = "View >"; -"lng_gift_visible_hide" = "Hide >"; +"lng_gift_in_blockchain_link_arrow" = "View {arrow}"; +"lng_gift_visible_hide_arrow" = "Hide {arrow}"; +"lng_gift_visible_show_arrow" = "Show {arrow}"; "lng_gift_show_on_page" = "Display on my Page"; "lng_gift_show_on_channel" = "Display in channel's Gifts"; "lng_gift_availability" = "Availability"; @@ -3631,7 +3632,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_gift_unique_address_copied" = "Address copied to clipboard."; "lng_gift_unique_status" = "Status"; "lng_gift_unique_status_non" = "Non-Unique"; -"lng_gift_unique_status_upgrade" = "upgrade"; +"lng_gift_unique_upgrade" = "Upgrade"; "lng_gift_unique_number" = "Collectible #{index}"; "lng_gift_unique_number_by" = "Collectible #{index} by {name}"; "lng_gift_unique_model" = "Model"; diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index 16fab1907a..0da643c073 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -466,8 +466,7 @@ void AddTableRow( } [[nodiscard]] object_ptr MakeNonUniqueStatusTableValue( - not_null table, - Fn startUpgrade) { + not_null table) { auto result = object_ptr(table); const auto raw = result.data(); @@ -477,34 +476,10 @@ void AddTableRow( table->st().defaultValue, st::defaultPopupMenu); - const auto upgrade = startUpgrade - ? Ui::CreateChild( - raw, - tr::lng_gift_unique_status_upgrade(), - table->st().smallButton) - : (Ui::RoundButton*)(nullptr); - if (upgrade) { - using namespace Ui; - upgrade->setTextTransform(RoundButton::TextTransform::NoTransform); - upgrade->setClickedCallback(startUpgrade); - } - - rpl::combine( - raw->widthValue(), - upgrade ? upgrade->widthValue() : rpl::single(0) - ) | rpl::start_with_next([=](int width, int toggleWidth) { - const auto toggleSkip = toggleWidth - ? (st::normalFont->spacew + toggleWidth) - : 0; - label->resizeToNaturalWidth(width - toggleSkip); + raw->widthValue( + ) | rpl::start_with_next([=](int width) { + label->resizeToNaturalWidth(width); label->moveToLeft(0, 0, width); - if (upgrade) { - upgrade->moveToLeft( - label->width() + st::normalFont->spacew, - (table->st().defaultValue.style.font->ascent - - table->st().smallButton.style.font->ascent), - width); - } }, label->lifetime()); label->heightValue() | rpl::start_with_next([=](int height) { @@ -1525,7 +1500,7 @@ void AddStarGiftTable( AddTableRow( table, tr::lng_gift_unique_status(), - MakeNonUniqueStatusTableValue(table, std::move(startUpgrade)), + MakeNonUniqueStatusTableValue(table), marginWithButton); } if (unique) { diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index 175f951031..ef50dea3d6 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -4967,9 +4967,10 @@ void UpgradeBox( (cost ? tr::lng_gift_upgrade_button( lt_price, - rpl::single(star.append( - ' ' + Lang::FormatCreditsAmountDecimal( - CreditsAmount{ cost }))), + rpl::single(Ui::Text::IconEmoji( + &st::starIconEmoji + ).append(' ').append(Lang::FormatCreditsAmountDecimal( + CreditsAmount{ cost }))), Ui::Text::WithEntities) : tr::lng_gift_upgrade_confirm(Ui::Text::WithEntities)), helper.context(), diff --git a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp index 74ce6624a5..9f5338da4b 100644 --- a/Telegram/SourceFiles/settings/settings_credits_graphics.cpp +++ b/Telegram/SourceFiles/settings/settings_credits_graphics.cpp @@ -1884,14 +1884,29 @@ void GenericCreditsEntryBox( const auto visiblePhrase = giftToChannelCanManage ? tr::lng_gift_visible_hint_channel : tr::lng_gift_visible_hint; - auto withHide = rpl::combine( - visiblePhrase(), - tr::lng_gift_visible_hide() - ) | rpl::map([](QString &&hint, QString &&hide) { + auto withShow = rpl::combine( + hiddenPhrase(), + tr::lng_gift_visible_show_arrow( + lt_arrow, + rpl::single(arrow), + Ui::Text::WithEntities) + ) | rpl::map([=](QString &&hint, const TextWithEntities &hide) { return TextWithEntities{ std::move(hint) }.append(' ').append( Ui::Text::Link(std::move(hide))); }); - auto text = !e.savedToProfile + auto withHide = rpl::combine( + visiblePhrase(), + tr::lng_gift_visible_hide_arrow( + lt_arrow, + rpl::single(arrow), + Ui::Text::WithEntities) + ) | rpl::map([](QString &&hint, const TextWithEntities &hide) { + return TextWithEntities{ std::move(hint) }.append(' ').append( + Ui::Text::Link(std::move(hide))); + }); + auto text = (!e.savedToProfile && canToggle && canUpgrade) + ? std::move(withShow) + : !e.savedToProfile ? hiddenPhrase(Ui::Text::WithEntities) : canToggle ? std::move(withHide) @@ -1921,7 +1936,11 @@ void GenericCreditsEntryBox( box, tr::lng_gift_in_blockchain( lt_link, - tr::lng_gift_in_blockchain_link() | Ui::Text::ToLink(), + tr::lng_gift_in_blockchain_link_arrow( + lt_arrow, + rpl::single(arrow), + Ui::Text::WithEntities + ) | Ui::Text::ToLink(), Ui::Text::WithEntities), st::creditsBoxAboutDivider)); label->setClickHandlerFilter([=](const auto &...) { @@ -2005,6 +2024,8 @@ void GenericCreditsEntryBox( ? tr::lng_credits_subscription_off_rejoin_button() : canUpgradeFree ? tr::lng_gift_upgrade_free() + : canUpgrade + ? tr::lng_gift_unique_upgrade() : (canToggle && !e.savedToProfile) ? (e.giftChannelSavedId ? tr::lng_gift_show_on_channel @@ -2074,7 +2095,7 @@ void GenericCreditsEntryBox( e.giftResaleForceTon, to, crl::guard(box, [=] { box->closeBox(); })); - } else if (canUpgradeFree) { + } else if (canUpgrade) { upgrade(); } else if (canToggle && !e.savedToProfile) { toggleVisibility(true);