mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
intro rewrite started, new code sending methods
This commit is contained in:
@@ -28,9 +28,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "application.h"
|
||||
|
||||
#include "intro/introsignup.h"
|
||||
#include "intro/intro.h"
|
||||
|
||||
IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent)
|
||||
IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent)
|
||||
, a_errorAlpha(0)
|
||||
, a_photoOver(0)
|
||||
, _a_error(animation(this, &IntroSignup::step_error))
|
||||
@@ -38,6 +37,7 @@ IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent)
|
||||
, next(this, lang(lng_intro_finish), st::btnIntroNext)
|
||||
, first(this, st::inpIntroName, lang(lng_signup_firstname))
|
||||
, last(this, st::inpIntroName, lang(lng_signup_lastname))
|
||||
, sentRequest(0)
|
||||
, _invertOrder(langFirstNameGoesSecond()) {
|
||||
setVisible(false);
|
||||
setGeometry(parent->innerRect());
|
||||
@@ -180,7 +180,7 @@ void IntroSignup::step_error(float64 ms, bool timer) {
|
||||
_a_error.stop();
|
||||
a_errorAlpha.finish();
|
||||
if (!a_errorAlpha.current()) {
|
||||
error = "";
|
||||
error.clear();
|
||||
}
|
||||
} else {
|
||||
a_errorAlpha.update(dt, st::introErrFunc);
|
||||
@@ -201,7 +201,7 @@ void IntroSignup::step_photo(float64 ms, bool timer) {
|
||||
}
|
||||
|
||||
void IntroSignup::activate() {
|
||||
show();
|
||||
IntroStep::activate();
|
||||
if (_invertOrder) {
|
||||
last.setFocus();
|
||||
} else {
|
||||
@@ -209,8 +209,11 @@ void IntroSignup::activate() {
|
||||
}
|
||||
}
|
||||
|
||||
void IntroSignup::deactivate() {
|
||||
hide();
|
||||
void IntroSignup::cancelled() {
|
||||
if (sentRequest) {
|
||||
MTP::cancel(sentRequest);
|
||||
sentRequest = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void IntroSignup::stopCheck() {
|
||||
@@ -264,7 +267,7 @@ bool IntroSignup::nameSubmitFail(const RPCError &error) {
|
||||
last.setDisabled(false);
|
||||
const QString &err = error.type();
|
||||
if (err == "PHONE_NUMBER_INVALID" || err == "PHONE_CODE_EXPIRED" || err == "PHONE_CODE_EMPTY" || err == "PHONE_CODE_INVALID" || err == "PHONE_NUMBER_OCCUPIED") {
|
||||
intro()->onIntroBack();
|
||||
intro()->onBack();
|
||||
return true;
|
||||
} else if (err == "FIRSTNAME_INVALID") {
|
||||
showError(lang(lng_bad_name));
|
||||
@@ -297,7 +300,7 @@ bool IntroSignup::nameSubmitFail(const RPCError &error) {
|
||||
}
|
||||
|
||||
void IntroSignup::onInputChange() {
|
||||
showError("");
|
||||
showError(QString());
|
||||
}
|
||||
|
||||
void IntroSignup::onSubmitName(bool force) {
|
||||
@@ -324,16 +327,13 @@ void IntroSignup::onSubmitName(bool force) {
|
||||
last.setDisabled(true);
|
||||
setFocus();
|
||||
|
||||
showError("");
|
||||
showError(QString());
|
||||
|
||||
firstName = first.text().trimmed();
|
||||
lastName = last.text().trimmed();
|
||||
sentRequest = MTP::send(MTPauth_SignUp(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash()), MTP_string(intro()->getCode()), MTP_string(firstName), MTP_string(lastName)), rpcDone(&IntroSignup::nameSubmitDone), rpcFail(&IntroSignup::nameSubmitFail));
|
||||
}
|
||||
|
||||
void IntroSignup::onNext() {
|
||||
void IntroSignup::onSubmit() {
|
||||
onSubmitName();
|
||||
}
|
||||
|
||||
void IntroSignup::onBack() {
|
||||
}
|
||||
|
Reference in New Issue
Block a user