Replaced observable in Dialogs::InnerWidget with rpl.

This commit is contained in:
23rd 2021-05-25 13:44:30 +03:00
parent 386fae952b
commit 3340b2dc03
3 changed files with 9 additions and 9 deletions

View file

@ -126,9 +126,6 @@ InnerWidget::InnerWidget(
_cancelSearchInChat->setClickedCallback([=] { cancelSearchInChat(); }); _cancelSearchInChat->setClickedCallback([=] { cancelSearchInChat(); });
_cancelSearchInChat->hide(); _cancelSearchInChat->hide();
_cancelSearchFromUser->setClickedCallback([=] {
searchFromUserChanged.notify(nullptr);
});
_cancelSearchFromUser->hide(); _cancelSearchFromUser->hide();
session().downloaderTaskFinished( session().downloaderTaskFinished(
@ -1957,6 +1954,10 @@ rpl::producer<> InnerWidget::listBottomReached() const {
return _listBottomReached.events(); return _listBottomReached.events();
} }
rpl::producer<> InnerWidget::cancelSearchFromUserRequests() const {
return _cancelSearchFromUser->clicks() | rpl::to_empty;
}
void InnerWidget::visibleTopBottomUpdated( void InnerWidget::visibleTopBottomUpdated(
int visibleTop, int visibleTop,
int visibleBottom) { int visibleBottom) {

View file

@ -120,9 +120,7 @@ public:
void setLoadMoreCallback(Fn<void()> callback); void setLoadMoreCallback(Fn<void()> callback);
[[nodiscard]] rpl::producer<> listBottomReached() const; [[nodiscard]] rpl::producer<> listBottomReached() const;
[[nodiscard]] rpl::producer<> cancelSearchFromUserRequests() const;
base::Observable<PeerData*> searchFromUserChanged;
[[nodiscard]] rpl::producer<ChosenRow> chosenRow() const; [[nodiscard]] rpl::producer<ChosenRow> chosenRow() const;
[[nodiscard]] rpl::producer<> updated() const; [[nodiscard]] rpl::producer<> updated() const;

View file

@ -207,10 +207,11 @@ Widget::Widget(
connect(_inner, SIGNAL(completeHashtag(QString)), this, SLOT(onCompleteHashtag(QString))); connect(_inner, SIGNAL(completeHashtag(QString)), this, SLOT(onCompleteHashtag(QString)));
connect(_inner, SIGNAL(refreshHashtags()), this, SLOT(onFilterCursorMoved())); connect(_inner, SIGNAL(refreshHashtags()), this, SLOT(onFilterCursorMoved()));
connect(_inner, SIGNAL(cancelSearchInChat()), this, SLOT(onCancelSearchInChat())); connect(_inner, SIGNAL(cancelSearchInChat()), this, SLOT(onCancelSearchInChat()));
subscribe(_inner->searchFromUserChanged, [this](PeerData *from) { _inner->cancelSearchFromUserRequests(
setSearchInChat(_searchInChat, from); ) | rpl::start_with_next([=] {
setSearchInChat(_searchInChat, nullptr);
applyFilterUpdate(true); applyFilterUpdate(true);
}); }, lifetime());
_inner->chosenRow( _inner->chosenRow(
) | rpl::start_with_next([=](const ChosenRow &row) { ) | rpl::start_with_next([=](const ChosenRow &row) {
const auto openSearchResult = !controller->selectingPeer() const auto openSearchResult = !controller->selectingPeer()