From e6b92eaf37e07f3d6c4acf13c547d09bdd6fe111 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Mar 2023 10:44:36 +0400 Subject: [PATCH] Add a power saving option to stop user statuses. --- Telegram/Resources/langs/lang.strings | 1 + Telegram/SourceFiles/history/view/history_view_message.cpp | 2 +- Telegram/SourceFiles/info/profile/info_profile_badge.cpp | 3 ++- Telegram/SourceFiles/settings/settings_power_saving.cpp | 1 + Telegram/SourceFiles/settings/settings_premium.cpp | 2 +- Telegram/SourceFiles/ui/power_saving.h | 1 + Telegram/SourceFiles/ui/unread_badge.cpp | 3 ++- 7 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 4465a9dae0..3071b81bf2 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -620,6 +620,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_settings_power_emoji_panel" = "Autoplay in panel"; "lng_settings_power_emoji_reactions" = "Autoplay in reactions menu"; "lng_settings_power_emoji_chat" = "Autoplay in messages"; +"lng_settings_power_emoji_status" = "Autoplay in premium status"; "lng_settings_power_chat" = "Animations in Chats"; "lng_settings_power_chat_background" = "Background rotation"; "lng_settings_power_chat_spoiler" = "Animated spoiler effect"; diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index e9c773ff93..01d654cd1d 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1272,7 +1272,7 @@ void Message::paintFromName( .position = QPoint( x - 2 * _fromNameStatus->skip, y + _fromNameStatus->skip), - .paused = context.paused, + .paused = context.paused || On(PowerSaving::kEmojiStatus), }); } else { st::dialogsPremiumIcon.paint(p, x, y, width(), color); diff --git a/Telegram/SourceFiles/info/profile/info_profile_badge.cpp b/Telegram/SourceFiles/info/profile/info_profile_badge.cpp index 00fb25cad6..46276ef5bc 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_badge.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_badge.cpp @@ -96,7 +96,8 @@ void Badge::setBadge(BadgeType badge, DocumentId emojiStatusId) { auto args = Ui::Text::CustomEmoji::Context{ .textColor = _st.premiumFg->c, .now = crl::now(), - .paused = _animationPaused && _animationPaused(), + .paused = ((_animationPaused && _animationPaused()) + || On(PowerSaving::kEmojiStatus)), }; if (!_emojiStatusPanel || !_emojiStatusPanel->paintBadgeFrame(check)) { diff --git a/Telegram/SourceFiles/settings/settings_power_saving.cpp b/Telegram/SourceFiles/settings/settings_power_saving.cpp index 37c58f87c1..21974c9a09 100644 --- a/Telegram/SourceFiles/settings/settings_power_saving.cpp +++ b/Telegram/SourceFiles/settings/settings_power_saving.cpp @@ -144,6 +144,7 @@ EditFlagsDescriptor PowerSavingLabels() { }, { kEmojiReactions, tr::lng_settings_power_emoji_reactions(tr::now) }, { kEmojiChat, tr::lng_settings_power_emoji_chat(tr::now) }, + { kEmojiStatus, tr::lng_settings_power_emoji_status(tr::now) }, }; auto chat = std::vector