mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-22 10:17:10 +00:00
Make big Upgrade button for gifts.
This commit is contained in:
parent
ee85bb9a1b
commit
77cec0e338
@ -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_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_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" = "This gift is in TON blockchain. {link}";
|
||||||
"lng_gift_in_blockchain_link" = "View >";
|
"lng_gift_in_blockchain_link_arrow" = "View {arrow}";
|
||||||
"lng_gift_visible_hide" = "Hide >";
|
"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_page" = "Display on my Page";
|
||||||
"lng_gift_show_on_channel" = "Display in channel's Gifts";
|
"lng_gift_show_on_channel" = "Display in channel's Gifts";
|
||||||
"lng_gift_availability" = "Availability";
|
"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_address_copied" = "Address copied to clipboard.";
|
||||||
"lng_gift_unique_status" = "Status";
|
"lng_gift_unique_status" = "Status";
|
||||||
"lng_gift_unique_status_non" = "Non-Unique";
|
"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" = "Collectible #{index}";
|
||||||
"lng_gift_unique_number_by" = "Collectible #{index} by {name}";
|
"lng_gift_unique_number_by" = "Collectible #{index} by {name}";
|
||||||
"lng_gift_unique_model" = "Model";
|
"lng_gift_unique_model" = "Model";
|
||||||
|
@ -466,8 +466,7 @@ void AddTableRow(
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] object_ptr<Ui::RpWidget> MakeNonUniqueStatusTableValue(
|
[[nodiscard]] object_ptr<Ui::RpWidget> MakeNonUniqueStatusTableValue(
|
||||||
not_null<Ui::TableLayout*> table,
|
not_null<Ui::TableLayout*> table) {
|
||||||
Fn<void()> startUpgrade) {
|
|
||||||
auto result = object_ptr<Ui::RpWidget>(table);
|
auto result = object_ptr<Ui::RpWidget>(table);
|
||||||
const auto raw = result.data();
|
const auto raw = result.data();
|
||||||
|
|
||||||
@ -477,34 +476,10 @@ void AddTableRow(
|
|||||||
table->st().defaultValue,
|
table->st().defaultValue,
|
||||||
st::defaultPopupMenu);
|
st::defaultPopupMenu);
|
||||||
|
|
||||||
const auto upgrade = startUpgrade
|
raw->widthValue(
|
||||||
? Ui::CreateChild<Ui::RoundButton>(
|
) | rpl::start_with_next([=](int width) {
|
||||||
raw,
|
label->resizeToNaturalWidth(width);
|
||||||
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);
|
|
||||||
label->moveToLeft(0, 0, 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->lifetime());
|
||||||
|
|
||||||
label->heightValue() | rpl::start_with_next([=](int height) {
|
label->heightValue() | rpl::start_with_next([=](int height) {
|
||||||
@ -1525,7 +1500,7 @@ void AddStarGiftTable(
|
|||||||
AddTableRow(
|
AddTableRow(
|
||||||
table,
|
table,
|
||||||
tr::lng_gift_unique_status(),
|
tr::lng_gift_unique_status(),
|
||||||
MakeNonUniqueStatusTableValue(table, std::move(startUpgrade)),
|
MakeNonUniqueStatusTableValue(table),
|
||||||
marginWithButton);
|
marginWithButton);
|
||||||
}
|
}
|
||||||
if (unique) {
|
if (unique) {
|
||||||
|
@ -4967,9 +4967,10 @@ void UpgradeBox(
|
|||||||
(cost
|
(cost
|
||||||
? tr::lng_gift_upgrade_button(
|
? tr::lng_gift_upgrade_button(
|
||||||
lt_price,
|
lt_price,
|
||||||
rpl::single(star.append(
|
rpl::single(Ui::Text::IconEmoji(
|
||||||
' ' + Lang::FormatCreditsAmountDecimal(
|
&st::starIconEmoji
|
||||||
CreditsAmount{ cost }))),
|
).append(' ').append(Lang::FormatCreditsAmountDecimal(
|
||||||
|
CreditsAmount{ cost }))),
|
||||||
Ui::Text::WithEntities)
|
Ui::Text::WithEntities)
|
||||||
: tr::lng_gift_upgrade_confirm(Ui::Text::WithEntities)),
|
: tr::lng_gift_upgrade_confirm(Ui::Text::WithEntities)),
|
||||||
helper.context(),
|
helper.context(),
|
||||||
|
@ -1884,14 +1884,29 @@ void GenericCreditsEntryBox(
|
|||||||
const auto visiblePhrase = giftToChannelCanManage
|
const auto visiblePhrase = giftToChannelCanManage
|
||||||
? tr::lng_gift_visible_hint_channel
|
? tr::lng_gift_visible_hint_channel
|
||||||
: tr::lng_gift_visible_hint;
|
: tr::lng_gift_visible_hint;
|
||||||
auto withHide = rpl::combine(
|
auto withShow = rpl::combine(
|
||||||
visiblePhrase(),
|
hiddenPhrase(),
|
||||||
tr::lng_gift_visible_hide()
|
tr::lng_gift_visible_show_arrow(
|
||||||
) | rpl::map([](QString &&hint, QString &&hide) {
|
lt_arrow,
|
||||||
|
rpl::single(arrow),
|
||||||
|
Ui::Text::WithEntities)
|
||||||
|
) | rpl::map([=](QString &&hint, const TextWithEntities &hide) {
|
||||||
return TextWithEntities{ std::move(hint) }.append(' ').append(
|
return TextWithEntities{ std::move(hint) }.append(' ').append(
|
||||||
Ui::Text::Link(std::move(hide)));
|
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)
|
? hiddenPhrase(Ui::Text::WithEntities)
|
||||||
: canToggle
|
: canToggle
|
||||||
? std::move(withHide)
|
? std::move(withHide)
|
||||||
@ -1921,7 +1936,11 @@ void GenericCreditsEntryBox(
|
|||||||
box,
|
box,
|
||||||
tr::lng_gift_in_blockchain(
|
tr::lng_gift_in_blockchain(
|
||||||
lt_link,
|
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),
|
Ui::Text::WithEntities),
|
||||||
st::creditsBoxAboutDivider));
|
st::creditsBoxAboutDivider));
|
||||||
label->setClickHandlerFilter([=](const auto &...) {
|
label->setClickHandlerFilter([=](const auto &...) {
|
||||||
@ -2005,6 +2024,8 @@ void GenericCreditsEntryBox(
|
|||||||
? tr::lng_credits_subscription_off_rejoin_button()
|
? tr::lng_credits_subscription_off_rejoin_button()
|
||||||
: canUpgradeFree
|
: canUpgradeFree
|
||||||
? tr::lng_gift_upgrade_free()
|
? tr::lng_gift_upgrade_free()
|
||||||
|
: canUpgrade
|
||||||
|
? tr::lng_gift_unique_upgrade()
|
||||||
: (canToggle && !e.savedToProfile)
|
: (canToggle && !e.savedToProfile)
|
||||||
? (e.giftChannelSavedId
|
? (e.giftChannelSavedId
|
||||||
? tr::lng_gift_show_on_channel
|
? tr::lng_gift_show_on_channel
|
||||||
@ -2074,7 +2095,7 @@ void GenericCreditsEntryBox(
|
|||||||
e.giftResaleForceTon,
|
e.giftResaleForceTon,
|
||||||
to,
|
to,
|
||||||
crl::guard(box, [=] { box->closeBox(); }));
|
crl::guard(box, [=] { box->closeBox(); }));
|
||||||
} else if (canUpgradeFree) {
|
} else if (canUpgrade) {
|
||||||
upgrade();
|
upgrade();
|
||||||
} else if (canToggle && !e.savedToProfile) {
|
} else if (canToggle && !e.savedToProfile) {
|
||||||
toggleVisibility(true);
|
toggleVisibility(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user