Removed Ui::hideLayer from ChangePhoneBox::EnterCode.
This commit is contained in:
parent
b0617711ed
commit
e0eec138d5
|
@ -101,7 +101,7 @@ class ChangePhoneBox::EnterCode : public Ui::BoxContent {
|
||||||
public:
|
public:
|
||||||
EnterCode(
|
EnterCode(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
not_null<Main::Session*> session,
|
not_null<Window::SessionController*> controller,
|
||||||
const QString &phone,
|
const QString &phone,
|
||||||
const QString &hash,
|
const QString &hash,
|
||||||
int codeLength,
|
int codeLength,
|
||||||
|
@ -125,7 +125,7 @@ private:
|
||||||
}
|
}
|
||||||
int countHeight();
|
int countHeight();
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Window::SessionController*> _controller;
|
||||||
MTP::Sender _api;
|
MTP::Sender _api;
|
||||||
|
|
||||||
QString _phone;
|
QString _phone;
|
||||||
|
@ -247,7 +247,7 @@ void ChangePhoneBox::EnterPhone::sendPhoneDone(
|
||||||
}();
|
}();
|
||||||
_controller->show(
|
_controller->show(
|
||||||
Box<EnterCode>(
|
Box<EnterCode>(
|
||||||
&_controller->session(),
|
_controller,
|
||||||
phoneNumber,
|
phoneNumber,
|
||||||
phoneCodeHash,
|
phoneCodeHash,
|
||||||
codeLength,
|
codeLength,
|
||||||
|
@ -291,13 +291,13 @@ void ChangePhoneBox::EnterPhone::showError(const QString &text) {
|
||||||
|
|
||||||
ChangePhoneBox::EnterCode::EnterCode(
|
ChangePhoneBox::EnterCode::EnterCode(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
not_null<Main::Session*> session,
|
not_null<Window::SessionController*> controller,
|
||||||
const QString &phone,
|
const QString &phone,
|
||||||
const QString &hash,
|
const QString &hash,
|
||||||
int codeLength,
|
int codeLength,
|
||||||
int callTimeout)
|
int callTimeout)
|
||||||
: _session(session)
|
: _controller(controller)
|
||||||
, _api(&session->mtp())
|
, _api(&controller->session().mtp())
|
||||||
, _phone(phone)
|
, _phone(phone)
|
||||||
, _hash(hash)
|
, _hash(hash)
|
||||||
, _codeLength(codeLength)
|
, _codeLength(codeLength)
|
||||||
|
@ -355,20 +355,24 @@ void ChangePhoneBox::EnterCode::submit() {
|
||||||
}
|
}
|
||||||
hideError();
|
hideError();
|
||||||
|
|
||||||
const auto session = _session;
|
const auto session = &_controller->session();
|
||||||
const auto code = _code->getDigitsOnly();
|
const auto code = _code->getDigitsOnly();
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = Ui::MakeWeak(this);
|
||||||
_requestId = session->api().request(MTPaccount_ChangePhone(
|
_requestId = session->api().request(MTPaccount_ChangePhone(
|
||||||
MTP_string(_phone),
|
MTP_string(_phone),
|
||||||
MTP_string(_hash),
|
MTP_string(_hash),
|
||||||
MTP_string(code)
|
MTP_string(code)
|
||||||
)).done([=](const MTPUser &result) {
|
)).done([=, show = Window::Show(_controller)](const MTPUser &result) {
|
||||||
_requestId = 0;
|
_requestId = 0;
|
||||||
session->data().processUser(result);
|
session->data().processUser(result);
|
||||||
|
if (show.valid()) {
|
||||||
if (weak) {
|
if (weak) {
|
||||||
Ui::hideLayer();
|
show.hideLayer();
|
||||||
|
}
|
||||||
|
Ui::Toast::Show(
|
||||||
|
show.toastParent(),
|
||||||
|
tr::lng_change_phone_success(tr::now));
|
||||||
}
|
}
|
||||||
Ui::Toast::Show(tr::lng_change_phone_success(tr::now));
|
|
||||||
}).fail(crl::guard(this, [=](const MTP::Error &error) {
|
}).fail(crl::guard(this, [=](const MTP::Error &error) {
|
||||||
_requestId = 0;
|
_requestId = 0;
|
||||||
sendCodeFail(error);
|
sendCodeFail(error);
|
||||||
|
|
Loading…
Reference in New Issue