mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Partially implement sending gifts to channels.
This commit is contained in:
parent
6ff5e221ea
commit
2fd174ab9c
9 changed files with 108 additions and 39 deletions
|
@ -2027,11 +2027,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_action_gift_transferred" = "{user} transferred you a gift";
|
"lng_action_gift_transferred" = "{user} transferred you a gift";
|
||||||
"lng_action_gift_transferred_mine" = "You transferred a gift to {user}";
|
"lng_action_gift_transferred_mine" = "You transferred a gift to {user}";
|
||||||
"lng_action_gift_received_anonymous" = "Unknown user sent you a gift for {cost}";
|
"lng_action_gift_received_anonymous" = "Unknown user sent you a gift for {cost}";
|
||||||
|
"lng_action_gift_sent_channel" = "{user} sent a gift to {name} for {cost}";
|
||||||
"lng_action_gift_self_bought" = "You bought a gift for {cost}";
|
"lng_action_gift_self_bought" = "You bought a gift for {cost}";
|
||||||
"lng_action_gift_self_subtitle" = "Saved Gift";
|
"lng_action_gift_self_subtitle" = "Saved Gift";
|
||||||
"lng_action_gift_self_about#one" = "Display this gift on your page or convert it to **{count}** Star.";
|
"lng_action_gift_self_about#one" = "Display this gift on your page or convert it to **{count}** Star.";
|
||||||
"lng_action_gift_self_about#other" = "Display this gift on your page or convert it to **{count}** Stars.";
|
"lng_action_gift_self_about#other" = "Display this gift on your page or convert it to **{count}** Stars.";
|
||||||
"lng_action_gift_self_about_unique" = "You can display this gift on your page or turn it into unique collectible and send to others.";
|
"lng_action_gift_self_about_unique" = "You can display this gift on your page or turn it into unique collectible and send to others.";
|
||||||
|
"lng_action_gift_channel_about#one" = "Display this gift in channel's Gifts or convert it to **{count}** Star.";
|
||||||
|
"lng_action_gift_channel_about#other" = "Display this gift in channel's Gifts or convert it to **{count}** Stars.";
|
||||||
|
"lng_action_gift_channel_about_unique" = "You can display this gift in channel's Gifts or turn it into unique collectible.";
|
||||||
"lng_action_gift_for_stars#one" = "{count} Star";
|
"lng_action_gift_for_stars#one" = "{count} Star";
|
||||||
"lng_action_gift_for_stars#other" = "{count} Stars";
|
"lng_action_gift_for_stars#other" = "{count} Stars";
|
||||||
"lng_action_gift_got_subtitle" = "Gift from {user}";
|
"lng_action_gift_got_subtitle" = "Gift from {user}";
|
||||||
|
@ -2118,6 +2122,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_peer_gifts_title" = "Gifts";
|
"lng_peer_gifts_title" = "Gifts";
|
||||||
"lng_peer_gifts_about" = "These gifts were sent to {user} by other users.";
|
"lng_peer_gifts_about" = "These gifts were sent to {user} by other users.";
|
||||||
"lng_peer_gifts_about_mine" = "These gifts were sent to you by other users. Click on a gift to convert it to Stars or change its privacy settings.";
|
"lng_peer_gifts_about_mine" = "These gifts were sent to you by other users. Click on a gift to convert it to Stars or change its privacy settings.";
|
||||||
|
"lng_peer_gifts_notify" = "Notify About New Gifts";
|
||||||
|
"lng_peer_gifts_notify_enabled" = "You will receive a message from Telegram when your channel receives a gift.";
|
||||||
|
|
||||||
"lng_premium_gift_duration_months#one" = "for {count} month";
|
"lng_premium_gift_duration_months#one" = "for {count} month";
|
||||||
"lng_premium_gift_duration_months#other" = "for {count} months";
|
"lng_premium_gift_duration_months#other" = "for {count} months";
|
||||||
|
@ -2968,6 +2974,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_boost_group_needs_level_emoji#one" = "Your group needs to reach **Level {count}** to set emoji pack.";
|
"lng_boost_group_needs_level_emoji#one" = "Your group needs to reach **Level {count}** to set emoji pack.";
|
||||||
"lng_boost_group_needs_level_emoji#other" = "Your group needs to reach **Level {count}** to set emoji pack.";
|
"lng_boost_group_needs_level_emoji#other" = "Your group needs to reach **Level {count}** to set emoji pack.";
|
||||||
|
|
||||||
|
"lng_boost_channel_title_wear" = "Wear Item";
|
||||||
|
"lng_boost_channel_needs_level_wear#one" = "Your channel needs **Level {count}** to wear collectibles.";
|
||||||
|
"lng_boost_channel_needs_level_wear#other" = "Your channel needs **Level {count}** to wear collectibles.";
|
||||||
|
|
||||||
"lng_boost_channel_ask" = "Ask your **Premium** subscribers to boost your channel with this link:";
|
"lng_boost_channel_ask" = "Ask your **Premium** subscribers to boost your channel with this link:";
|
||||||
"lng_boost_channel_ask_button" = "Copy Link";
|
"lng_boost_channel_ask_button" = "Copy Link";
|
||||||
"lng_boost_channel_or" = "or";
|
"lng_boost_channel_or" = "or";
|
||||||
|
@ -3247,10 +3257,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_gift_send_anonymous" = "Hide My Name";
|
"lng_gift_send_anonymous" = "Hide My Name";
|
||||||
"lng_gift_send_anonymous_self" = "Hide my name and message from visitors to my profile.";
|
"lng_gift_send_anonymous_self" = "Hide my name and message from visitors to my profile.";
|
||||||
"lng_gift_send_anonymous_about" = "You can hide your name and message from visitors to {user}'s profile. {recipient} will still see your name and message.";
|
"lng_gift_send_anonymous_about" = "You can hide your name and message from visitors to {user}'s profile. {recipient} will still see your name and message.";
|
||||||
|
"lng_gift_send_anonymous_about_channel" = "You can hide your name and message from all visitors of this channel except its admins.";
|
||||||
"lng_gift_send_unique" = "Make Unique for {price}";
|
"lng_gift_send_unique" = "Make Unique for {price}";
|
||||||
"lng_gift_send_unique_about" = "Enable this to let {user} turn your gift into a unique collectible. {link}";
|
"lng_gift_send_unique_about" = "Enable this to let {user} turn your gift into a unique collectible. {link}";
|
||||||
|
"lng_gift_send_unique_about_channel" = "Enable this to let the admins of {name} turn your gift into a unique collectible. {link}";
|
||||||
"lng_gift_send_unique_link" = "Learn More >";
|
"lng_gift_send_unique_link" = "Learn More >";
|
||||||
"lng_gift_send_premium_about" = "Only {user} will see your message.";
|
"lng_gift_send_premium_about" = "Only {user} will see your message.";
|
||||||
|
"lng_gift_send_limited_sold#one" = "{count} sold";
|
||||||
|
"lng_gift_send_limited_sold#other" = "{count} sold";
|
||||||
|
"lng_gift_send_limited_left#one" = "{count} left";
|
||||||
|
"lng_gift_send_limited_left#other" = "{count} left";
|
||||||
"lng_gift_send_button" = "Send a Gift for {cost}";
|
"lng_gift_send_button" = "Send a Gift for {cost}";
|
||||||
"lng_gift_send_button_self" = "Buy a Gift for {cost}";
|
"lng_gift_send_button_self" = "Buy a Gift for {cost}";
|
||||||
"lng_gift_sent_title" = "Gift Sent!";
|
"lng_gift_sent_title" = "Gift Sent!";
|
||||||
|
@ -3264,6 +3280,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_gift_anonymous_hint" = "Only you can see the sender's name.";
|
"lng_gift_anonymous_hint" = "Only you can see the sender's name.";
|
||||||
"lng_gift_hidden_hint" = "This gift is hidden. Only you can see it.";
|
"lng_gift_hidden_hint" = "This gift is hidden. Only you can see it.";
|
||||||
"lng_gift_visible_hint" = "This gift is visible to visitors of your page.";
|
"lng_gift_visible_hint" = "This gift is visible to visitors of your page.";
|
||||||
|
"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_availability" = "Availability";
|
"lng_gift_availability" = "Availability";
|
||||||
"lng_gift_from_hidden" = "Hidden User";
|
"lng_gift_from_hidden" = "Hidden User";
|
||||||
"lng_gift_visibility" = "Visibility";
|
"lng_gift_visibility" = "Visibility";
|
||||||
|
@ -3274,6 +3292,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_gift_self_status" = "buy yourself a gift";
|
"lng_gift_self_status" = "buy yourself a gift";
|
||||||
"lng_gift_self_title" = "Buy a Gift";
|
"lng_gift_self_title" = "Buy a Gift";
|
||||||
"lng_gift_self_about" = "Buy yourself a gift to display on your page or reserve for later.\n\nLimited-edition gifts upgraded to collectibles can be gifted to others later.";
|
"lng_gift_self_about" = "Buy yourself a gift to display on your page or reserve for later.\n\nLimited-edition gifts upgraded to collectibles can be gifted to others later.";
|
||||||
|
"lng_gift_channel_title" = "Send a Gift";
|
||||||
|
"lng_gift_channel_about" = "Select a gift to show appreciation for {name}.";
|
||||||
"lng_gift_unique_owner" = "Owner";
|
"lng_gift_unique_owner" = "Owner";
|
||||||
"lng_gift_unique_owner_change" = "change";
|
"lng_gift_unique_owner_change" = "change";
|
||||||
"lng_gift_unique_status" = "Status";
|
"lng_gift_unique_status" = "Status";
|
||||||
|
@ -3317,6 +3337,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_gift_upgrade_about" = "Turn your gift into a unique collectible\nthat you can transfer or auction.";
|
"lng_gift_upgrade_about" = "Turn your gift into a unique collectible\nthat you can transfer or auction.";
|
||||||
"lng_gift_upgrade_preview_title" = "Make Unique";
|
"lng_gift_upgrade_preview_title" = "Make Unique";
|
||||||
"lng_gift_upgrade_preview_about" = "Let {name} turn your gift into a unique collectible.";
|
"lng_gift_upgrade_preview_about" = "Let {name} turn your gift into a unique collectible.";
|
||||||
|
"lng_gift_upgrade_preview_about_channel" = "Let the admins of {name} turn your gift into a unique collectible.";
|
||||||
"lng_gift_upgrade_unique_title" = "Unique";
|
"lng_gift_upgrade_unique_title" = "Unique";
|
||||||
"lng_gift_upgrade_unique_about" = "Get a unique number, model, backdrop and symbol for your gift.";
|
"lng_gift_upgrade_unique_about" = "Get a unique number, model, backdrop and symbol for your gift.";
|
||||||
"lng_gift_upgrade_transferable_title" = "Transferable";
|
"lng_gift_upgrade_transferable_title" = "Transferable";
|
||||||
|
|
|
@ -274,8 +274,14 @@ auto GenerateGiftMedia(
|
||||||
? tr::lng_action_gift_self_about_unique(
|
? tr::lng_action_gift_self_about_unique(
|
||||||
tr::now,
|
tr::now,
|
||||||
Text::RichLangValue)
|
Text::RichLangValue)
|
||||||
|
: (recipient->isBroadcast() && gift.info.starsToUpgrade)
|
||||||
|
? tr::lng_action_gift_channel_about_unique(
|
||||||
|
tr::now,
|
||||||
|
Text::RichLangValue)
|
||||||
: (recipient->isSelf()
|
: (recipient->isSelf()
|
||||||
? tr::lng_action_gift_self_about
|
? tr::lng_action_gift_self_about
|
||||||
|
: recipient->isBroadcast()
|
||||||
|
? tr::lng_action_gift_channel_about
|
||||||
: tr::lng_action_gift_got_stars_text)(
|
: tr::lng_action_gift_got_stars_text)(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_count,
|
lt_count,
|
||||||
|
@ -482,6 +488,15 @@ void PreviewWrap::prepare(rpl::producer<GiftDetails> details) {
|
||||||
? tr::lng_action_gift_unique_received(tr::now, lt_user, name)
|
? tr::lng_action_gift_unique_received(tr::now, lt_user, name)
|
||||||
: _recipient->isSelf()
|
: _recipient->isSelf()
|
||||||
? tr::lng_action_gift_self_bought(tr::now, lt_cost, cost)
|
? tr::lng_action_gift_self_bought(tr::now, lt_cost, cost)
|
||||||
|
: _recipient->isBroadcast()
|
||||||
|
? tr::lng_action_gift_sent_channel(
|
||||||
|
tr::now,
|
||||||
|
lt_user,
|
||||||
|
name,
|
||||||
|
lt_name,
|
||||||
|
_recipient->name(),
|
||||||
|
lt_cost,
|
||||||
|
cost)
|
||||||
: tr::lng_action_gift_received(
|
: tr::lng_action_gift_received(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
lt_user,
|
||||||
|
@ -1218,7 +1233,7 @@ void AddUpgradeButton(
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
int cost,
|
int cost,
|
||||||
QString name,
|
not_null<PeerData*> peer,
|
||||||
Fn<void(bool)> toggled,
|
Fn<void(bool)> toggled,
|
||||||
Fn<void()> preview) {
|
Fn<void()> preview) {
|
||||||
const auto button = container->add(
|
const auto button = container->add(
|
||||||
|
@ -1265,12 +1280,19 @@ void AddUpgradeButton(
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
const auto about = AddDividerText(
|
const auto about = AddDividerText(
|
||||||
container,
|
container,
|
||||||
tr::lng_gift_send_unique_about(
|
(peer->isBroadcast()
|
||||||
lt_user,
|
? tr::lng_gift_send_unique_about_channel(
|
||||||
rpl::single(TextWithEntities{ name }),
|
lt_name,
|
||||||
lt_link,
|
rpl::single(TextWithEntities{ peer->name() }),
|
||||||
tr::lng_gift_send_unique_link() | Text::ToLink(),
|
lt_link,
|
||||||
Text::WithEntities));
|
tr::lng_gift_send_unique_link() | Text::ToLink(),
|
||||||
|
Text::WithEntities)
|
||||||
|
: tr::lng_gift_send_unique_about(
|
||||||
|
lt_user,
|
||||||
|
rpl::single(TextWithEntities{ peer->shortName() }),
|
||||||
|
lt_link,
|
||||||
|
tr::lng_gift_send_unique_link() | Text::ToLink(),
|
||||||
|
Text::WithEntities)));
|
||||||
about->setClickHandlerFilter([=](const auto &...) {
|
about->setClickHandlerFilter([=](const auto &...) {
|
||||||
preview();
|
preview();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1383,15 +1405,11 @@ void SendGiftBox(
|
||||||
if (const auto stars = std::get_if<GiftTypeStars>(&descriptor)) {
|
if (const auto stars = std::get_if<GiftTypeStars>(&descriptor)) {
|
||||||
const auto cost = stars->info.starsToUpgrade;
|
const auto cost = stars->info.starsToUpgrade;
|
||||||
if (cost > 0 && !peer->isSelf()) {
|
if (cost > 0 && !peer->isSelf()) {
|
||||||
const auto user = peer->asUser();
|
|
||||||
Assert(user != nullptr);
|
|
||||||
|
|
||||||
const auto id = stars->info.id;
|
const auto id = stars->info.id;
|
||||||
const auto name = user->shortName();
|
|
||||||
const auto showing = std::make_shared<bool>();
|
const auto showing = std::make_shared<bool>();
|
||||||
AddDivider(container);
|
AddDivider(container);
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
AddUpgradeButton(container, session, cost, name, [=](bool on) {
|
AddUpgradeButton(container, session, cost, peer, [=](bool on) {
|
||||||
auto now = state->details.current();
|
auto now = state->details.current();
|
||||||
now.upgraded = on;
|
now.upgraded = on;
|
||||||
state->details = std::move(now);
|
state->details = std::move(now);
|
||||||
|
@ -1404,7 +1422,7 @@ void SendGiftBox(
|
||||||
.controller = window,
|
.controller = window,
|
||||||
.stargiftId = id,
|
.stargiftId = id,
|
||||||
.ready = [=](bool) { *showing = false; },
|
.ready = [=](bool) { *showing = false; },
|
||||||
.user = user,
|
.peer = peer,
|
||||||
.cost = int(cost),
|
.cost = int(cost),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1432,6 +1450,8 @@ void SendGiftBox(
|
||||||
}, [&](const GiftTypeStars &) {
|
}, [&](const GiftTypeStars &) {
|
||||||
AddDividerText(container, peer->isSelf()
|
AddDividerText(container, peer->isSelf()
|
||||||
? tr::lng_gift_send_anonymous_self()
|
? tr::lng_gift_send_anonymous_self()
|
||||||
|
: peer->isBroadcast()
|
||||||
|
? tr::lng_gift_send_anonymous_about_channel()
|
||||||
: tr::lng_gift_send_anonymous_about(
|
: tr::lng_gift_send_anonymous_about(
|
||||||
lt_user,
|
lt_user,
|
||||||
rpl::single(peer->shortName()),
|
rpl::single(peer->shortName()),
|
||||||
|
@ -1711,7 +1731,7 @@ void GiftBox(
|
||||||
window->showSettings(Settings::CreditsId());
|
window->showSettings(Settings::CreditsId());
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
if (!peer->isSelf()) {
|
if (peer->isUser() && !peer->isSelf()) {
|
||||||
const auto premiumClickHandlerFilter = [=](const auto &...) {
|
const auto premiumClickHandlerFilter = [=](const auto &...) {
|
||||||
Settings::ShowPremium(window, u"gift_send"_q);
|
Settings::ShowPremium(window, u"gift_send"_q);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1731,9 +1751,16 @@ void GiftBox(
|
||||||
AddBlock(content, window, {
|
AddBlock(content, window, {
|
||||||
.subtitle = (peer->isSelf()
|
.subtitle = (peer->isSelf()
|
||||||
? tr::lng_gift_self_title()
|
? tr::lng_gift_self_title()
|
||||||
|
: peer->isBroadcast()
|
||||||
|
? tr::lng_gift_channel_title()
|
||||||
: tr::lng_gift_stars_subtitle()),
|
: tr::lng_gift_stars_subtitle()),
|
||||||
.about = (peer->isSelf()
|
.about = (peer->isSelf()
|
||||||
? tr::lng_gift_self_about(Text::WithEntities)
|
? tr::lng_gift_self_about(Text::WithEntities)
|
||||||
|
: peer->isBroadcast()
|
||||||
|
? tr::lng_gift_channel_about(
|
||||||
|
lt_name,
|
||||||
|
rpl::single(Text::Bold(peer->name())),
|
||||||
|
Text::WithEntities)
|
||||||
: tr::lng_gift_stars_about(
|
: tr::lng_gift_stars_about(
|
||||||
lt_name,
|
lt_name,
|
||||||
rpl::single(Text::Bold(peer->shortName())),
|
rpl::single(Text::Bold(peer->shortName())),
|
||||||
|
@ -2366,9 +2393,11 @@ void AddUpgradeGiftCover(
|
||||||
MakeUpgradeGiftStream(args),
|
MakeUpgradeGiftStream(args),
|
||||||
(args.itemId
|
(args.itemId
|
||||||
? tr::lng_gift_upgrade_about()
|
? tr::lng_gift_upgrade_about()
|
||||||
: tr::lng_gift_upgrade_preview_about(
|
: (args.peer->isBroadcast()
|
||||||
lt_name,
|
? tr::lng_gift_upgrade_preview_about_channel
|
||||||
rpl::single(args.user->shortName()))));
|
: tr::lng_gift_upgrade_preview_about)(
|
||||||
|
lt_name,
|
||||||
|
rpl::single(args.peer->shortName()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpgradeBox(
|
void UpgradeBox(
|
||||||
|
@ -2481,7 +2510,7 @@ void UpgradeBox(
|
||||||
if (result != Payments::CheckoutResult::Paid) {
|
if (result != Payments::CheckoutResult::Paid) {
|
||||||
state->sent = false;
|
state->sent = false;
|
||||||
} else {
|
} else {
|
||||||
controller->showPeerHistory(args.user);
|
controller->showPeerHistory(args.peer);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.data()) {
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
|
@ -2636,7 +2665,7 @@ void PaintPoints(
|
||||||
|
|
||||||
void ShowStarGiftUpgradeBox(StarGiftUpgradeArgs &&args) {
|
void ShowStarGiftUpgradeBox(StarGiftUpgradeArgs &&args) {
|
||||||
const auto weak = base::make_weak(args.controller);
|
const auto weak = base::make_weak(args.controller);
|
||||||
const auto session = &args.user->session();
|
const auto session = &args.peer->session();
|
||||||
session->api().request(MTPpayments_GetStarGiftUpgradePreview(
|
session->api().request(MTPpayments_GetStarGiftUpgradePreview(
|
||||||
MTP_long(args.stargiftId)
|
MTP_long(args.stargiftId)
|
||||||
)).done([=](const MTPpayments_StarGiftUpgradePreview &result) {
|
)).done([=](const MTPpayments_StarGiftUpgradePreview &result) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ struct StarGiftUpgradeArgs {
|
||||||
not_null<Window::SessionController*> controller;
|
not_null<Window::SessionController*> controller;
|
||||||
base::required<uint64> stargiftId;
|
base::required<uint64> stargiftId;
|
||||||
Fn<void(bool)> ready;
|
Fn<void(bool)> ready;
|
||||||
not_null<UserData*> user;
|
not_null<PeerData*> peer;
|
||||||
MsgId itemId = 0;
|
MsgId itemId = 0;
|
||||||
int cost = 0;
|
int cost = 0;
|
||||||
bool canAddSender = false;
|
bool canAddSender = false;
|
||||||
|
|
|
@ -5445,6 +5445,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
||||||
};
|
};
|
||||||
const auto anonymous = _from->isServiceUser();
|
const auto anonymous = _from->isServiceUser();
|
||||||
if (anonymous || _history->peer->isSelf()) {
|
if (anonymous || _history->peer->isSelf()) {
|
||||||
|
// todo channel gifts
|
||||||
result.text = (anonymous
|
result.text = (anonymous
|
||||||
? tr::lng_action_gift_received_anonymous
|
? tr::lng_action_gift_received_anonymous
|
||||||
: tr::lng_action_gift_self_bought)(
|
: tr::lng_action_gift_self_bought)(
|
||||||
|
|
|
@ -115,7 +115,7 @@ TextWithEntities PremiumGift::subtitle() {
|
||||||
: (_data.starsToUpgrade
|
: (_data.starsToUpgrade
|
||||||
&& !_data.converted
|
&& !_data.converted
|
||||||
&& _parent->history()->peer->isSelf())
|
&& _parent->history()->peer->isSelf())
|
||||||
? tr::lng_action_gift_self_about_unique(
|
? tr::lng_action_gift_self_about_unique( // todo channel gifts
|
||||||
tr::now,
|
tr::now,
|
||||||
Ui::Text::RichLangValue)
|
Ui::Text::RichLangValue)
|
||||||
: (!_data.converted && !_data.starsConverted)
|
: (!_data.converted && !_data.starsConverted)
|
||||||
|
@ -127,7 +127,7 @@ TextWithEntities PremiumGift::subtitle() {
|
||||||
: (_data.converted
|
: (_data.converted
|
||||||
? tr::lng_gift_got_stars
|
? tr::lng_gift_got_stars
|
||||||
: _parent->history()->peer->isSelf()
|
: _parent->history()->peer->isSelf()
|
||||||
? tr::lng_action_gift_self_about
|
? tr::lng_action_gift_self_about // todo channel gifts
|
||||||
: tr::lng_action_gift_got_stars_text)(
|
: tr::lng_action_gift_got_stars_text)(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_count,
|
lt_count,
|
||||||
|
|
|
@ -1276,7 +1276,7 @@ void GenericCreditsEntryBox(
|
||||||
&& giftToSelf
|
&& giftToSelf
|
||||||
&& !(couldConvert || nonConvertible))
|
&& !(couldConvert || nonConvertible))
|
||||||
? tr::lng_action_gift_self_about_unique(
|
? tr::lng_action_gift_self_about_unique(
|
||||||
Ui::Text::WithEntities)
|
Ui::Text::WithEntities) // todo channel gifts
|
||||||
: ((couldConvert || nonConvertible)
|
: ((couldConvert || nonConvertible)
|
||||||
? (e.savedToProfile
|
? (e.savedToProfile
|
||||||
? tr::lng_action_gift_can_remove_text
|
? tr::lng_action_gift_can_remove_text
|
||||||
|
@ -1284,7 +1284,7 @@ void GenericCreditsEntryBox(
|
||||||
Ui::Text::WithEntities)
|
Ui::Text::WithEntities)
|
||||||
: rpl::combine(
|
: rpl::combine(
|
||||||
(canConvert
|
(canConvert
|
||||||
? (giftToSelf
|
? (giftToSelf // todo channel gifts
|
||||||
? tr::lng_action_gift_self_about
|
? tr::lng_action_gift_self_about
|
||||||
: tr::lng_action_gift_got_stars_text)
|
: tr::lng_action_gift_got_stars_text)
|
||||||
: tr::lng_gift_got_stars)(
|
: tr::lng_gift_got_stars)(
|
||||||
|
@ -1400,7 +1400,7 @@ void GenericCreditsEntryBox(
|
||||||
.controller = window,
|
.controller = window,
|
||||||
.stargiftId = e.stargiftId,
|
.stargiftId = e.stargiftId,
|
||||||
.ready = [=](bool) { *upgradeGuard = false; },
|
.ready = [=](bool) { *upgradeGuard = false; },
|
||||||
.user = starGiftSender,
|
.peer = starGiftSender,
|
||||||
.itemId = itemId,
|
.itemId = itemId,
|
||||||
.cost = e.starsUpgradedBySender ? 0 : e.starsToUpgrade,
|
.cost = e.starsUpgradedBySender ? 0 : e.starsToUpgrade,
|
||||||
.canAddSender = !giftToSelf && !e.anonymous,
|
.canAddSender = !giftToSelf && !e.anonymous,
|
||||||
|
@ -1496,7 +1496,7 @@ void GenericCreditsEntryBox(
|
||||||
box,
|
box,
|
||||||
(e.savedToProfile
|
(e.savedToProfile
|
||||||
? tr::lng_gift_visible_hint()
|
? tr::lng_gift_visible_hint()
|
||||||
: tr::lng_gift_hidden_hint()),
|
: tr::lng_gift_hidden_hint()), // todo channel gifts
|
||||||
st::creditsBoxAboutDivider)));
|
st::creditsBoxAboutDivider)));
|
||||||
} else if (gotStarGift && e.anonymous) {
|
} else if (gotStarGift && e.anonymous) {
|
||||||
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||||
|
|
|
@ -686,6 +686,8 @@ void AskBoostBox(
|
||||||
return tr::lng_boost_channel_title_reactions();
|
return tr::lng_boost_channel_title_reactions();
|
||||||
}, [](AskBoostCpm) {
|
}, [](AskBoostCpm) {
|
||||||
return tr::lng_boost_channel_title_cpm();
|
return tr::lng_boost_channel_title_cpm();
|
||||||
|
}, [](AskBoostWearCollectible) {
|
||||||
|
return tr::lng_boost_channel_title_wear();
|
||||||
});
|
});
|
||||||
auto reasonText = v::match(data.reason.data, [&](
|
auto reasonText = v::match(data.reason.data, [&](
|
||||||
AskBoostChannelColor data) {
|
AskBoostChannelColor data) {
|
||||||
|
@ -724,6 +726,11 @@ void AskBoostBox(
|
||||||
lt_count,
|
lt_count,
|
||||||
rpl::single(float64(data.requiredLevel)),
|
rpl::single(float64(data.requiredLevel)),
|
||||||
Ui::Text::RichLangValue);
|
Ui::Text::RichLangValue);
|
||||||
|
}, [&](AskBoostWearCollectible data) {
|
||||||
|
return tr::lng_boost_channel_needs_level_wear(
|
||||||
|
lt_count,
|
||||||
|
rpl::single(float64(data.requiredLevel)),
|
||||||
|
Ui::Text::RichLangValue);
|
||||||
});
|
});
|
||||||
auto text = rpl::combine(
|
auto text = rpl::combine(
|
||||||
std::move(reasonText),
|
std::move(reasonText),
|
||||||
|
|
|
@ -96,6 +96,10 @@ struct AskBoostCpm {
|
||||||
int requiredLevel = 0;
|
int requiredLevel = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct AskBoostWearCollectible {
|
||||||
|
int requiredLevel = 0;
|
||||||
|
};
|
||||||
|
|
||||||
struct AskBoostReason {
|
struct AskBoostReason {
|
||||||
std::variant<
|
std::variant<
|
||||||
AskBoostChannelColor,
|
AskBoostChannelColor,
|
||||||
|
@ -103,7 +107,8 @@ struct AskBoostReason {
|
||||||
AskBoostEmojiStatus,
|
AskBoostEmojiStatus,
|
||||||
AskBoostEmojiPack,
|
AskBoostEmojiPack,
|
||||||
AskBoostCustomReactions,
|
AskBoostCustomReactions,
|
||||||
AskBoostCpm> data;
|
AskBoostCpm,
|
||||||
|
AskBoostWearCollectible> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AskBoostBoxData {
|
struct AskBoostBoxData {
|
||||||
|
|
|
@ -302,7 +302,7 @@ private:
|
||||||
void addNewMembers();
|
void addNewMembers();
|
||||||
void addDeleteContact();
|
void addDeleteContact();
|
||||||
void addTTLSubmenu(bool addSeparator);
|
void addTTLSubmenu(bool addSeparator);
|
||||||
void addGiftPremium();
|
void addSendGift();
|
||||||
void addCreateTopic();
|
void addCreateTopic();
|
||||||
void addViewAsMessages();
|
void addViewAsMessages();
|
||||||
void addViewAsTopics();
|
void addViewAsTopics();
|
||||||
|
@ -1227,22 +1227,28 @@ void Filler::addTTLSubmenu(bool addSeparator) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Filler::addGiftPremium() {
|
void Filler::addSendGift() {
|
||||||
const auto user = _peer->asUser();
|
const auto user = _peer->asUser();
|
||||||
if (!user
|
const auto channel = _peer->asBroadcast();
|
||||||
|| user->isInaccessible()
|
if (!user && !channel) {
|
||||||
|| user->isSelf()
|
return;
|
||||||
|| user->isBot()
|
} else if (user
|
||||||
|| user->isNotificationsUser()
|
&& (user->isInaccessible()
|
||||||
|| user->isRepliesChat()
|
|| user->isSelf()
|
||||||
|| user->isVerifyCodes()
|
|| user->isBot()
|
||||||
|| !user->session().premiumCanBuy()) {
|
|| user->isNotificationsUser()
|
||||||
|
|| user->isRepliesChat()
|
||||||
|
|| user->isVerifyCodes()
|
||||||
|
|| !user->session().premiumCanBuy())) {
|
||||||
|
return;
|
||||||
|
} else if (channel && channel->isForbidden()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto peer = _peer;
|
||||||
const auto navigation = _controller;
|
const auto navigation = _controller;
|
||||||
_addAction(tr::lng_profile_gift_premium(tr::now), [=] {
|
_addAction(tr::lng_profile_gift_premium(tr::now), [=] {
|
||||||
Ui::ShowStarGiftBox(navigation, user);
|
Ui::ShowStarGiftBox(navigation, peer);
|
||||||
}, &st::menuIconGiftPremium);
|
}, &st::menuIconGiftPremium);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1446,9 +1452,9 @@ void Filler::fillProfileActions() {
|
||||||
addNewContact();
|
addNewContact();
|
||||||
addShareContact();
|
addShareContact();
|
||||||
addEditContact();
|
addEditContact();
|
||||||
addGiftPremium();
|
|
||||||
addBotToGroup();
|
addBotToGroup();
|
||||||
addNewMembers();
|
addNewMembers();
|
||||||
|
addSendGift();
|
||||||
addViewStatistics();
|
addViewStatistics();
|
||||||
addStoryArchive();
|
addStoryArchive();
|
||||||
addManageChat();
|
addManageChat();
|
||||||
|
|
Loading…
Add table
Reference in a new issue