diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 23dc0e5293..172045afef 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -7669,8 +7669,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ayu_HideChannelReactions" = "Hide Reactions in Channels"; "ayu_HideGroupReactions" = "Hide Reactions in Groups"; "ayu_HideReactions" = "Hide Reactions"; -"ayu_HideReactionsInChannels" = "In Channels"; -"ayu_HideReactionsInGroups" = "In Groups"; +"ayu_HideReactionsInChannels" = "Channels"; +"ayu_HideReactionsInGroups" = "Groups"; +"ayu_HideReactionsInPrivateChats" = "Private Chats"; "ayu_QuickAdminShortcuts" = "Quick Admin Shortcuts"; "ayu_TranslationProvider" = "Translation Provider"; "ayu_LinksHeader" = "Links"; diff --git a/Telegram/SourceFiles/api/api_unread_things.cpp b/Telegram/SourceFiles/api/api_unread_things.cpp index d111022db7..4d2a151c47 100644 --- a/Telegram/SourceFiles/api/api_unread_things.cpp +++ b/Telegram/SourceFiles/api/api_unread_things.cpp @@ -53,6 +53,9 @@ bool UnreadThings::trackReactions(Data::Thread *thread) const { if (peer->isMegagroup() && !settings.showGroupReactions()) { return false; } + if (peer->isUser() && !settings.showPrivateChatReactions()) { + return false; + } return peer->isUser() || peer->isChat() || peer->isMegagroup(); } diff --git a/Telegram/SourceFiles/ayu/ayu_settings.cpp b/Telegram/SourceFiles/ayu/ayu_settings.cpp index 6595ad42c5..0c50767bb6 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.cpp +++ b/Telegram/SourceFiles/ayu/ayu_settings.cpp @@ -621,6 +621,12 @@ void AyuSettings::setShowGroupReactions(bool val) { save(); } +void AyuSettings::setShowPrivateChatReactions(bool val) { + if (_showPrivateChatReactions.current() == val) return; + _showPrivateChatReactions = val; + save(); +} + void AyuSettings::setAppIcon(const QString &val) { if (_appIcon.current() == val) return; _appIcon = val; @@ -970,6 +976,7 @@ void to_json(nlohmann::json &j, const AyuSettings &s) { {"localPremium", s._localPremium.current()}, {"showChannelReactions", s._showChannelReactions.current()}, {"showGroupReactions", s._showGroupReactions.current()}, + {"showPrivateChatReactions", s._showPrivateChatReactions.current()}, {"appIcon", s._appIcon.current()}, {"simpleQuotesAndReplies", s._simpleQuotesAndReplies.current()}, {"hideFastShare", s._hideFastShare.current()}, @@ -1063,6 +1070,7 @@ void from_json(const nlohmann::json &j, AyuSettings &s) { s._localPremium = j.value("localPremium", defaults._localPremium.current()); s._showChannelReactions = j.value("showChannelReactions", defaults._showChannelReactions.current()); s._showGroupReactions = j.value("showGroupReactions", defaults._showGroupReactions.current()); + s._showPrivateChatReactions = j.value("showPrivateChatReactions", defaults._showPrivateChatReactions.current()); s._appIcon = j.value("appIcon", defaults._appIcon.current()); s._simpleQuotesAndReplies = j.value("simpleQuotesAndReplies", defaults._simpleQuotesAndReplies.current()); s._hideFastShare = j.value("hideFastShare", defaults._hideFastShare.current()); diff --git a/Telegram/SourceFiles/ayu/ayu_settings.h b/Telegram/SourceFiles/ayu/ayu_settings.h index be404240c7..944228f5b4 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.h +++ b/Telegram/SourceFiles/ayu/ayu_settings.h @@ -249,6 +249,7 @@ public: [[nodiscard]] bool localPremium() const { return _localPremium.current(); } [[nodiscard]] bool showChannelReactions() const { return _showChannelReactions.current(); } [[nodiscard]] bool showGroupReactions() const { return _showGroupReactions.current(); } + [[nodiscard]] bool showPrivateChatReactions() const { return _showPrivateChatReactions.current(); } [[nodiscard]] const QString &appIcon() const { return _appIcon.current(); } [[nodiscard]] bool simpleQuotesAndReplies() const { return _simpleQuotesAndReplies.current(); } [[nodiscard]] bool hideFastShare() const { return _hideFastShare.current(); } @@ -325,6 +326,7 @@ public: void setLocalPremium(bool val); void setShowChannelReactions(bool val); void setShowGroupReactions(bool val); + void setShowPrivateChatReactions(bool val); void setAppIcon(const QString &val); void setSimpleQuotesAndReplies(bool val); void setHideFastShare(bool val); @@ -402,6 +404,7 @@ public: [[nodiscard]] rpl::producer localPremiumChanges() const { return _localPremium.value(); } [[nodiscard]] rpl::producer showChannelReactionsChanges() const { return _showChannelReactions.value(); } [[nodiscard]] rpl::producer showGroupReactionsChanges() const { return _showGroupReactions.value(); } + [[nodiscard]] rpl::producer showPrivateChatReactionsChanges() const { return _showPrivateChatReactions.value(); } [[nodiscard]] rpl::producer appIconChanges() const { return _appIcon.value(); } [[nodiscard]] rpl::producer simpleQuotesAndRepliesChanges() const { return _simpleQuotesAndReplies.value(); } [[nodiscard]] rpl::producer hideFastShareChanges() const { return _hideFastShare.value(); } @@ -487,6 +490,7 @@ private: rpl::variable _localPremium = false; rpl::variable _showChannelReactions = true; rpl::variable _showGroupReactions = true; + rpl::variable _showPrivateChatReactions = true; rpl::variable _appIcon; rpl::variable _simpleQuotesAndReplies = false; rpl::variable _hideFastShare = false; diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_chats.cpp b/Telegram/SourceFiles/ayu/ui/settings/settings_chats.cpp index d284ebace8..3fdbe218ff 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_chats.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_chats.cpp @@ -58,6 +58,11 @@ void BuildStickersAndEmoji(SectionBuilder &builder, AyuSectionBuilder &ayu) { tr::ayu_HideReactionsInGroups(tr::now), [] { return !AyuSettings::getInstance().showGroupReactions(); }, [](bool v) { AyuSettings::getInstance().setShowGroupReactions(!v); } + }, + NestedEntry{ + tr::ayu_HideReactionsInPrivateChats(tr::now), + [] { return !AyuSettings::getInstance().showPrivateChatReactions(); }, + [](bool v) { AyuSettings::getInstance().setShowPrivateChatReactions(!v); } } }, .toggledWhenAll = false, diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index fc6b7963b1..5c71218ec5 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -2455,7 +2455,8 @@ Dialogs::UnreadState History::computeUnreadState() const { const auto peer = this->peer.get(); const auto &settings = AyuSettings::getInstance(); const auto hideReactions = (peer->isChannel() && !peer->isMegagroup() && !settings.showChannelReactions()) - || (peer->isMegagroup() && !settings.showGroupReactions()); + || (peer->isMegagroup() && !settings.showGroupReactions()) + || (peer->isUser() && !settings.showPrivateChatReactions()); result.reactions = hideReactions ? 0 : (unreadReactions().has() ? 1 : 0); result.messagesMuted = muted ? result.messages : 0; result.chatsMuted = muted ? result.chats : 0; diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index b9fa929eeb..8986c784eb 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -1244,7 +1244,8 @@ void HistoryInner::paintEvent(QPaintEvent *e) { const auto peer = item->history()->peer; const auto &settings = AyuSettings::getInstance(); const auto hide = (!settings.showChannelReactions() && peer->isChannel() && !peer->isMegagroup()) || - (!settings.showGroupReactions() && peer->isMegagroup()); + (!settings.showGroupReactions() && peer->isMegagroup()) || + (!settings.showPrivateChatReactions() && peer->isUser()); if (!hide) { startEffects.emplace(view); } else { diff --git a/Telegram/SourceFiles/history/history_item_helpers.cpp b/Telegram/SourceFiles/history/history_item_helpers.cpp index 90393f5c3d..df7377d820 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.cpp +++ b/Telegram/SourceFiles/history/history_item_helpers.cpp @@ -1187,7 +1187,8 @@ void CheckReactionNotificationSchedule( const auto peer = item->history()->peer; const auto &settings = AyuSettings::getInstance(); if ((peer->isChannel() && !peer->isMegagroup() && !settings.showChannelReactions()) - || (peer->isMegagroup() && !settings.showGroupReactions())) { + || (peer->isMegagroup() && !settings.showGroupReactions()) + || (peer->isUser() && !settings.showPrivateChatReactions())) { item->markEffectWatched(); return; } diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp index 72e4a1cb68..63040402d9 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp @@ -854,6 +854,10 @@ InlineListData InlineListDataFromMessage(not_null view) { && item->history()->peer->isMegagroup()) { return InlineListData(); } + if (!settings.showPrivateChatReactions() + && item->history()->peer->isUser()) { + return InlineListData(); + } auto result = InlineListData(); result.reactions = item->reactionsWithLocal(); diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp index e86bf8b1ad..3b1ef01484 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions_selector.cpp @@ -1394,7 +1394,8 @@ AttachSelectorResult AttachSelectorToMenu( const auto peer = item->history()->peer; if ((peer->isChannel() && !peer->isMegagroup() && !settings.showChannelReactions()) - || (peer->isMegagroup() && !settings.showGroupReactions())) { + || (peer->isMegagroup() && !settings.showGroupReactions()) + || (peer->isUser() && !settings.showPrivateChatReactions())) { return AttachSelectorResult::Skipped; }