fix: make it build & reformat

This commit is contained in:
AlexeyZavar 2025-07-06 17:15:18 +03:00
parent 616a80ff31
commit 4fc9421dd5
7 changed files with 76 additions and 73 deletions

View file

@ -16,7 +16,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_item.h" #include "history/history_item.h"
#include "history/history_unread_things.h" #include "history/history_unread_things.h"
#include "apiwrap.h" #include "apiwrap.h"
#include <ayu/ayu_settings.h>
// AyuGram includes
#include "ayu/ayu_settings.h"
namespace Api { namespace Api {
namespace { namespace {

View file

@ -231,7 +231,7 @@ AyuGramSettings::AyuGramSettings() {
disableNotificationsDelay = false; disableNotificationsDelay = false;
localPremium = false; localPremium = false;
hideChannelReactions = true; hideChannelReactions = true;
hideGroupReactions = true; hideGroupReactions = true;
// ~ Customization // ~ Customization

View file

@ -846,43 +846,43 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
}, },
container->lifetime()); container->lifetime());
AddButtonWithIcon( AddButtonWithIcon(
container, container,
tr::ayu_HideChannelReactions(), tr::ayu_HideChannelReactions(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(!settings.hideChannelReactions) rpl::single(!settings->hideChannelReactions)
)->toggledValue( )->toggledValue(
) | rpl::filter( ) | rpl::filter(
[=](bool enabled) [=](bool enabled)
{ {
return (!enabled != settings.hideChannelReactions); return (!enabled != settings->hideChannelReactions);
}) | start_with_next( }) | start_with_next(
[=](bool enabled) [=](bool enabled)
{ {
AyuSettings::set_hideChannelReactions(!enabled); AyuSettings::set_hideChannelReactions(!enabled);
AyuSettings::save(); AyuSettings::save();
}, },
container->lifetime()); container->lifetime());
AddButtonWithIcon( AddButtonWithIcon(
container, container,
tr::ayu_HideGroupReactions(), tr::ayu_HideGroupReactions(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(!settings.hideGroupReactions) rpl::single(!settings->hideGroupReactions)
)->toggledValue( )->toggledValue(
) | rpl::filter( ) | rpl::filter(
[=](bool enabled) [=](bool enabled)
{ {
return (!enabled != settings.hideGroupReactions); return (!enabled != settings->hideGroupReactions);
}) | start_with_next( }) | start_with_next(
[=](bool enabled) [=](bool enabled)
{ {
AyuSettings::set_hideGroupReactions(!enabled); AyuSettings::set_hideGroupReactions(!enabled);
AyuSettings::save(); AyuSettings::save();
}, },
container->lifetime()); container->lifetime());
} }
void SetupAppIcon(not_null<Ui::VerticalLayout*> container) { void SetupAppIcon(not_null<Ui::VerticalLayout*> container) {

View file

@ -2278,12 +2278,12 @@ Dialogs::UnreadState History::computeUnreadState() const {
result.messages = count; result.messages = count;
result.chats = count ? 1 : 0; result.chats = count ? 1 : 0;
result.marks = mark ? 1 : 0; result.marks = mark ? 1 : 0;
result.mentions = unreadMentions().has() ? 1 : 0; result.mentions = unreadMentions().has() ? 1 : 0;
const auto peer = this->peer.get(); const auto peer = this->peer.get();
const auto &settings = AyuSettings::getInstance(); const auto &settings = AyuSettings::getInstance();
const auto hideReactions = (peer->isChannel() && !peer->isMegagroup() && !settings.hideChannelReactions) const auto hideReactions = (peer->isChannel() && !peer->isMegagroup() && !settings.hideChannelReactions)
|| (peer->isMegagroup() && !settings.hideGroupReactions); || (peer->isMegagroup() && !settings.hideGroupReactions);
result.reactions = hideReactions ? 0 : (unreadReactions().has() ? 1 : 0); result.reactions = hideReactions ? 0 : (unreadReactions().has() ? 1 : 0);
result.messagesMuted = muted ? result.messages : 0; result.messagesMuted = muted ? result.messages : 0;
result.chatsMuted = muted ? result.chats : 0; result.chatsMuted = muted ? result.chats : 0;
result.marksMuted = muted ? result.marks : 0; result.marksMuted = muted ? result.marks : 0;

View file

@ -101,9 +101,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QMimeData> #include <QtCore/QMimeData>
// AyuGram includes // AyuGram includes
#include "ayu/ayu_settings.h"
#include "ayu/ui/context_menu/context_menu.h" #include "ayu/ui/context_menu/context_menu.h"
#include "ayu/utils/telegram_helpers.h" #include "ayu/utils/telegram_helpers.h"
#include "ayu/ayu_settings.h"
#include "data/data_document_media.h" #include "data/data_document_media.h"

View file

@ -1081,14 +1081,14 @@ void CheckReactionNotificationSchedule(
if (!item->hasUnreadReaction()) { if (!item->hasUnreadReaction()) {
return; return;
} }
const auto peer = item->history()->peer; const auto peer = item->history()->peer;
const auto &settings = AyuSettings::getInstance(); const auto &settings = AyuSettings::getInstance();
if ((peer->isChannel() && !peer->isMegagroup() && !settings.hideChannelReactions) if ((peer->isChannel() && !peer->isMegagroup() && !settings.hideChannelReactions)
|| (peer->isMegagroup() && !settings.hideGroupReactions)) { || (peer->isMegagroup() && !settings.hideGroupReactions)) {
item->markEffectWatched(); item->markEffectWatched();
return; return;
} }
for (const auto &[emoji, reactions] : item->recentReactions()) { for (const auto &[emoji, reactions] : item->recentReactions()) {
for (const auto &reaction : reactions) { for (const auto &reaction : reactions) {
if (!reaction.unread) { if (!reaction.unread) {
continue; continue;

View file

@ -29,8 +29,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_chat_helpers.h" #include "styles/style_chat_helpers.h"
// AyuGram includes // AyuGram includes
#include "ayu/features/messageshot/message_shot.h"
#include "ayu/ayu_settings.h" #include "ayu/ayu_settings.h"
#include "ayu/features/messageshot/message_shot.h"
namespace HistoryView::Reactions { namespace HistoryView::Reactions {
@ -104,7 +104,7 @@ std::vector<ReactionId> InlineList::computeTagsList() const {
} }
auto result = std::vector<ReactionId>(); auto result = std::vector<ReactionId>();
result.reserve(_buttons.size()); result.reserve(_buttons.size());
for (const auto& button : _buttons) { for (const auto &button : _buttons) {
result.push_back(button.id); result.push_back(button.id);
} }
return result; return result;
@ -136,11 +136,11 @@ void InlineList::layoutButtons() {
_buttons.clear(); _buttons.clear();
return; return;
} }
auto sorted = std::vector<not_null<const MessageReaction*>>(); auto sorted = std::vector<not_null<const MessageReaction*>>();
sorted.reserve(_data.reactions.size()); sorted.reserve(_data.reactions.size());
for (const auto &reaction : _data.reactions) { for (const auto &reaction : _data.reactions) {
sorted.push_back(&reaction); sorted.push_back(&reaction);
} }
const auto tags = areTags(); const auto tags = areTags();
if (!tags) { if (!tags) {
const auto &list = _owner->list(::Data::Reactions::Type::All); const auto &list = _owner->list(::Data::Reactions::Type::All);
@ -834,16 +834,16 @@ void InlineList::continueAnimations(base::flat_map<
InlineListData InlineListDataFromMessage(not_null<Element*> view) { InlineListData InlineListDataFromMessage(not_null<Element*> view) {
using Flag = InlineListData::Flag; using Flag = InlineListData::Flag;
const auto item = view->data(); const auto item = view->data();
const auto &settings = AyuSettings::getInstance(); const auto &settings = AyuSettings::getInstance();
if (!settings.hideChannelReactions if (!settings.hideChannelReactions
&& item->history()->peer->isChannel() && item->history()->peer->isChannel()
&& !item->history()->peer->isMegagroup()) { && !item->history()->peer->isMegagroup()) {
return InlineListData(); return InlineListData();
} }
if (!settings.hideGroupReactions if (!settings.hideGroupReactions
&& item->history()->peer->isMegagroup()) { && item->history()->peer->isMegagroup()) {
return InlineListData(); return InlineListData();
} }
auto result = InlineListData(); auto result = InlineListData();
result.reactions = item->reactionsWithLocal(); result.reactions = item->reactionsWithLocal();
if (const auto user = item->history()->peer->asUser()) { if (const auto user = item->history()->peer->asUser()) {
@ -881,9 +881,9 @@ InlineListData InlineListDataFromMessage(not_null<Element*> view) {
if (showUserpics) { if (showUserpics) {
result.recent.reserve(recent.size()); result.recent.reserve(recent.size());
for (const auto &[id, list] : recent) { 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()); out.reserve(list.size());
for (const auto& r : list) { for (const auto &r : list) {
out.push_back(r.peer); out.push_back(r.peer);
} }
} }