This commit is contained in:
Mikhail Kilin
2026-01-30 23:55:01 +03:00
parent 433233d766
commit bba5cbd22d
25 changed files with 5896 additions and 1469 deletions

View File

@@ -21,7 +21,7 @@ use tdlib_rs::enums::Update;
use app::{App, AppScreen};
use constants::{POLL_TIMEOUT_MS, SHUTDOWN_TIMEOUT_SECS};
use input::{handle_auth_input, handle_main_input};
use tdlib::client::AuthState;
use tdlib::AuthState;
use utils::disable_tdlib_logs;
#[tokio::main]
@@ -127,12 +127,12 @@ async fn run_app<B: ratatui::backend::Backend>(
}
// Обрабатываем очередь сообщений для отметки как прочитанных
if !app.td_client.pending_view_messages.is_empty() {
if !app.td_client.pending_view_messages().is_empty() {
app.td_client.process_pending_view_messages().await;
}
// Обрабатываем очередь user_id для загрузки имён
if !app.td_client.pending_user_ids.is_empty() {
if !app.td_client.pending_user_ids().is_empty() {
app.td_client.process_pending_user_ids().await;
}
@@ -199,7 +199,7 @@ async fn update_screen_state(app: &mut App) -> bool {
let prev_error = app.error_message.clone();
let prev_chats_len = app.chats.len();
match &app.td_client.auth_state {
match &app.td_client.auth_state() {
AuthState::WaitTdlibParameters => {
app.screen = AppScreen::Loading;
app.status_message = Some("Инициализация TDLib...".to_string());
@@ -219,8 +219,8 @@ async fn update_screen_state(app: &mut App) -> bool {
}
// Синхронизируем чаты из td_client в app
if !app.td_client.chats.is_empty() {
app.chats = app.td_client.chats.clone();
if !app.td_client.chats().is_empty() {
app.chats = app.td_client.chats().to_vec();
if app.chat_list_state.selected().is_none() && !app.chats.is_empty() {
app.chat_list_state.select(Some(0));
}