mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Don't resubscribe on folder strip rebuild.
This commit is contained in:
parent
39780f49bf
commit
c080bd4c4d
1 changed files with 7 additions and 7 deletions
|
@ -41,7 +41,7 @@ namespace {
|
||||||
struct State final {
|
struct State final {
|
||||||
Ui::Animations::Simple animation;
|
Ui::Animations::Simple animation;
|
||||||
std::optional<FilterId> lastFilterId = std::nullopt;
|
std::optional<FilterId> lastFilterId = std::nullopt;
|
||||||
rpl::lifetime unreadLifetime;
|
rpl::lifetime rebuildLifetime;
|
||||||
base::unique_qptr<Ui::PopupMenu> menu;
|
base::unique_qptr<Ui::PopupMenu> menu;
|
||||||
|
|
||||||
Api::RemoveComplexChatFilter removeApi;
|
Api::RemoveComplexChatFilter removeApi;
|
||||||
|
@ -293,6 +293,7 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
||||||
if ((list.size() <= 1 && !slider->width()) || state->ignoreRefresh) {
|
if ((list.size() <= 1 && !slider->width()) || state->ignoreRefresh) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
state->rebuildLifetime.destroy();
|
||||||
auto sections = ranges::views::all(
|
auto sections = ranges::views::all(
|
||||||
list
|
list
|
||||||
) | ranges::views::transform([](const Data::ChatFilter &filter) {
|
) | ranges::views::transform([](const Data::ChatFilter &filter) {
|
||||||
|
@ -312,7 +313,7 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
||||||
: premiumFrom);
|
: premiumFrom);
|
||||||
slider->lockedClicked() | rpl::start_with_next([=] {
|
slider->lockedClicked() | rpl::start_with_next([=] {
|
||||||
controller->show(Box(FiltersLimitBox, session, std::nullopt));
|
controller->show(Box(FiltersLimitBox, session, std::nullopt));
|
||||||
}, slider->lifetime());
|
}, state->rebuildLifetime);
|
||||||
if (state->reorder) {
|
if (state->reorder) {
|
||||||
state->reorder->cancel();
|
state->reorder->cancel();
|
||||||
state->reorder->clearPinnedIntervals();
|
state->reorder->clearPinnedIntervals();
|
||||||
|
@ -326,7 +327,6 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
||||||
}
|
}
|
||||||
if (trackActiveFilterAndUnreadAndReorder) {
|
if (trackActiveFilterAndUnreadAndReorder) {
|
||||||
auto includeMuted = Data::IncludeMutedCounterFoldersValue();
|
auto includeMuted = Data::IncludeMutedCounterFoldersValue();
|
||||||
state->unreadLifetime.destroy();
|
|
||||||
for (auto i = 0; i < list.size(); i++) {
|
for (auto i = 0; i < list.size(); i++) {
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
Data::UnreadStateValue(session, list[i].id()),
|
Data::UnreadStateValue(session, list[i].id()),
|
||||||
|
@ -340,7 +340,7 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
||||||
const auto isMuted = includeMuted && (count == muted);
|
const auto isMuted = includeMuted && (count == muted);
|
||||||
slider->setUnreadCount(i, count, isMuted);
|
slider->setUnreadCount(i, count, isMuted);
|
||||||
slider->fitWidthToSections();
|
slider->fitWidthToSections();
|
||||||
}, state->unreadLifetime);
|
}, state->rebuildLifetime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[&] {
|
[&] {
|
||||||
|
@ -379,7 +379,7 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state->reorder->finishReordering();
|
state->reorder->finishReordering();
|
||||||
}, slider->lifetime());
|
}, state->rebuildLifetime);
|
||||||
}
|
}
|
||||||
rpl::single(-1) | rpl::then(
|
rpl::single(-1) | rpl::then(
|
||||||
slider->sectionActivated()
|
slider->sectionActivated()
|
||||||
|
@ -394,7 +394,7 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
||||||
scrollToIndex(index, anim::type::normal);
|
scrollToIndex(index, anim::type::normal);
|
||||||
}
|
}
|
||||||
applyFilter(filter);
|
applyFilter(filter);
|
||||||
}, wrap->lifetime());
|
}, state->rebuildLifetime);
|
||||||
slider->contextMenuRequested() | rpl::start_with_next([=](int index) {
|
slider->contextMenuRequested() | rpl::start_with_next([=](int index) {
|
||||||
if (trackActiveFilterAndUnreadAndReorder) {
|
if (trackActiveFilterAndUnreadAndReorder) {
|
||||||
ShowMenu(wrap, controller, state, index);
|
ShowMenu(wrap, controller, state, index);
|
||||||
|
@ -406,7 +406,7 @@ not_null<Ui::RpWidget*> AddChatFiltersTabsStrip(
|
||||||
slider->activeSection(),
|
slider->activeSection(),
|
||||||
[=](int i) { slider->setActiveSection(i); });
|
[=](int i) { slider->setActiveSection(i); });
|
||||||
}
|
}
|
||||||
}, slider->lifetime());
|
}, state->rebuildLifetime);
|
||||||
wrap->toggle((list.size() > 1), anim::type::instant);
|
wrap->toggle((list.size() > 1), anim::type::instant);
|
||||||
|
|
||||||
if (state->reorder) {
|
if (state->reorder) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue