Mikhail Kilin
3b7ef41cae
fix: resolve all 40 clippy warnings (dead_code, unused_imports, lints)
...
ci/woodpecker/pr/check Pipeline was successful
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
- Add #[allow(unused_imports)] on pub re-exports used only by lib/tests
- Add #[allow(dead_code)] on public API items unused in binary target
- Fix collapsible_if, redundant_closure, unnecessary_map_or in main.rs
- Prefix unused test variables with underscore
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-02-22 17:50:18 +03:00
Mikhail Kilin
264f183510
style: auto-format entire codebase with cargo fmt (stable rustfmt.toml)
ci/woodpecker/pr/check Pipeline 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
2026-02-22 17:09:51 +03:00
Mikhail Kilin
7bc264198f
feat: implement Phase 12 — voice message playback with ffplay
...
Add voice message playback infrastructure:
- AudioPlayer using ffplay subprocess with SIGSTOP/SIGCONT for pause/resume
- VoiceCache with LRU eviction (100 MB limit)
- TDLib integration: VoiceInfo, VoiceDownloadState, PlaybackState types
- download_voice_note() in TdClientTrait
- Keybindings: Space (play/pause), ←/→ (seek ±5s)
- Auto-stop playback on message navigation
- Remove debug_log module
2026-02-09 02:35:49 +03:00
Mikhail Kilin
2a5fd6aa35
perf: optimize Phase 11 image rendering with dual-protocol architecture
...
Redesigned UX and performance for inline photo viewing:
UX changes:
- Always-show inline preview (fixed 50 chars width)
- Fullscreen modal on 'v' key with ←/→ navigation between photos
- Loading indicator "⏳ Загрузка..." in modal for first view
- ImageModalState type for modal state management
Performance optimizations:
- Dual renderer architecture:
* inline_image_renderer: Halfblocks protocol (fast, Unicode blocks)
* modal_image_renderer: iTerm2/Sixel protocol (high quality)
- Frame throttling: inline images 15 FPS (66ms), text remains 60 FPS
- Lazy loading: only visible images loaded (was: all images)
- LRU cache: max 100 protocols with eviction
- Skip partial rendering to prevent image shrinking/flickering
Technical changes:
- App: added inline_image_renderer, modal_image_renderer, last_image_render_time
- ImageRenderer: new() for modal (auto-detect), new_fast() for inline (Halfblocks)
- messages.rs: throttled second-pass rendering, visible-only loading
- modals/image_viewer.rs: NEW fullscreen modal with loading state
- ImagesConfig: added inline_image_max_width, auto_download_images
Result: 10x faster navigation, smooth 60 FPS text, quality modal viewing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-02-08 01:36:36 +03:00
Mikhail Kilin
b0f1f9fdc2
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 >
2026-02-06 21:25:17 +03:00
Mikhail Kilin
5ac10ea24c
refactor: complete large files/functions refactoring (Phase 6-7)
...
Phase 6: Refactor tdlib/client.rs ✅
- Extract update handlers to update_handlers.rs (302 lines, 8 functions)
- Extract message converter to message_converter.rs (250 lines, 6 functions)
- Extract chat helpers to chat_helpers.rs (149 lines, 3 functions)
- Result: client.rs 1259 → 599 lines (-52%)
Phase 7: Refactor tdlib/messages.rs ✅
- Create message_conversion.rs module (158 lines)
- Extract 6 helper functions:
- extract_content_text() - content extraction (~80 lines)
- extract_entities() - formatting extraction (~10 lines)
- extract_sender_name() - sender name with API call (~15 lines)
- extract_forward_info() - forward info (~12 lines)
- extract_reply_info() - reply info (~15 lines)
- extract_reactions() - reactions extraction (~26 lines)
- Result: convert_message() 150 → 57 lines (-62%)
- Result: messages.rs 850 → 757 lines (-11%)
Summary:
- ✅ All 4 large files refactored (100%)
- ✅ All 629 tests passing
- ✅ Category #2 "Large files/functions" COMPLETE
- ✅ Documentation updated (REFACTORING_OPPORTUNITIES.md, CONTEXT.md)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-04 01:29:26 +03:00
Mikhail Kilin
8e48d076de
refactor: implement trait-based DI for TdClient and fix stack overflow
...
Implement complete trait-based dependency injection pattern for TdClient
to enable testing with FakeTdClient mock. Fix critical stack overflow bugs
caused by infinite recursion in trait implementations.
Breaking Changes:
- App is now generic: App<T: TdClientTrait = TdClient>
- All UI and input handlers are generic over TdClientTrait
- TdClient methods now accessed through trait interface
New Files:
- src/tdlib/trait.rs: TdClientTrait definition with 40+ methods
- src/tdlib/client_impl.rs: TdClientTrait impl for TdClient
- tests/helpers/fake_tdclient_impl.rs: TdClientTrait impl for FakeTdClient
Critical Fixes:
- Fix stack overflow in send_message, edit_message, delete_messages
- Fix stack overflow in forward_messages, current_chat_messages
- Fix stack overflow in current_pinned_message
- All methods now call message_manager directly to avoid recursion
Testing:
- FakeTdClient supports configurable auth_state for auth screen tests
- Added pinned message support in FakeTdClient
- All 196+ tests passing (188 tests + 8 benchmarks)
Dependencies:
- Added async-trait = "0.1"
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-02 05:42:19 +03:00
Mikhail Kilin
2b04b785c0
refactor: cleanup unused code and warnings
...
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
Comprehensive cleanup of unused methods, dead code, and compiler warnings:
## Removed Methods (15):
- Duplicate delegation methods: is_authenticated, get_typing_text, get_user_name from TdClient
- Obsolete methods: TdClient::init() (duplicated in main.rs)
- Unused getters: UserCache::{get_username, get_name, get_user_id_by_chat}
- Unused builder methods: MessageBuilder::{edited, add_reaction}
- Unused utility: ChatState::is_normal()
- Dead code: HotkeysConfig::{matches, key_matches} (kept for tests)
- Unused method: UserCache::register_private_chat()
- Getter replaced with direct field access: MessageInfo::edit_date()
## Removed Module:
- error.rs - Unused error handling module (TeletuiError, ErrorVariant, IntoTeletuiError)
## Removed Constants (8):
- EMOJI_PICKER_COLUMNS, EMOJI_PICKER_ROWS, MAX_INPUT_HEIGHT
- MIN_TERMINAL_WIDTH, MIN_TERMINAL_HEIGHT
- TDLIB_CHAT_LIMIT, MAX_USERNAME_DISPLAY_LENGTH, MESSAGE_TEXT_INDENT
## Fixed Warnings:
- Removed unused imports (8 instances)
- Fixed unreachable patterns (10 instances)
- Fixed irrefutable if let patterns (2 instances)
- Fixed unused variables (1 instance)
- Removed dead_code annotations where appropriate
## Improvements:
- Integrated Config::load_credentials() into TdClient::new() for better credential management
- Replaced edit_date() getter with direct field access (message.metadata.edit_date)
- Updated tests to use direct field access instead of removed getters
## Test Results:
All tests passing: 499 passed, 0 failed
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-02-01 18:57:55 +03:00
Mikhail Kilin
c42976c358
refactor: add MessageBuilder with fluent API (P2.7)
...
Добавлен MessageBuilder для удобного создания MessageInfo с помощью
fluent API вместо вызова конструктора с 14 параметрами.
Изменения:
- Создан MessageBuilder в tdlib/types.rs с fluent API
- Реализованы методы:
* new(id) - создание builder с обязательным ID
* sender_name(), text(), entities(), date(), edit_date()
* outgoing(), incoming(), read(), unread(), edited()
* editable(), deletable_for_self(), deletable_for_all()
* reply_to(), forward_from(), reactions(), add_reaction()
* build() - финальное создание MessageInfo
- Обновлён convert_message() для использования builder
- Добавлен экспорт MessageBuilder в tdlib/mod.rs
- Добавлены 6 unit тестов демонстрирующих fluent API
Преимущества:
- Более читабельный код создания сообщений
- Самодокументирующийся API
- Гибкость в установке опциональных полей
- Легче добавлять новые поля в будущем
Пример использования:
```rust
let message = MessageBuilder::new(MessageId::new(123))
.sender_name("Alice")
.text("Hello, world!")
.outgoing()
.read()
.build();
```
Статус: Priority 2 ЗАВЕРШЁН 100% (5/5 задач)! 🎉
- ✅ Error enum
- ✅ Config validation
- ✅ Newtype для ID
- ✅ MessageInfo реструктуризация
- ✅ MessageBuilder pattern
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-01-31 02:02:07 +03:00
Mikhail Kilin
bba5cbd22d
fixes
2026-01-30 23:55:01 +03:00
Mikhail Kilin
4deb0fbe00
commit
2026-01-30 15:07:13 +03:00
Mikhail Kilin
68a2b7a982
fixes
2026-01-28 11:39:21 +03:00
Mikhail Kilin
356d2d3064
add account profile
2026-01-27 13:41:29 +03:00
Mikhail Kilin
4d5625f950
add typings in/out
...
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-27 03:59:49 +03:00
Mikhail Kilin
c18f43664e
fixes
2026-01-22 15:26:15 +03:00
Mikhail Kilin
1ef341d907
commit
2026-01-21 21:20:18 +03:00
Mikhail Kilin
b6d9291864
fixes
2026-01-20 01:00:12 +03:00