Some checks failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled
Извлечены state модули и сервисы из монолитных файлов для улучшения структуры: State модули: - auth_state.rs: состояние авторизации - chat_list_state.rs: состояние списка чатов - compose_state.rs: состояние ввода сообщений - message_view_state.rs: состояние просмотра сообщений - ui_state.rs: UI состояние Сервисы и утилиты: - chat_filter.rs: централизованная фильтрация чатов (470+ строк) - message_service.rs: сервис работы с сообщениями (17KB) - key_handler.rs: trait для обработки клавиш (380+ строк) Config модуль: - config.rs -> config/mod.rs: основной конфиг - config/keybindings.rs: настраиваемые горячие клавиши (420+ строк) Тесты: 626 passed ✅ Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
88 lines
2.0 KiB
Rust
88 lines
2.0 KiB
Rust
/// Состояние аутентификации
|
|
///
|
|
/// Отвечает за данные авторизации:
|
|
/// - Ввод номера телефона
|
|
/// - Ввод кода подтверждения
|
|
/// - Ввод пароля (2FA)
|
|
|
|
/// Состояние аутентификации
|
|
#[derive(Debug, Clone, Default)]
|
|
pub struct AuthState {
|
|
/// Введённый номер телефона
|
|
phone_input: String,
|
|
|
|
/// Введённый код подтверждения
|
|
code_input: String,
|
|
|
|
/// Введённый пароль (для 2FA)
|
|
password_input: String,
|
|
}
|
|
|
|
impl AuthState {
|
|
/// Создать новое состояние аутентификации
|
|
pub fn new() -> Self {
|
|
Self::default()
|
|
}
|
|
|
|
// === Phone input ===
|
|
|
|
pub fn phone_input(&self) -> &str {
|
|
&self.phone_input
|
|
}
|
|
|
|
pub fn phone_input_mut(&mut self) -> &mut String {
|
|
&mut self.phone_input
|
|
}
|
|
|
|
pub fn set_phone_input(&mut self, input: String) {
|
|
self.phone_input = input;
|
|
}
|
|
|
|
pub fn clear_phone_input(&mut self) {
|
|
self.phone_input.clear();
|
|
}
|
|
|
|
// === Code input ===
|
|
|
|
pub fn code_input(&self) -> &str {
|
|
&self.code_input
|
|
}
|
|
|
|
pub fn code_input_mut(&mut self) -> &mut String {
|
|
&mut self.code_input
|
|
}
|
|
|
|
pub fn set_code_input(&mut self, input: String) {
|
|
self.code_input = input;
|
|
}
|
|
|
|
pub fn clear_code_input(&mut self) {
|
|
self.code_input.clear();
|
|
}
|
|
|
|
// === Password input ===
|
|
|
|
pub fn password_input(&self) -> &str {
|
|
&self.password_input
|
|
}
|
|
|
|
pub fn password_input_mut(&mut self) -> &mut String {
|
|
&mut self.password_input
|
|
}
|
|
|
|
pub fn set_password_input(&mut self, input: String) {
|
|
self.password_input = input;
|
|
}
|
|
|
|
pub fn clear_password_input(&mut self) {
|
|
self.password_input.clear();
|
|
}
|
|
|
|
/// Очистить все поля ввода
|
|
pub fn clear_all(&mut self) {
|
|
self.phone_input.clear();
|
|
self.code_input.clear();
|
|
self.password_input.clear();
|
|
}
|
|
}
|