diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index 6b81f7ae2..4f4d04f12 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -397,7 +397,7 @@ void AddContactBox::save() { if (user->isContact() || user->session().supportMode()) { Ui::showPeerHistory(user, ShowAtTheEndMsgId); } - Ui::hideLayer(); + getDelegate()->hideLayer(); } else if (isBoxShown()) { hideChildren(); _retrying = true; @@ -593,7 +593,7 @@ void GroupInfoBox::createGroup( auto image = _photo->takeResultImage(); const auto navigation = _navigation; - Ui::hideLayer(); // Destroys 'this'. + getDelegate()->hideLayer(); // Destroys 'this'. ChatCreateDone(navigation, std::move(image), result); }).fail([=](const MTP::Error &error) { const auto &type = error.type(); @@ -1253,7 +1253,7 @@ void SetupChannelBox::updateFail(UsernameResult result) { void SetupChannelBox::checkFail(UsernameResult result) { if (result == UsernameResult::NA) { - Ui::hideLayer(); + getDelegate()->hideLayer(); } else if (result == UsernameResult::ChatsTooMuch) { if (_existing) { showRevokePublicLinkBoxForEdit(); @@ -1291,7 +1291,7 @@ void SetupChannelBox::showRevokePublicLinkBoxForEdit() { void SetupChannelBox::firstCheckFail(UsernameResult result) { if (result == UsernameResult::NA) { - Ui::hideLayer(); + getDelegate()->hideLayer(); } else if (result == UsernameResult::ChatsTooMuch) { if (_existing) { showRevokePublicLinkBoxForEdit(); diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index 69e314f33..c0e95ce54 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -718,9 +718,9 @@ void Instance::requestPermissionOrFail(Platform::PermissionType type, Fn } Ui::show(Ui::MakeConfirmBox({ .text = tr::lng_no_mic_permission(), - .confirmed = crl::guard(this, [=] { + .confirmed = crl::guard(this, [=](Fn &&close) { Platform::OpenSystemSettingsForPermission(type); - Ui::hideLayer(); + close(); }), .confirmText = tr::lng_menu_settings(), })); diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index f8a22348d..89cac065d 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -3683,13 +3683,14 @@ void StickersListWidget::removeMegagroupSet(bool locally) { _removingSetId = Data::Stickers::MegagroupSetId; controller()->show(Ui::MakeConfirmBox({ .text = tr::lng_stickers_remove_group_set(), - .confirmed = crl::guard(this, [this, group = _megagroupSet] { + .confirmed = crl::guard(this, [this, group = _megagroupSet]( + Fn &&close) { Expects(group->mgInfo != nullptr); if (group->mgInfo->stickerSet) { session().api().setGroupStickerSet(group, {}); } - Ui::hideLayer(); + close(); _removingSetId = 0; _checkForHide.fire({}); }), diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp index 774f4ee03..5f972b9b4 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp @@ -339,7 +339,7 @@ Widget::Widget( void Widget::showFilter() { _inner->showFilter([this](FilterValue &&filter) { applyFilter(std::move(filter)); - Ui::hideLayer(); + controller()->hideLayer(); }); } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index e7afc350e..e2fc57e2d 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -7026,7 +7026,7 @@ void HistoryWidget::cancelEdit() { } void HistoryWidget::cancelFieldAreaState() { - Ui::hideLayer(); + controller()->hideLayer(); _replyForwardPressed = false; if (_previewData && _previewData->pendingTill >= 0) { _previewState = Data::PreviewState::Cancelled; @@ -7292,10 +7292,10 @@ void HistoryWidget::escape() { && PrepareEditText(_replyEditMsg) != _field->getTextWithTags()) { controller()->show(Ui::MakeConfirmBox({ .text = tr::lng_cancel_edit_post_sure(), - .confirmed = crl::guard(this, [this] { + .confirmed = crl::guard(this, [this](Fn &&close) { if (_editMsgId) { cancelEdit(); - Ui::hideLayer(); + close(); } }), .confirmText = tr::lng_cancel_edit_post_yes(), diff --git a/Telegram/SourceFiles/info/info_layer_widget.cpp b/Telegram/SourceFiles/info/info_layer_widget.cpp index 63de91226..f3c2d095d 100644 --- a/Telegram/SourceFiles/info/info_layer_widget.cpp +++ b/Telegram/SourceFiles/info/info_layer_widget.cpp @@ -18,7 +18,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "window/main_window.h" #include "main/main_session.h" -#include "boxes/abstract_box.h" #include "core/application.h" #include "styles/style_info.h" #include "styles/style_window.h" @@ -227,7 +226,7 @@ bool LayerWidget::showSectionInternal( const Window::SectionShow ¶ms) { if (_content && _content->showInternal(memento, params)) { if (params.activation != anim::activation::background) { - Ui::hideLayer(); + _controller->parentController()->hideLayer(); } return true; } diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index e569e4443..e0daabd2e 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -453,7 +453,7 @@ void WrapWidget::createTopBar() { } void WrapWidget::checkBeforeClose(Fn close) { - Ui::hideLayer(); + _controller->parentController()->hideLayer(); close(); } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 6430afecb..b12715c29 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -311,7 +311,7 @@ MainWidget::MainWidget( } else { Ui::showPeerHistory(history, ShowAtUnreadMsgId); } - Ui::hideLayer(); + _controller->hideLayer(); } }, lifetime()); @@ -1644,7 +1644,7 @@ void MainWidget::showNewSection( saveInStack = false; } else if (auto layer = memento->createLayer(_controller, layerRect)) { if (params.activation != anim::activation::background) { - Ui::hideLayer(anim::type::instant); + _controller->hideLayer(anim::type::instant); } _controller->showSpecialLayer(std::move(layer)); return; diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 51fbce41c..3785edacb 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -1876,7 +1876,7 @@ void OverlayWidget::deleteMedia() { .text = tr::lng_delete_photo_sure(), .confirmed = crl::guard(_widget, [=] { session->api().peerPhoto().clear(photo); - Ui::hideLayer(); + window->hideLayer(); }), .confirmText = tr::lng_box_delete(), }), diff --git a/Telegram/SourceFiles/settings/settings_calls.cpp b/Telegram/SourceFiles/settings/settings_calls.cpp index cb3df10dd..d0bb35861 100644 --- a/Telegram/SourceFiles/settings/settings_calls.cpp +++ b/Telegram/SourceFiles/settings/settings_calls.cpp @@ -34,8 +34,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "webrtc/webrtc_audio_input_tester.h" #include "webrtc/webrtc_create_adm.h" // Webrtc::Backend. #include "tgcalls/VideoCaptureInterface.h" -#include "facades.h" -#include "boxes/abstract_box.h" // Ui::hideLayer(). #include "styles/style_layers.h" namespace Settings { @@ -343,10 +341,10 @@ void Calls::requestPermissionAndStartTestingMicrophone() { Platform::PermissionType::Microphone, startTestingChecked); } else { - const auto showSystemSettings = [] { + const auto showSystemSettings = [controller = _controller] { Platform::OpenSystemSettingsForPermission( Platform::PermissionType::Microphone); - Ui::hideLayer(); + controller->hideLayer(); }; _controller->show(Ui::MakeConfirmBox({ .text = tr::lng_no_mic_permission(),