Added support of close prevention for search messages in dialogs.

This commit is contained in:
23rd 2022-03-23 11:46:30 +03:00 committed by John Preston
parent 1f4ea8414b
commit 307894415f

View file

@ -4386,29 +4386,34 @@ void HistoryWidget::searchInChat() {
if (controller()->isPrimary()) { if (controller()->isPrimary()) {
controller()->content()->searchInChat(_history); controller()->content()->searchInChat(_history);
} else { } else {
const auto update = [=] { const auto search = [=] {
updateControlsVisibility(); const auto update = [=] {
updateBotKeyboard(); updateControlsVisibility();
updateFieldPlaceholder(); updateBotKeyboard();
updateFieldPlaceholder();
updateControlsGeometry(); updateControlsGeometry();
}; };
_composeSearch = std::make_unique<HistoryView::ComposeSearch>( _composeSearch = std::make_unique<HistoryView::ComposeSearch>(
this, this,
controller(), controller(),
_history); _history);
update();
setInnerFocus();
_composeSearch->destroyRequests(
) | rpl::take(
1
) | rpl::start_with_next([=] {
_composeSearch = nullptr;
update(); update();
setInnerFocus(); setInnerFocus();
}, _composeSearch->lifetime()); _composeSearch->destroyRequests(
) | rpl::take(
1
) | rpl::start_with_next([=] {
_composeSearch = nullptr;
update();
setInnerFocus();
}, _composeSearch->lifetime());
};
if (!preventsClose(search)) {
search();
}
} }
} }