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_unread_things.h"
#include "apiwrap.h"
#include <ayu/ayu_settings.h>
// AyuGram includes
#include "ayu/ayu_settings.h"
namespace Api {
namespace {

View file

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

View file

@ -846,43 +846,43 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> 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<Ui::VerticalLayout*> container) {

View file

@ -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;

View file

@ -101,9 +101,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QMimeData>
// 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"

View file

@ -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;

View file

@ -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<ReactionId> InlineList::computeTagsList() const {
}
auto result = std::vector<ReactionId>();
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<not_null<const MessageReaction*>>();
sorted.reserve(_data.reactions.size());
for (const auto &reaction : _data.reactions) {
sorted.push_back(&reaction);
}
auto sorted = std::vector<not_null<const MessageReaction*>>();
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<Element*> 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<Element*> 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);
}
}