Removed Ui::show from EditPeerTypeBox.

This commit is contained in:
23rd 2022-03-06 08:11:35 +03:00
parent a2e57de3a3
commit c56c0e3232
1 changed files with 13 additions and 6 deletions

View File

@ -31,7 +31,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mtproto/sender.h" #include "mtproto/sender.h"
#include "ui/rp_widget.h" #include "ui/rp_widget.h"
#include "ui/special_buttons.h" #include "ui/special_buttons.h"
#include "ui/toast/toast.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/checkbox.h" #include "ui/widgets/checkbox.h"
#include "ui/widgets/input_fields.h" #include "ui/widgets/input_fields.h"
@ -59,6 +58,7 @@ namespace {
class Controller : public base::has_weak_ptr { class Controller : public base::has_weak_ptr {
public: public:
Controller( Controller(
std::shared_ptr<Ui::BoxShow> show,
not_null<Ui::VerticalLayout*> container, not_null<Ui::VerticalLayout*> container,
not_null<PeerData*> peer, not_null<PeerData*> peer,
bool useLocationPhrases, bool useLocationPhrases,
@ -134,6 +134,8 @@ private:
const QString &text, const QString &text,
rpl::producer<QString> about); rpl::producer<QString> about);
std::shared_ptr<Ui::BoxShow> _show;
not_null<PeerData*> _peer; not_null<PeerData*> _peer;
bool _linkOnly = false; bool _linkOnly = false;
@ -157,13 +159,15 @@ private:
}; };
Controller::Controller( Controller::Controller(
std::shared_ptr<Ui::BoxShow> show,
not_null<Ui::VerticalLayout*> container, not_null<Ui::VerticalLayout*> container,
not_null<PeerData*> peer, not_null<PeerData*> peer,
bool useLocationPhrases, bool useLocationPhrases,
std::optional<Privacy> privacySavedValue, std::optional<Privacy> privacySavedValue,
std::optional<QString> usernameSavedValue, std::optional<QString> usernameSavedValue,
std::optional<bool> noForwardsSavedValue) std::optional<bool> noForwardsSavedValue)
: _peer(peer) : _show(show)
, _peer(peer)
, _linkOnly(!privacySavedValue.has_value()) , _linkOnly(!privacySavedValue.has_value())
, _api(&_peer->session().mtp()) , _api(&_peer->session().mtp())
, _privacySavedValue(privacySavedValue) , _privacySavedValue(privacySavedValue)
@ -198,9 +202,11 @@ void Controller::createContent() {
_wrap.get(), _wrap.get(),
tr::lng_group_invite_manage(), tr::lng_group_invite_manage(),
rpl::single(QString()), rpl::single(QString()),
[=] { Ui::show( [=] {
Box(ManageInviteLinksBox, _peer, _peer->session().user(), 0, 0), const auto admin = _peer->session().user();
Ui::LayerOption::KeepOther); _show->showBox(
Box(ManageInviteLinksBox, _peer, admin, 0, 0),
Ui::LayerOption::KeepOther);
}, },
st::manageGroupButton, st::manageGroupButton,
&st::infoIconInviteLinks)); &st::infoIconInviteLinks));
@ -499,7 +505,7 @@ void Controller::askUsernameRevoke() {
_controls.privacy->setValue(Privacy::HasUsername); _controls.privacy->setValue(Privacy::HasUsername);
checkUsernameAvailability(); checkUsernameAvailability();
}); });
Ui::show( _show->showBox(
Box<RevokePublicLinkBox>( Box<RevokePublicLinkBox>(
&_peer->session(), &_peer->session(),
std::move(revokeCallback)), std::move(revokeCallback)),
@ -634,6 +640,7 @@ void EditPeerTypeBox::prepare() {
const auto controller = Ui::CreateChild<Controller>( const auto controller = Ui::CreateChild<Controller>(
this, this,
std::make_shared<Ui::BoxShow>(this),
content.data(), content.data(),
_peer, _peer,
_useLocationPhrases, _useLocationPhrases,