mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-06 01:25:18 +00:00
Added ability to sing up and sing in with anonymous numbers.
This commit is contained in:
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "intro/intro_signup.h"
|
||||
#include "intro/intro_password_check.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "core/update_checker.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
@@ -19,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "main/main_account.h"
|
||||
#include "mtproto/mtp_instance.h"
|
||||
#include "styles/style_intro.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace Intro {
|
||||
namespace details {
|
||||
@@ -99,7 +101,9 @@ CodeWidget::CodeWidget(
|
||||
|
||||
_code->setDigitsCountMax(getData()->codeLength);
|
||||
|
||||
setTitleText(rpl::single(Ui::FormatPhone(getData()->phone)));
|
||||
setTitleText(getData()->codeByFragmentUrl.isEmpty()
|
||||
? rpl::single(Ui::FormatPhone(getData()->phone))
|
||||
: tr::lng_intro_fragment_title());
|
||||
updateDescText();
|
||||
}
|
||||
|
||||
@@ -117,10 +121,19 @@ int CodeWidget::errorTop() const {
|
||||
|
||||
void CodeWidget::updateDescText() {
|
||||
const auto byTelegram = getData()->codeByTelegram;
|
||||
const auto isFragment = !getData()->codeByFragmentUrl.isEmpty();
|
||||
setDescriptionText(
|
||||
(byTelegram ? tr::lng_code_from_telegram : tr::lng_code_desc)(
|
||||
Ui::Text::RichLangValue));
|
||||
if (getData()->codeByTelegram) {
|
||||
isFragment
|
||||
? tr::lng_intro_fragment_about(
|
||||
lt_phone_number,
|
||||
rpl::single(TextWithEntities{
|
||||
.text = Ui::FormatPhone(getData()->phone)
|
||||
}),
|
||||
Ui::Text::RichLangValue)
|
||||
: (byTelegram ? tr::lng_code_from_telegram : tr::lng_code_desc)(
|
||||
Ui::Text::RichLangValue));
|
||||
if (isFragment) {
|
||||
} else if (getData()->codeByTelegram) {
|
||||
_noTelegramCode->show();
|
||||
_callTimer.cancel();
|
||||
} else {
|
||||
@@ -300,7 +313,7 @@ void CodeWidget::codeSubmitFail(const MTP::Error &error) {
|
||||
|
||||
void CodeWidget::codeChanged() {
|
||||
hideError();
|
||||
submit();
|
||||
submitCode();
|
||||
}
|
||||
|
||||
void CodeWidget::sendCall() {
|
||||
@@ -362,6 +375,14 @@ void CodeWidget::gotPassword(const MTPaccount_Password &result) {
|
||||
}
|
||||
|
||||
void CodeWidget::submit() {
|
||||
if (getData()->codeByFragmentUrl.isEmpty()) {
|
||||
submitCode();
|
||||
} else {
|
||||
File::OpenUrl(getData()->codeByFragmentUrl);
|
||||
}
|
||||
}
|
||||
|
||||
void CodeWidget::submitCode() {
|
||||
const auto text = QString(
|
||||
_code->getLastText()
|
||||
).remove(
|
||||
@@ -393,6 +414,18 @@ void CodeWidget::submit() {
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
||||
rpl::producer<QString> CodeWidget::nextButtonText() const {
|
||||
return getData()->codeByFragmentUrl.isEmpty()
|
||||
? Step::nextButtonText()
|
||||
: tr::lng_intro_fragment_button();
|
||||
}
|
||||
|
||||
const style::RoundButton *CodeWidget::nextButtonStyle() const {
|
||||
return !getData()->codeByFragmentUrl.isEmpty()
|
||||
? &st::fragmentBoxButton
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
void CodeWidget::noTelegramCode() {
|
||||
if (_noTelegramCodeRequestId) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user