mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 13:47:05 +02:00
Added condition to hide chats filters strip.
This commit is contained in:
parent
4d9112283d
commit
1d7622e0b5
2 changed files with 10 additions and 3 deletions
|
@ -40,6 +40,7 @@ struct State final {
|
|||
std::optional<FilterId> lastFilterId = std::nullopt;
|
||||
rpl::lifetime unreadLifetime;
|
||||
base::unique_qptr<Ui::PopupMenu> menu;
|
||||
rpl::variable<bool> additionalToggleOn;
|
||||
|
||||
Api::RemoveComplexChatFilter removeApi;
|
||||
bool waitingSuggested = false;
|
||||
|
@ -128,7 +129,8 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
|||
not_null<Main::Session*> session,
|
||||
rpl::producer<int> multiSelectHeightValue,
|
||||
Fn<void(int)> setAddedTopScrollSkip,
|
||||
Fn<void(FilterId)> choose) {
|
||||
Fn<void(FilterId)> choose,
|
||||
rpl::producer<bool> additionalToggleOn) {
|
||||
const auto window = Core::App().findWindow(parent);
|
||||
const auto controller = window ? window->sessionController() : nullptr;
|
||||
|
||||
|
@ -148,6 +150,7 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
|||
object_ptr<Ui::ChatsFiltersTabs>(parent, st::dialogsSearchTabs),
|
||||
QMargins(sliderPadding, 0, sliderPadding, 0)))->entity();
|
||||
const auto state = wrap->lifetime().make_state<State>();
|
||||
state->additionalToggleOn = std::move(additionalToggleOn);
|
||||
wrap->toggle(false, anim::type::instant);
|
||||
container->sizeValue() | rpl::start_with_next([=](const QSize &s) {
|
||||
scroll->resize(s + QSize(0, scrollSt.deltax * 4));
|
||||
|
@ -271,7 +274,10 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
|||
slider->contextMenuRequested() | rpl::start_with_next([=](int index) {
|
||||
ShowMenu(wrap, controller, state, index);
|
||||
}, slider->lifetime());
|
||||
wrap->toggle((list.size() > 1), anim::type::instant);
|
||||
state->additionalToggleOn.value(
|
||||
) | rpl::start_with_next([=](bool enabled) {
|
||||
wrap->toggle(enabled && (list.size() > 1), anim::type::instant);
|
||||
}, wrap->lifetime());
|
||||
};
|
||||
session->data().chatsFilters().changed(
|
||||
) | rpl::start_with_next(rebuild, wrap->lifetime());
|
||||
|
|
|
@ -22,6 +22,7 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
|||
not_null<Main::Session*> session,
|
||||
rpl::producer<int> multiSelectHeightValue,
|
||||
Fn<void(int)> setAddedTopScrollSkip,
|
||||
Fn<void(FilterId)> choose);
|
||||
Fn<void(FilterId)> choose,
|
||||
rpl::producer<bool> additionalToggleOn = rpl::single(true));
|
||||
|
||||
} // namespace Ui
|
||||
|
|
Loading…
Add table
Reference in a new issue