mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added reward phrase to about label in gift box.
This commit is contained in:
parent
15e2874da8
commit
dff4191ac9
1 changed files with 41 additions and 27 deletions
|
@ -83,6 +83,31 @@ GiftOptions GiftOptionFromTL(const MTPDuserFull &data) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] Fn<TextWithEntities(TextWithEntities)> BoostsForGiftText(
|
||||||
|
const std::vector<not_null<UserData*>> users) {
|
||||||
|
Expects(!users.empty());
|
||||||
|
|
||||||
|
const auto session = &users.front()->session();
|
||||||
|
const auto emoji = Ui::Text::SingleCustomEmoji(
|
||||||
|
session->data().customEmojiManager().registerInternalEmoji(
|
||||||
|
st::premiumGiftsBoostIcon,
|
||||||
|
QMargins(0, st::premiumGiftsUserpicBadgeInner, 0, 0),
|
||||||
|
false));
|
||||||
|
|
||||||
|
return [=, count = users.size()](TextWithEntities text) {
|
||||||
|
text.append('\n');
|
||||||
|
text.append('\n');
|
||||||
|
text.append(tr::lng_premium_gifts_about_reward(
|
||||||
|
tr::now,
|
||||||
|
lt_count,
|
||||||
|
count * BoostsForGift(session),
|
||||||
|
lt_emoji,
|
||||||
|
emoji,
|
||||||
|
Ui::Text::RichLangValue));
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
using TagUser1 = lngtag_user;
|
using TagUser1 = lngtag_user;
|
||||||
using TagUser2 = lngtag_second_user;
|
using TagUser2 = lngtag_second_user;
|
||||||
using TagUser3 = lngtag_name;
|
using TagUser3 = lngtag_name;
|
||||||
|
@ -293,16 +318,21 @@ void GiftBox(
|
||||||
std::move(titleLabel)),
|
std::move(titleLabel)),
|
||||||
st::premiumGiftTitlePadding);
|
st::premiumGiftTitlePadding);
|
||||||
|
|
||||||
auto textLabel = object_ptr<Ui::FlatLabel>(
|
auto textLabel = object_ptr<Ui::FlatLabel>(box, st::premiumPreviewAbout);
|
||||||
box,
|
tr::lng_premium_gift_about(
|
||||||
tr::lng_premium_gift_about(
|
lt_user,
|
||||||
lt_user,
|
user->session().changes().peerFlagsValue(
|
||||||
user->session().changes().peerFlagsValue(
|
user,
|
||||||
user,
|
Data::PeerUpdate::Flag::Name
|
||||||
Data::PeerUpdate::Flag::Name
|
) | rpl::map([=] { return TextWithEntities{ user->firstName }; }),
|
||||||
) | rpl::map([=] { return TextWithEntities{ user->firstName }; }),
|
Ui::Text::RichLangValue
|
||||||
Ui::Text::RichLangValue),
|
) | rpl::map(
|
||||||
st::premiumPreviewAbout);
|
BoostsForGiftText({ user })
|
||||||
|
) | rpl::start_with_next([
|
||||||
|
raw = textLabel.data(),
|
||||||
|
session = &user->session()](const TextWithEntities &t) {
|
||||||
|
raw->setMarkedText(t, Core::MarkedTextContext{ .session = session });
|
||||||
|
}, textLabel->lifetime());
|
||||||
textLabel->setTextColorOverride(stTitle.textFg->c);
|
textLabel->setTextColorOverride(stTitle.textFg->c);
|
||||||
textLabel->resizeToWidth(available);
|
textLabel->resizeToWidth(available);
|
||||||
box->addRow(
|
box->addRow(
|
||||||
|
@ -476,11 +506,6 @@ void GiftsBox(
|
||||||
|
|
||||||
// About.
|
// About.
|
||||||
{
|
{
|
||||||
const auto emoji = Ui::Text::SingleCustomEmoji(
|
|
||||||
session->data().customEmojiManager().registerInternalEmoji(
|
|
||||||
st::premiumGiftsBoostIcon,
|
|
||||||
QMargins(0, st::premiumGiftsUserpicBadgeInner, 0, 0),
|
|
||||||
false));
|
|
||||||
auto text = rpl::conditional(
|
auto text = rpl::conditional(
|
||||||
state->isPaymentComplete.value(),
|
state->isPaymentComplete.value(),
|
||||||
ComplexAboutLabel(
|
ComplexAboutLabel(
|
||||||
|
@ -505,18 +530,7 @@ void GiftsBox(
|
||||||
tr::lng_premium_gifts_about_user2,
|
tr::lng_premium_gifts_about_user2,
|
||||||
tr::lng_premium_gifts_about_user3,
|
tr::lng_premium_gifts_about_user3,
|
||||||
tr::lng_premium_gifts_about_user_more
|
tr::lng_premium_gifts_about_user_more
|
||||||
) | rpl::map([=, count = users.size()](TextWithEntities text) {
|
) | rpl::map(BoostsForGiftText(users))
|
||||||
text.append('\n');
|
|
||||||
text.append('\n');
|
|
||||||
text.append(tr::lng_premium_gifts_about_reward(
|
|
||||||
tr::now,
|
|
||||||
lt_count,
|
|
||||||
count * BoostsForGift(session),
|
|
||||||
lt_emoji,
|
|
||||||
emoji,
|
|
||||||
Ui::Text::RichLangValue));
|
|
||||||
return text;
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
const auto label = box->addRow(
|
const auto label = box->addRow(
|
||||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||||
|
|
Loading…
Add table
Reference in a new issue