From 384c540197dfd93ffd8451a6eedaa3d3fc034397 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 18 Apr 2025 19:55:32 +0300 Subject: [PATCH] Added special status to peers in gifts list with tomorrow birthday. --- Telegram/Resources/langs/lang.strings | 1 + Telegram/SourceFiles/boxes/star_gift_box.cpp | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index cb2373a855..9cebb5dc23 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3458,6 +3458,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_gift_subtitle_birthdays" = "Birthdays"; "lng_gift_list_birthday_status_today" = "{emoji} Birthday today"; "lng_gift_list_birthday_status_yesterday" = "Birthday yesterday"; +"lng_gift_list_birthday_status_tomorrow" = "Birthday tomorrow"; "lng_gift_self_status" = "buy yourself 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."; diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index 8c40b6d1b2..4247e936c3 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -2558,10 +2558,17 @@ Controller::Controller(not_null session, PickCallback pick) Data::BirthdayCake()); } const auto yesterday = QDate::currentDate().addDays(-1); - return (date.day() == yesterday.day() - && date.month() == yesterday.month()) - ? tr::lng_gift_list_birthday_status_yesterday(tr::now) - : QString(); + const auto tomorrow = QDate::currentDate().addDays(1); + if (date.day() == yesterday.day() + && date.month() == yesterday.month()) { + return tr::lng_gift_list_birthday_status_yesterday( + tr::now); + } else if (date.day() == tomorrow.day() + && date.month() == tomorrow.month()) { + return tr::lng_gift_list_birthday_status_tomorrow( + tr::now); + } + return QString(); }; auto usersWithBirthdays = ranges::views::all(