diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index f17be156b..c0aba5bd5 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2216,6 +2216,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_prizes_end_text" = "This giveaway was sponsored by {admins}."; "lng_prizes_admins#one" = "the admins of {channel}, who aquired **{count} Telegram Premium** subscription {duration} for its followers"; "lng_prizes_admins#other" = "the admins of {channel}, who aquired **{count} Telegram Premium** subscriptions {duration} for its followers."; +"lng_prizes_additional_added#one" = "{channel} also included **{count} {prize}** in the prize. Admins of the channel are responsible for delivering this prize."; +"lng_prizes_additional_added#other" = "{channel} also included **{count} {prize}** in the prizes. Admins of the channel are responsible for delivering these prizes."; "lng_prizes_how_when_finish" = "On {date}, Telegram will automatically select {winners}."; "lng_prizes_end_when_finish" = "On {date}, Telegram automatically selected {winners}."; "lng_prizes_end_activated#one" = "**{count}** of the winners already used their gift link."; diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index 1244964d2..97cb8a25d 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -752,7 +752,22 @@ void GiveawayInfoBox( const auto first = !giveaway.channels.empty() ? giveaway.channels.front()->name() : u"channel"_q; - auto text = (finished + auto text = TextWithEntities(); + + if (!info.giftCode.isEmpty()) { + text.append("\n\n"); + text.append(Ui::Text::Bold(tr::lng_prizes_you_won( + tr::now, + lt_cup, + QString::fromUtf8("\xf0\x9f\x8f\x86")))); + text.append("\n\n"); + } else if (info.state == State::Finished) { + text.append("\n\n"); + text.append(Ui::Text::Bold(tr::lng_prizes_you_didnt(tr::now))); + text.append("\n\n"); + } + + text.append((finished ? tr::lng_prizes_end_text : tr::lng_prizes_how_text)( tr::now, @@ -766,7 +781,7 @@ void GiveawayInfoBox( lt_duration, TextWithEntities{ GiftDuration(giveaway.months) }, Ui::Text::RichLangValue), - Ui::Text::RichLangValue); + Ui::Text::RichLangValue)); const auto many = (giveaway.channels.size() > 1); const auto count = info.winnersCount ? info.winnersCount @@ -793,6 +808,17 @@ void GiveawayInfoBox( Ui::Text::Bold( langDateTime(base::unixtime::parse(info.startDate))), Ui::Text::RichLangValue); + if (!giveaway.additionalPrize.isEmpty()) { + text.append("\n\n").append(tr::lng_prizes_additional_added( + tr::now, + lt_count, + count, + lt_channel, + Ui::Text::Bold(first), + lt_prize, + TextWithEntities{ giveaway.additionalPrize }, + Ui::Text::RichLangValue)); + } text.append("\n\n").append((finished ? tr::lng_prizes_end_when_finish : tr::lng_prizes_how_when_finish)( @@ -810,17 +836,9 @@ void GiveawayInfoBox( info.activatedCount, Ui::Text::RichLangValue)); } - if (!info.giftCode.isEmpty()) { - text.append("\n\n"); - text.append(tr::lng_prizes_you_won( - tr::now, - lt_cup, - QString::fromUtf8("\xf0\x9f\x8f\x86"))); - } else if (info.state == State::Finished) { - text.append("\n\n"); - text.append(tr::lng_prizes_you_didnt(tr::now)); - } else if (info.state == State::Preparing) { - + if (!info.giftCode.isEmpty() + || info.state == State::Finished + || info.state == State::Preparing) { } else if (info.state != State::Refunded) { if (info.adminChannelId) { const auto channel = controller->session().data().channel( diff --git a/Telegram/SourceFiles/data/data_media_types.cpp b/Telegram/SourceFiles/data/data_media_types.cpp index 8ee9bcdd7..48739c509 100644 --- a/Telegram/SourceFiles/data/data_media_types.cpp +++ b/Telegram/SourceFiles/data/data_media_types.cpp @@ -383,6 +383,9 @@ Giveaway ComputeGiveawayData( result.countries.push_back(qs(country)); } } + if (const auto additional = data.vprize_description()) { + result.additionalPrize = qs(*additional); + } return result; } diff --git a/Telegram/SourceFiles/data/data_media_types.h b/Telegram/SourceFiles/data/data_media_types.h index 10c938963..667b84ffc 100644 --- a/Telegram/SourceFiles/data/data_media_types.h +++ b/Telegram/SourceFiles/data/data_media_types.h @@ -93,6 +93,7 @@ struct Invoice { struct Giveaway { std::vector> channels; std::vector countries; + QString additionalPrize; TimeId untilDate = 0; int quantity = 0; int months = 0;