From ba979c29dc4e59a7620b72dc60600370a57e5f52 Mon Sep 17 00:00:00 2001 From: AlexeyZavar Date: Sat, 10 Aug 2024 07:52:07 +0300 Subject: [PATCH] fix: hide from blocked --- Telegram/SourceFiles/ayu/ayu_settings.cpp | 9 +++++++ Telegram/SourceFiles/ayu/ayu_settings.h | 2 ++ .../SourceFiles/history/history_widget.cpp | 24 +++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/Telegram/SourceFiles/ayu/ayu_settings.cpp b/Telegram/SourceFiles/ayu/ayu_settings.cpp index f226a69f4..f5cc5cfd6 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.cpp +++ b/Telegram/SourceFiles/ayu/ayu_settings.cpp @@ -41,6 +41,8 @@ rpl::variable editedMarkReactive; rpl::variable showPeerIdReactive; +rpl::variable hideFromBlockedReactive; + rpl::lifetime lifetime = rpl::lifetime(); bool ghostModeEnabled_util(const AyuGramSettings &settingsUtil) { @@ -135,6 +137,8 @@ void postinitialize() { editedMarkReactive = settings->editedMark; showPeerIdReactive = settings->showPeerId; + hideFromBlockedReactive = settings->hideFromBlocked; + ghostModeEnabled = ghostModeEnabled_util(settings.value()); } @@ -331,6 +335,7 @@ void AyuGramSettings::set_saveMessagesHistory(bool val) { void AyuGramSettings::set_hideFromBlocked(bool val) { hideFromBlocked = val; + hideFromBlockedReactive = val; } void AyuGramSettings::set_disableAds(bool val) { @@ -504,4 +509,8 @@ rpl::producer get_ghostModeEnabledReactive() { return ghostModeEnabled.value(); } +rpl::producer get_hideFromBlockedReactive() { + return hideFromBlockedReactive.value(); +} + } diff --git a/Telegram/SourceFiles/ayu/ayu_settings.h b/Telegram/SourceFiles/ayu/ayu_settings.h index 796cd6639..a6a3c27b8 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.h +++ b/Telegram/SourceFiles/ayu/ayu_settings.h @@ -210,4 +210,6 @@ rpl::producer get_showPeerIdReactive(); bool get_ghostModeEnabled(); rpl::producer get_ghostModeEnabledReactive(); +rpl::producer get_hideFromBlockedReactive(); + } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 7939cdeb1..e72e03ad7 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -655,6 +655,30 @@ HistoryWidget::HistoryWidget( item->mainView()->itemDataChanged(); }, lifetime()); + rpl::merge( + AyuSettings::get_hideFromBlockedReactive() | rpl::to_empty, + session().changes().peerUpdates( + Data::PeerUpdate::Flag::IsBlocked + ) | rpl::to_empty + ) | rpl::start_with_next( + [=] + { + crl::on_main( + this, + [=] + { + if (_history) { + _history->forceFullResize(); + if (_migrated) { + _migrated->forceFullResize(); + } + updateHistoryGeometry(); + update(); + } + }); + }, + lifetime()); + Core::App().settings().largeEmojiChanges( ) | rpl::start_with_next([=] { crl::on_main(this, [=] {