fix: hide from blocked

This commit is contained in:
AlexeyZavar 2024-08-10 07:52:07 +03:00
parent 254de19285
commit ba979c29dc
3 changed files with 35 additions and 0 deletions

View file

@ -41,6 +41,8 @@ rpl::variable<QString> editedMarkReactive;
rpl::variable<int> showPeerIdReactive;
rpl::variable<bool> 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<bool> get_ghostModeEnabledReactive() {
return ghostModeEnabled.value();
}
rpl::producer<bool> get_hideFromBlockedReactive() {
return hideFromBlockedReactive.value();
}
}

View file

@ -210,4 +210,6 @@ rpl::producer<int> get_showPeerIdReactive();
bool get_ghostModeEnabled();
rpl::producer<bool> get_ghostModeEnabledReactive();
rpl::producer<bool> get_hideFromBlockedReactive();
}

View file

@ -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, [=] {