Don't jump to top in StickersBox on stickersUpdated.

This commit is contained in:
John Preston 2021-12-31 16:50:43 +03:00
parent c632316ad7
commit 38ee57f852
2 changed files with 14 additions and 7 deletions

View file

@ -547,7 +547,9 @@ void StickersBox::prepare() {
} }
setNoContentMargin(true); setNoContentMargin(true);
_tabs->sectionActivated( _tabs->sectionActivated(
) | rpl::start_with_next( ) | rpl::filter([=] {
return !_ignoreTabActivation;
}) | rpl::start_with_next(
[this] { switchTab(); }, [this] { switchTab(); },
lifetime()); lifetime());
refreshTabs(); refreshTabs();
@ -665,12 +667,16 @@ void StickersBox::refreshTabs() {
|| (_tab == &_featured && !_tabIndices.contains(Section::Featured)) || (_tab == &_featured && !_tabIndices.contains(Section::Featured))
|| (_tab == &_masks && !_tabIndices.contains(Section::Masks))) { || (_tab == &_masks && !_tabIndices.contains(Section::Masks))) {
switchTab(); switchTab();
} else if (_tab == &_archived) { } else {
_tabs->setActiveSectionFast(_tabIndices.indexOf(Section::Archived)); _ignoreTabActivation = true;
} else if (_tab == &_featured) { _tabs->setActiveSectionFast(_tabIndices.indexOf((_tab == &_archived)
_tabs->setActiveSectionFast(_tabIndices.indexOf(Section::Featured)); ? Section::Archived
} else if (_tab == &_masks) { : (_tab == &_featured)
_tabs->setActiveSectionFast(_tabIndices.indexOf(Section::Masks)); ? Section::Featured
: (_tab == &_masks)
? Section::Masks
: Section::Installed));
_ignoreTabActivation = false;
} }
updateTabsGeometry(); updateTabsGeometry();
} }

View file

@ -143,6 +143,7 @@ private:
object_ptr<Ui::SettingsSlider> _tabs = { nullptr }; object_ptr<Ui::SettingsSlider> _tabs = { nullptr };
QList<Section> _tabIndices; QList<Section> _tabIndices;
bool _ignoreTabActivation = false;
class CounterWidget; class CounterWidget;
object_ptr<CounterWidget> _unreadBadge = { nullptr }; object_ptr<CounterWidget> _unreadBadge = { nullptr };