From c56c0e3232b4cd739c2f5ac264502a6cdaf8ded0 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 6 Mar 2022 08:11:35 +0300 Subject: [PATCH] Removed Ui::show from EditPeerTypeBox. --- .../boxes/peers/edit_peer_type_box.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp index 41140c2e4d..c25cb29844 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp @@ -31,7 +31,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mtproto/sender.h" #include "ui/rp_widget.h" #include "ui/special_buttons.h" -#include "ui/toast/toast.h" #include "ui/widgets/buttons.h" #include "ui/widgets/checkbox.h" #include "ui/widgets/input_fields.h" @@ -59,6 +58,7 @@ namespace { class Controller : public base::has_weak_ptr { public: Controller( + std::shared_ptr show, not_null container, not_null peer, bool useLocationPhrases, @@ -134,6 +134,8 @@ private: const QString &text, rpl::producer about); + std::shared_ptr _show; + not_null _peer; bool _linkOnly = false; @@ -157,13 +159,15 @@ private: }; Controller::Controller( + std::shared_ptr show, not_null container, not_null peer, bool useLocationPhrases, std::optional privacySavedValue, std::optional usernameSavedValue, std::optional noForwardsSavedValue) -: _peer(peer) +: _show(show) +, _peer(peer) , _linkOnly(!privacySavedValue.has_value()) , _api(&_peer->session().mtp()) , _privacySavedValue(privacySavedValue) @@ -198,9 +202,11 @@ void Controller::createContent() { _wrap.get(), tr::lng_group_invite_manage(), rpl::single(QString()), - [=] { Ui::show( - Box(ManageInviteLinksBox, _peer, _peer->session().user(), 0, 0), - Ui::LayerOption::KeepOther); + [=] { + const auto admin = _peer->session().user(); + _show->showBox( + Box(ManageInviteLinksBox, _peer, admin, 0, 0), + Ui::LayerOption::KeepOther); }, st::manageGroupButton, &st::infoIconInviteLinks)); @@ -499,7 +505,7 @@ void Controller::askUsernameRevoke() { _controls.privacy->setValue(Privacy::HasUsername); checkUsernameAvailability(); }); - Ui::show( + _show->showBox( Box( &_peer->session(), std::move(revokeCallback)), @@ -634,6 +640,7 @@ void EditPeerTypeBox::prepare() { const auto controller = Ui::CreateChild( this, + std::make_shared(this), content.data(), _peer, _useLocationPhrases,