feat: implement Phase 11 — inline photo viewing with ratatui-image
Add feature-gated (`images`) inline photo support: - New types: MediaInfo, PhotoInfo, PhotoDownloadState, ImagesConfig - Media module: ImageCache (LRU filesystem cache), ImageRenderer (terminal protocol detection) - Photo metadata extraction from TDLib MessagePhoto with download_file() API - ViewImage command (v/м) to toggle photo expand/collapse in message selection - Two-pass UI rendering: placeholder lines in message bubbles + StatefulImage overlay - Collapse all expanded photos on Esc (exit selection mode) Dependencies: ratatui-image 8.1, image 0.25 (optional, behind `images` feature flag) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -362,6 +362,22 @@ impl TdClient {
|
||||
.await
|
||||
}
|
||||
|
||||
// Делегирование файловых операций
|
||||
|
||||
/// Скачивает файл по file_id и возвращает локальный путь.
|
||||
pub async fn download_file(&self, file_id: i32) -> Result<String, String> {
|
||||
match functions::download_file(file_id, 1, 0, 0, true, self.client_id).await {
|
||||
Ok(tdlib_rs::enums::File::File(file)) => {
|
||||
if file.local.is_downloading_completed && !file.local.path.is_empty() {
|
||||
Ok(file.local.path)
|
||||
} else {
|
||||
Err("Файл не скачан".to_string())
|
||||
}
|
||||
}
|
||||
Err(e) => Err(format!("Ошибка скачивания файла: {:?}", e)),
|
||||
}
|
||||
}
|
||||
|
||||
// Вспомогательные методы
|
||||
pub fn client_id(&self) -> i32 {
|
||||
self.client_id
|
||||
|
||||
Reference in New Issue
Block a user