mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Add a power saving setting for effects.
This commit is contained in:
parent
a7bffe7abd
commit
f61f649a7e
4 changed files with 7 additions and 2 deletions
|
@ -785,6 +785,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_settings_power_chat" = "Animations in Chats";
|
||||
"lng_settings_power_chat_background" = "Background rotation";
|
||||
"lng_settings_power_chat_spoiler" = "Animated spoiler effect";
|
||||
"lng_settings_power_chat_effects" = "Effects in messages";
|
||||
"lng_settings_power_calls" = "Animations in Calls";
|
||||
"lng_settings_power_ui" = "Interface animations";
|
||||
"lng_settings_power_auto" = "Save Power on Low Battery";
|
||||
|
|
|
@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "lottie/lottie_common.h"
|
||||
#include "lottie/lottie_single_player.h"
|
||||
#include "base/random.h"
|
||||
#include "ui/power_saving.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
||||
namespace HistoryView {
|
||||
|
@ -155,7 +156,8 @@ void EmojiInteractions::play(
|
|||
}
|
||||
|
||||
void EmojiInteractions::playEffectOnRead(not_null<const Element*> view) {
|
||||
if (view->data()->markEffectWatched()) {
|
||||
const auto flag = PowerSaving::Flag::kChatEffects;
|
||||
if (view->data()->markEffectWatched() && !PowerSaving::On(flag)) {
|
||||
playEffect(view);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@ EditFlagsDescriptor<PowerSaving::Flags> PowerSavingLabels() {
|
|||
&st::menuIconChatBubble,
|
||||
},
|
||||
{ kChatSpoiler, tr::lng_settings_power_chat_spoiler(tr::now) },
|
||||
{ kChatEffects, tr::lng_settings_power_chat_effects(tr::now) },
|
||||
};
|
||||
auto calls = std::vector<Label>{
|
||||
{
|
||||
|
|
|
@ -20,8 +20,9 @@ enum Flag : uint32 {
|
|||
kChatSpoiler = (1U << 7),
|
||||
kCalls = (1U << 8),
|
||||
kEmojiStatus = (1U << 9),
|
||||
kChatEffects = (1U << 10),
|
||||
|
||||
kAll = (1U << 10) - 1,
|
||||
kAll = (1U << 11) - 1,
|
||||
};
|
||||
inline constexpr bool is_flag_type(Flag) { return true; }
|
||||
using Flags = base::flags<Flag>;
|
||||
|
|
Loading…
Add table
Reference in a new issue