refactor: integrate validation utils and complete refactoring #1
Завершена интеграция validation utils во всех местах проверки user input: Changes: - src/utils/mod.rs: раскомментирован экспорт validation::* - src/input/auth.rs: 3 замены .is_empty() -> is_non_empty() * phone_input validation (line 18) * code_input validation (line 50) * password_input validation (line 82) - src/input/main_input.rs: 1 замена для message_input (line 484) - src/main.rs: заменён последний прямой timeout на with_timeout_ignore Documentation: - REFACTORING_OPPORTUNITIES.md: обновлён статус категории #1 * Отмечено как "ПОЛНОСТЬЮ ЗАВЕРШЕНО" (2026-02-02) * Добавлены метрики: 100% покрытие retry utils, 0 прямых timeouts * Обновлён план выполнения: фаза 1 завершена - CONTEXT.md: добавлен раздел об интеграции validation utils Result: ✅ Категория #1 (Дублирование кода) - ПОЛНОСТЬЮ ЗАВЕРШЕНА! - retry utils: 100% покрытие (8+ мест) - modal_handler: 2 диалога - validation: 4 места Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::app::App;
|
||||
use crate::tdlib::{AuthState, TdClientTrait};
|
||||
use crate::utils::with_timeout_msg;
|
||||
use crate::utils::{is_non_empty, with_timeout_msg};
|
||||
use crossterm::event::KeyCode;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -16,7 +16,7 @@ pub async fn handle<T: TdClientTrait>(app: &mut App<T>, key_code: KeyCode) {
|
||||
app.error_message = None;
|
||||
}
|
||||
KeyCode::Enter => {
|
||||
if !app.phone_input.is_empty() {
|
||||
if is_non_empty(&app.phone_input) {
|
||||
app.status_message = Some("Отправка номера...".to_string());
|
||||
match with_timeout_msg(
|
||||
Duration::from_secs(10),
|
||||
@@ -48,7 +48,7 @@ pub async fn handle<T: TdClientTrait>(app: &mut App<T>, key_code: KeyCode) {
|
||||
app.error_message = None;
|
||||
}
|
||||
KeyCode::Enter => {
|
||||
if !app.code_input.is_empty() {
|
||||
if is_non_empty(&app.code_input) {
|
||||
app.status_message = Some("Проверка кода...".to_string());
|
||||
match with_timeout_msg(
|
||||
Duration::from_secs(10),
|
||||
@@ -80,7 +80,7 @@ pub async fn handle<T: TdClientTrait>(app: &mut App<T>, key_code: KeyCode) {
|
||||
app.error_message = None;
|
||||
}
|
||||
KeyCode::Enter => {
|
||||
if !app.password_input.is_empty() {
|
||||
if is_non_empty(&app.password_input) {
|
||||
app.status_message = Some("Проверка пароля...".to_string());
|
||||
match with_timeout_msg(
|
||||
Duration::from_secs(10),
|
||||
|
||||
Reference in New Issue
Block a user