2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Slightly improved process of switching between chats filters view types.

This commit is contained in:
23rd
2024-11-04 16:28:06 +03:00
parent 81aef519d4
commit ba0da9f59e
10 changed files with 65 additions and 62 deletions

View File

@@ -1315,17 +1315,20 @@ SessionController::SessionController(
}, lifetime());
rpl::merge(
session->data().chatsFilters().changed() | rpl::filter([=] {
return session->data().chatsFilters().loaded();
}) | rpl::map([] {
return Core::App().settings().chatFiltersHorizontalValue(
) | rpl::to_empty;
}) | rpl::flatten_latest(),
Core::App().settings().chatFiltersHorizontalChanges() | rpl::to_empty,
session->data().chatsFilters().changed()
) | rpl::start_with_next([=] {
checkOpenedFilter();
crl::on_main(this, [=] {
refreshFiltersMenu();
crl::on_main(this, [this] {
if (SessionNavigation::session().data().chatsFilters().has()) {
const auto isHorizontal
= Core::App().settings().chatFiltersHorizontal();
content()->toggleFiltersMenu(isHorizontal);
toggleFiltersMenu(!isHorizontal);
} else {
content()->toggleFiltersMenu(false);
toggleFiltersMenu(false);
}
});
}, lifetime());
@@ -1556,11 +1559,6 @@ void SessionController::toggleFiltersMenu(bool enabled) {
_filtersMenuChanged.fire({});
}
void SessionController::refreshFiltersMenu() {
toggleFiltersMenu(session().data().chatsFilters().has()
&& !Core::App().settings().chatFiltersHorizontal());
}
rpl::producer<> SessionController::filtersMenuChanged() const {
return _filtersMenuChanged.events();
}

View File

@@ -630,7 +630,6 @@ private:
void init();
void setupShortcuts();
void refreshFiltersMenu();
void checkOpenedFilter();
void suggestArchiveAndMute();
void activateFirstChatsFilter();