mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Removed Ui::show from ShowSearchFromBox.
This commit is contained in:
parent
38abfacd88
commit
89ab23e70f
3 changed files with 14 additions and 7 deletions
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue