Fixed display of top bar suggestion while display filtered dialogs.

This commit is contained in:
23rd 2025-04-12 23:07:38 +03:00 committed by John Preston
parent 3ed6d1dec1
commit 9b2b8b6796
2 changed files with 13 additions and 2 deletions

View file

@ -1035,10 +1035,17 @@ void Widget::setupTopBarSuggestions(not_null<Ui::VerticalLayout*> dialogs) {
_openedFolderOrForumChanges.events_starting_with(false), _openedFolderOrForumChanges.events_starting_with(false),
widthValue() | rpl::map( widthValue() | rpl::map(
_1 >= st::columnMinimalWidthLeft _1 >= st::columnMinimalWidthLeft
) | rpl::distinct_until_changed() ) | rpl::distinct_until_changed(),
) | rpl::map([=](FilterId id, bool folderOrForum, bool wide) { _searchStateForTopBarSuggestion.events_starting_with(
!_searchState.query.isEmpty())
) | rpl::map([=](
FilterId id,
bool folderOrForum,
bool wide,
bool search) {
return !folderOrForum return !folderOrForum
&& wide && wide
&& !search
&& (id == session->data().chatsFilters().defaultId()); && (id == session->data().chatsFilters().defaultId());
}); });
return TopBarSuggestionValue(dialogs, session, std::move(on)); return TopBarSuggestionValue(dialogs, session, std::move(on));
@ -3482,6 +3489,9 @@ bool Widget::applySearchState(SearchState state) {
&& !_openedForum); && !_openedForum);
updateControlsGeometry(); updateControlsGeometry();
} }
if (_topBarSuggestion && queryEmptyChanged) {
_searchStateForTopBarSuggestion.fire(!_searchState.query.isEmpty());
}
_searchWithPostsPreview = computeSearchWithPostsPreview(); _searchWithPostsPreview = computeSearchWithPostsPreview();
if (queryChanged) { if (queryChanged) {
updateLockUnlockVisibility(anim::type::normal); updateLockUnlockVisibility(anim::type::normal);

View file

@ -331,6 +331,7 @@ private:
Ui::SlideWrap<Ui::RpWidget> *_topBarSuggestion = nullptr; Ui::SlideWrap<Ui::RpWidget> *_topBarSuggestion = nullptr;
rpl::event_stream<int> _topBarSuggestionHeightChanged; rpl::event_stream<int> _topBarSuggestionHeightChanged;
rpl::event_stream<bool> _searchStateForTopBarSuggestion;
rpl::event_stream<bool> _openedFolderOrForumChanges; rpl::event_stream<bool> _openedFolderOrForumChanges;
object_ptr<Ui::ElasticScroll> _scroll; object_ptr<Ui::ElasticScroll> _scroll;