diff --git a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp index 2e810dd6c..f510540c2 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp @@ -22,6 +22,16 @@ GiftBoxPack::GiftBoxPack(not_null session) GiftBoxPack::~GiftBoxPack() = default; +int GiftBoxPack::monthsForStars(int stars) const { + if (stars <= 1000) { + return 3; + } else if (stars < 2500) { + return 6; + } else { + return 12; + } +} + DocumentData *GiftBoxPack::lookup(int months) const { const auto it = ranges::lower_bound(_localMonths, months); const auto fallback = _documents.empty() ? nullptr : _documents[0]; diff --git a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h index 4c480fba3..1e6c0e934 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h +++ b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h @@ -25,6 +25,7 @@ public: ~GiftBoxPack(); void load(); + [[nodiscard]] int monthsForStars(int stars) const; [[nodiscard]] DocumentData *lookup(int months) const; [[nodiscard]] Data::FileOrigin origin() const; diff --git a/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp b/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp index 885e74a62..2a7a2f4b1 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_premium_gift.cpp @@ -185,8 +185,9 @@ void PremiumGift::ensureStickerCreated() const { return; } const auto &session = _parent->history()->session(); - const auto months = stars() ? 1 : _data.count; auto &packs = session.giftBoxStickersPacks(); + const auto count = stars(); + const auto months = count ? packs.monthsForStars(count) : _data.count; if (const auto document = packs.lookup(months)) { if (const auto sticker = document->sticker()) { const auto skipPremiumEffect = false;