Removed Ui::show from ShowSearchFromBox.

This commit is contained in:
23rd 2022-03-21 15:44:37 +03:00 committed by John Preston
parent 38abfacd88
commit 89ab23e70f
3 changed files with 14 additions and 7 deletions

View file

@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Dialogs {
void ShowSearchFromBox(
object_ptr<Ui::BoxContent> SearchFromBox(
not_null<PeerData*> peer,
Fn<void(not_null<PeerData*>)> callback,
Fn<void()> closedCallback) {
@ -34,15 +34,19 @@ void ShowSearchFromBox(
};
if (auto controller = createController()) {
auto subscription = std::make_shared<rpl::lifetime>();
auto box = Ui::show(Box<PeerListBox>(std::move(controller), [subscription](not_null<PeerListBox*> box) {
box->addButton(tr::lng_cancel(), [box, subscription] {
box->closeBox();
auto box = Box<PeerListBox>(
std::move(controller),
[subscription](not_null<PeerListBox*> box) {
box->addButton(tr::lng_cancel(), [box, subscription] {
box->closeBox();
});
});
}), Ui::LayerOption::KeepOther);
box->boxClosing() | rpl::start_with_next(
std::move(closedCallback),
*subscription);
return box;
}
return nullptr;
}
SearchFromController::SearchFromController(

View file

@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Dialogs {
void ShowSearchFromBox(
object_ptr<Ui::BoxContent> SearchFromBox(
not_null<PeerData*> peer,
Fn<void(not_null<PeerData*>)> callback,
Fn<void()> closedCallback);

View file

@ -1537,7 +1537,7 @@ void Widget::showCalendar() {
void Widget::showSearchFrom() {
if (const auto peer = _searchInChat.peer()) {
const auto chat = _searchInChat;
ShowSearchFromBox(
auto box = SearchFromBox(
peer,
crl::guard(this, [=](not_null<PeerData*> from) {
Ui::hideLayer();
@ -1545,6 +1545,9 @@ void Widget::showSearchFrom() {
applyFilterUpdate(true);
}),
crl::guard(this, [=] { _filter->setFocus(); }));
if (box) {
Window::Show(controller()).showBox(std::move(box));
}
}
}