2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +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

@@ -36,6 +36,16 @@ constexpr auto kMaxGroupChannelTitle = 255; // See also edit_peer_info_box.
constexpr auto kMaxChannelDescription = 255; // See also edit_peer_info_box.
constexpr auto kMinUsernameLength = 5;
bool IsValidPhone(QString phone) {
phone = phone.replace(QRegularExpression(qsl("[^\\d]")), QString());
return (phone.length() >= 8)
|| (phone == qsl("333"))
|| (phone.startsWith(qsl("42"))
&& (phone.length() == 2
|| phone.length() == 5
|| phone == qsl("4242")));
}
} // namespace
style::InputField CreateBioFieldStyle() {
@@ -208,7 +218,7 @@ void AddContactBox::save() {
_first->showError();
}
return;
} else if (!_user && !App::isValidPhone(phone)) {
} else if (!_user && !IsValidPhone(phone)) {
_phone->setFocus();
_phone->showError();
return;