mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Add NEW badge to stories premium promo.
This commit is contained in:
parent
7877cb0b3a
commit
6be1a05876
3 changed files with 41 additions and 0 deletions
|
@ -1860,6 +1860,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_premium_summary_bottom_about" = "While the free version of Telegram already gives its users more than any other messaging application, **Telegram Premium** pushes its capabilities even further.\n\n**Telegram Premium** is a paid option, because most Premium Features require additional expenses from Telegram to third parties such as data center providers and server manufacturers. Contributions from **Telegram Premium** users allow us to cover such costs and also help Telegram stay free for everyone.";
|
||||
"lng_premium_summary_button" = "Subscribe for {cost} per month";
|
||||
|
||||
"lng_premium_summary_new_badge" = "NEW";
|
||||
|
||||
"lng_premium_success" = "You've successfully subscribed to Telegram Premium!";
|
||||
"lng_premium_unavailable" = "This feature requires subscription to **Telegram Premium**.\n\nUnfortunately, **Telegram Premium** is not available in your region.";
|
||||
|
||||
|
|
|
@ -129,6 +129,17 @@ settingsStoriesIconDownload: icon {{ "menu/download", premiumButtonBg1 }};
|
|||
settingsStoriesIconCaption: icon {{ "settings/premium/stories_caption", premiumButtonBg1 }};
|
||||
settingsStoriesIconLinks: icon {{ "settings/premium/stories_links", premiumButtonBg1 }};
|
||||
|
||||
settingsPremiumNewBadge: FlatLabel(defaultFlatLabel) {
|
||||
style: TextStyle(semiboldTextStyle) {
|
||||
font: font(10px semibold);
|
||||
linkFont: font(10px semibold);
|
||||
linkFontOver: font(10px semibold);
|
||||
}
|
||||
textFg: windowFgActive;
|
||||
}
|
||||
settingsPremiumNewBadgePosition: point(4px, 1px);
|
||||
settingsPremiumNewBadgePadding: margins(4px, 1px, 4px, 1px);
|
||||
|
||||
settingsTTLChatsOff: icon {{ "settings/ttl/autodelete_off", windowSubTextFg }};
|
||||
settingsTTLChatsOn: icon {{ "settings/ttl/autodelete_on", windowActiveTextFg }};
|
||||
|
||||
|
|
|
@ -204,6 +204,7 @@ struct Entry {
|
|||
rpl::producer<QString> title;
|
||||
rpl::producer<QString> description;
|
||||
PremiumPreview section = PremiumPreview::DoubleLimits;
|
||||
bool newBadge = false;
|
||||
};
|
||||
|
||||
using Order = std::vector<QString>;
|
||||
|
@ -236,6 +237,7 @@ using Order = std::vector<QString>;
|
|||
tr::lng_premium_summary_subtitle_stories(),
|
||||
tr::lng_premium_summary_about_stories(),
|
||||
PremiumPreview::Stories,
|
||||
true,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1271,6 +1273,32 @@ void Premium::setupContent() {
|
|||
descriptionPadding);
|
||||
description->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
const auto badge = entry.newBadge
|
||||
? Ui::CreateChild<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_premium_summary_new_badge(),
|
||||
st::settingsPremiumNewBadge),
|
||||
st::settingsPremiumNewBadgePadding)
|
||||
: nullptr;
|
||||
if (badge) {
|
||||
badge->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
badge->paintRequest() | rpl::start_with_next([=] {
|
||||
auto p = QPainter(badge);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(st::windowBgActive);
|
||||
const auto r = st::settingsPremiumNewBadgePadding.left();
|
||||
p.drawRoundedRect(badge->rect(), r, r);
|
||||
}, badge->lifetime());
|
||||
|
||||
label->geometryValue(
|
||||
) | rpl::start_with_next([=](QRect geometry) {
|
||||
badge->move(st::settingsPremiumNewBadgePosition
|
||||
+ QPoint(label->x() + label->width(), label->y()));
|
||||
}, badge->lifetime());
|
||||
}
|
||||
const auto dummy = Ui::CreateChild<Ui::AbstractButton>(content);
|
||||
dummy->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue