diff --git a/Telegram/SourceFiles/api/api_unread_things.cpp b/Telegram/SourceFiles/api/api_unread_things.cpp index 89774cdc39..ba1359caba 100644 --- a/Telegram/SourceFiles/api/api_unread_things.cpp +++ b/Telegram/SourceFiles/api/api_unread_things.cpp @@ -16,7 +16,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_item.h" #include "history/history_unread_things.h" #include "apiwrap.h" -#include + +// AyuGram includes +#include "ayu/ayu_settings.h" + namespace Api { namespace { diff --git a/Telegram/SourceFiles/ayu/ayu_settings.cpp b/Telegram/SourceFiles/ayu/ayu_settings.cpp index c5cfc39a0e..3527898614 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.cpp +++ b/Telegram/SourceFiles/ayu/ayu_settings.cpp @@ -231,7 +231,7 @@ AyuGramSettings::AyuGramSettings() { disableNotificationsDelay = false; localPremium = false; - hideChannelReactions = true; + hideChannelReactions = true; hideGroupReactions = true; // ~ Customization diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp index f04347b547..a2666cc6b7 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp @@ -846,43 +846,43 @@ void SetupQoLToggles(not_null container) { }, container->lifetime()); - AddButtonWithIcon( - container, - tr::ayu_HideChannelReactions(), - st::settingsButtonNoIcon - )->toggleOn( - rpl::single(!settings.hideChannelReactions) - )->toggledValue( - ) | rpl::filter( - [=](bool enabled) - { - return (!enabled != settings.hideChannelReactions); - }) | start_with_next( - [=](bool enabled) - { - AyuSettings::set_hideChannelReactions(!enabled); - AyuSettings::save(); - }, - container->lifetime()); - - AddButtonWithIcon( - container, - tr::ayu_HideGroupReactions(), - st::settingsButtonNoIcon - )->toggleOn( - rpl::single(!settings.hideGroupReactions) - )->toggledValue( - ) | rpl::filter( - [=](bool enabled) - { - return (!enabled != settings.hideGroupReactions); - }) | start_with_next( - [=](bool enabled) - { - AyuSettings::set_hideGroupReactions(!enabled); - AyuSettings::save(); - }, - container->lifetime()); + AddButtonWithIcon( + container, + tr::ayu_HideChannelReactions(), + st::settingsButtonNoIcon + )->toggleOn( + rpl::single(!settings->hideChannelReactions) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (!enabled != settings->hideChannelReactions); + }) | start_with_next( + [=](bool enabled) + { + AyuSettings::set_hideChannelReactions(!enabled); + AyuSettings::save(); + }, + container->lifetime()); + + AddButtonWithIcon( + container, + tr::ayu_HideGroupReactions(), + st::settingsButtonNoIcon + )->toggleOn( + rpl::single(!settings->hideGroupReactions) + )->toggledValue( + ) | rpl::filter( + [=](bool enabled) + { + return (!enabled != settings->hideGroupReactions); + }) | start_with_next( + [=](bool enabled) + { + AyuSettings::set_hideGroupReactions(!enabled); + AyuSettings::save(); + }, + container->lifetime()); } void SetupAppIcon(not_null container) { diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 2153a15df9..292fdd6cb3 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -2278,12 +2278,12 @@ Dialogs::UnreadState History::computeUnreadState() const { result.messages = count; result.chats = count ? 1 : 0; result.marks = mark ? 1 : 0; - result.mentions = unreadMentions().has() ? 1 : 0; - const auto peer = this->peer.get(); - const auto &settings = AyuSettings::getInstance(); - const auto hideReactions = (peer->isChannel() && !peer->isMegagroup() && !settings.hideChannelReactions) - || (peer->isMegagroup() && !settings.hideGroupReactions); - result.reactions = hideReactions ? 0 : (unreadReactions().has() ? 1 : 0); + result.mentions = unreadMentions().has() ? 1 : 0; + const auto peer = this->peer.get(); + const auto &settings = AyuSettings::getInstance(); + const auto hideReactions = (peer->isChannel() && !peer->isMegagroup() && !settings.hideChannelReactions) + || (peer->isMegagroup() && !settings.hideGroupReactions); + result.reactions = hideReactions ? 0 : (unreadReactions().has() ? 1 : 0); result.messagesMuted = muted ? result.messages : 0; result.chatsMuted = muted ? result.chats : 0; result.marksMuted = muted ? result.marks : 0; diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index e4d6f7ae3e..632fdae1ae 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -101,9 +101,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include // AyuGram includes +#include "ayu/ayu_settings.h" #include "ayu/ui/context_menu/context_menu.h" #include "ayu/utils/telegram_helpers.h" -#include "ayu/ayu_settings.h" #include "data/data_document_media.h" diff --git a/Telegram/SourceFiles/history/history_item_helpers.cpp b/Telegram/SourceFiles/history/history_item_helpers.cpp index 0ee1154efb..923fcbfd23 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.cpp +++ b/Telegram/SourceFiles/history/history_item_helpers.cpp @@ -1081,14 +1081,14 @@ void CheckReactionNotificationSchedule( if (!item->hasUnreadReaction()) { return; } - const auto peer = item->history()->peer; - const auto &settings = AyuSettings::getInstance(); - if ((peer->isChannel() && !peer->isMegagroup() && !settings.hideChannelReactions) - || (peer->isMegagroup() && !settings.hideGroupReactions)) { - item->markEffectWatched(); - return; - } - for (const auto &[emoji, reactions] : item->recentReactions()) { + const auto peer = item->history()->peer; + const auto &settings = AyuSettings::getInstance(); + if ((peer->isChannel() && !peer->isMegagroup() && !settings.hideChannelReactions) + || (peer->isMegagroup() && !settings.hideGroupReactions)) { + item->markEffectWatched(); + return; + } + for (const auto &[emoji, reactions] : item->recentReactions()) { for (const auto &reaction : reactions) { if (!reaction.unread) { continue; diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp index a2820a1c96..5daa9f48f8 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp @@ -29,8 +29,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_chat_helpers.h" // AyuGram includes -#include "ayu/features/messageshot/message_shot.h" #include "ayu/ayu_settings.h" +#include "ayu/features/messageshot/message_shot.h" namespace HistoryView::Reactions { @@ -104,7 +104,7 @@ std::vector InlineList::computeTagsList() const { } auto result = std::vector(); result.reserve(_buttons.size()); - for (const auto& button : _buttons) { + for (const auto &button : _buttons) { result.push_back(button.id); } return result; @@ -136,11 +136,11 @@ void InlineList::layoutButtons() { _buttons.clear(); return; } - auto sorted = std::vector>(); - sorted.reserve(_data.reactions.size()); - for (const auto &reaction : _data.reactions) { - sorted.push_back(&reaction); - } + auto sorted = std::vector>(); + sorted.reserve(_data.reactions.size()); + for (const auto &reaction : _data.reactions) { + sorted.push_back(&reaction); + } const auto tags = areTags(); if (!tags) { const auto &list = _owner->list(::Data::Reactions::Type::All); @@ -834,16 +834,16 @@ void InlineList::continueAnimations(base::flat_map< InlineListData InlineListDataFromMessage(not_null view) { using Flag = InlineListData::Flag; const auto item = view->data(); - const auto &settings = AyuSettings::getInstance(); - if (!settings.hideChannelReactions - && item->history()->peer->isChannel() - && !item->history()->peer->isMegagroup()) { - return InlineListData(); - } - if (!settings.hideGroupReactions - && item->history()->peer->isMegagroup()) { - return InlineListData(); - } + const auto &settings = AyuSettings::getInstance(); + if (!settings.hideChannelReactions + && item->history()->peer->isChannel() + && !item->history()->peer->isMegagroup()) { + return InlineListData(); + } + if (!settings.hideGroupReactions + && item->history()->peer->isMegagroup()) { + return InlineListData(); + } auto result = InlineListData(); result.reactions = item->reactionsWithLocal(); if (const auto user = item->history()->peer->asUser()) { @@ -881,9 +881,9 @@ InlineListData InlineListDataFromMessage(not_null view) { if (showUserpics) { result.recent.reserve(recent.size()); for (const auto &[id, list] : recent) { - auto& out = result.recent.emplace(id).first->second; + auto &out = result.recent.emplace(id).first->second; out.reserve(list.size()); - for (const auto& r : list) { + for (const auto &r : list) { out.push_back(r.peer); } }