2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Add autoupdating for templates (support).

This commit is contained in:
John Preston
2018-10-05 11:14:00 +03:00
parent ccaec28d0b
commit 1411dfb711
8 changed files with 425 additions and 70 deletions

View File

@@ -49,6 +49,13 @@ Locale: ") + Platform::SystemLanguage();
UrlClickHandler::Open(url);
}
bool AllowPhoneAttempt(const QString &phone) {
const auto digits = ranges::count_if(
phone,
[](QChar ch) { return ch.isNumber(); });
return (digits > 1);
}
} // namespace
PhoneWidget::PhoneWidget(QWidget *parent, Widget::Data *data) : Step(parent, data)
@@ -138,7 +145,8 @@ void PhoneWidget::onInputChange() {
void PhoneWidget::submit() {
if (_sentRequest || isHidden()) return;
if (!App::isValidPhone(fullNumber())) {
const auto phone = fullNumber();
if (!AllowPhoneAttempt(phone)) {
showPhoneError(langFactory(lng_bad_phone));
_phone->setFocus();
return;
@@ -148,7 +156,7 @@ void PhoneWidget::submit() {
_checkRequest->start(1000);
_sentPhone = fullNumber();
_sentPhone = phone;
Messenger::Instance().mtp()->setUserPhone(_sentPhone);
//_sentRequest = MTP::send(MTPauth_CheckPhone(MTP_string(_sentPhone)), rpcDone(&PhoneWidget::phoneCheckDone), rpcFail(&PhoneWidget::phoneSubmitFail));
_sentRequest = MTP::send(