Slightly improved input of phone code in PhoneWidget.

This commit is contained in:
23rd 2023-02-02 22:49:11 +03:00
parent e0cba40410
commit 1d21c2ca8f
3 changed files with 14 additions and 9 deletions

View file

@ -146,6 +146,16 @@ void PhoneWidget::submit() {
return;
}
{
const auto hasCodeButWaitingPhone = _code->hasFocus()
&& (_code->getLastText().size() > 1)
&& _phone->getLastText().isEmpty();
if (hasCodeButWaitingPhone) {
_phone->hideError();
_phone->setFocus();
return;
}
}
const auto phone = fullNumber();
if (!AllowPhoneAttempt(phone)) {
showPhoneError(tr::lng_bad_phone());

View file

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_intro.h"
#include "styles/style_widgets.h"
CountryInput::CountryInput(
QWidget *parent,

View file

@ -8,11 +8,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once
#include "ui/rp_widget.h"
#include "styles/style_widgets.h"
namespace Data {
struct Info;
} // namespace Data
namespace style {
struct InputField;
} // namespace style
namespace Countries {
struct Info;
@ -22,11 +21,6 @@ namespace Window {
class Show;
} // namespace Window
namespace Ui {
class MultiSelect;
class RippleAnimation;
} // namespace Ui
class CountryInput : public Ui::RpWidget {
public: