Mikhail Kilin
|
ffd52d2384
|
refactor: complete Phase 13 deep architecture refactoring (etaps 3-7)
Split monolithic files into modular architecture:
- ui/messages.rs (893→365 lines): extract modals/, compose_bar.rs
- tdlib/messages.rs (836→3 files): split into messages/mod, convert, operations
- config/mod.rs (642→3 files): extract validation.rs, loader.rs
- Code duplication cleanup: shared components, ~220 lines removed
- Documentation: PROJECT_STRUCTURE.md rewrite, 16 files got //! docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-02-06 15:28:11 +03:00 |
|
Mikhail Kilin
|
931954d829
|
refactor: split app/mod.rs into trait-based architecture (1015→371 lines)
Split monolithic App impl into 5 specialized trait modules:
- methods/navigation.rs (NavigationMethods) - 7 methods for chat navigation
- methods/messages.rs (MessageMethods) - 8 methods for message operations
- methods/compose.rs (ComposeMethods) - 10 methods for reply/forward/draft
- methods/search.rs (SearchMethods) - 15 methods for search functionality
- methods/modal.rs (ModalMethods) - 27 methods for modal dialogs
Changes:
- app/mod.rs: 1015→371 lines (removed 644 lines, -63%)
- Created app/methods/ with 5 trait impl blocks
- Left in app/mod.rs: constructors, get_command, get_selected_chat_id/chat, getters/setters
- 116 functions → 5 trait impl blocks (67 in traits + 48 in core)
- Single Responsibility Principle achieved
- Updated CONTEXT.md with refactoring metrics
- Updated ROADMAP.md: Phase 13 Etap 2 marked as DONE
Phase 13 Etap 2: COMPLETED (100%)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-06 00:59:14 +03:00 |
|
Mikhail Kilin
|
1d0bfb53e0
|
refactor: split main_input.rs into modular handlers (1199→164 lines)
Split monolithic input handler into 5 specialized modules:
- handlers/chat.rs (452 lines) - chat keyboard input
- handlers/modal.rs (316 lines) - modal dialogs
- handlers/chat_list.rs (142 lines) - chat list navigation
- handlers/search.rs (140 lines) - search functionality
- handlers/compose.rs (80 lines) - forward/reply/edit modes
Changes:
- main_input.rs: 1199→164 lines (removed 1035 lines, -86%)
- Preserved existing handlers: clipboard, global, profile
- Created clean router pattern in main_input.rs
- Fixed keybinding conflict: Ctrl+I→Ctrl+U for profile
- Fixed modifier handling in chat input (ignore Ctrl/Alt chars)
- Updated CONTEXT.md with refactoring metrics
- Updated ROADMAP.md: Phase 13 Etap 1 marked as DONE
Phase 13 Etap 1: COMPLETED (100%)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-06 00:43:52 +03:00 |
|
Mikhail Kilin
|
bccf07501f
|
docs: add Phase 13 - deep architecture refactoring plan
Added comprehensive plan for refactoring oversized files and God Objects
in the codebase. Current critical issues:
Critical Problems:
- input/main_input.rs: 1199 lines (largest file!)
- app/mod.rs: 1015 lines, 116 functions (God Object)
- ui/messages.rs: 893 lines
- tdlib/messages.rs: 833 lines
- config/mod.rs: 642 lines
Phase 13 Plan (7 stages):
Stage 1: Split input/main_input.rs (1199 → <200 lines)
- Create input/handlers/ directory
- handlers/chat.rs - open chat input handling (~300-400 lines)
- handlers/chat_list.rs - chat list input (~200-300 lines)
- handlers/compose.rs - edit/reply/forward modes (~200 lines)
- handlers/modal.rs - delete confirm, emoji picker (~150 lines)
- handlers/search.rs - search modes (~100 lines)
- main_input.rs becomes router only (<200 lines)
Stage 2: Reduce app/mod.rs (116 functions → traits)
- Create app/methods/ directory with traits:
- NavigationMethods (~15 methods)
- MessageMethods (~20 methods)
- ComposeMethods (~15 methods)
- SearchMethods (~5 methods)
- ModalMethods (~10 methods)
- Keep only core in mod.rs (~30-40 methods)
Stage 3: Split ui/messages.rs (893 → <300 lines)
- Create ui/modals/ directory:
- modals/delete_confirm.rs (~50 lines)
- modals/emoji_picker.rs (~100 lines)
- modals/search_modal.rs (~80 lines)
- modals/profile_modal.rs (~100 lines)
- Create ui/compose_bar.rs (~150 lines)
- messages.rs keeps main layout (~300 lines)
Stage 4: Split tdlib/messages.rs (833 → 2 files)
- Create tdlib/messages/ directory:
- messages/convert.rs - TDLib conversion (~500 lines)
- messages/operations.rs - operations (~300 lines)
Stage 5: Split config/mod.rs (642 → 3 files)
- config/defaults.rs - all default_* functions (~100 lines)
- config/validation.rs - validation logic (~150 lines)
- config/loader.rs - file loading (~100 lines)
- mod.rs - struct definitions (~200-300 lines)
Stage 6: Code Duplication Cleanup
- Extract common handler logic
- Extract common UI components
- Apply DRY principle
Stage 7: Documentation Update
- Update CONTEXT.md with new structure
- Update PROJECT_STRUCTURE.md
- Add module-level documentation
- Create architecture diagram
Success Metrics:
Before: 4582 lines in 5 files
After: Same lines in ~20+ files
Benefits: Better readability, testability, maintainability, SRP compliance
Status: PLANNED (comprehensive refactoring plan documented)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-05 11:30:29 +03:00 |
|
Mikhail Kilin
|
776271ff36
|
docs: add Phase 12 - voice message playback
Documented new feature for playing voice messages directly from TUI
with full playback controls and visual feedback.
Documentation Changes:
- ROADMAP.md: Added Phase 12 with 7 stages
- Stage 1: Audio infrastructure (audio module, AudioPlayer, VoiceCache)
- Stage 2: TDLib integration (VoiceNoteInfo, download_voice_note)
- Stage 3: UI for playback (progress bar, status indicators, footer)
- Stage 4: Hotkeys (play/pause, stop, seek, volume control)
- Stage 5: Configuration and UX (AudioConfig, ticker updates)
- Stage 6: Error handling and fallback (system player)
- Stage 7: Additional improvements (prefetching, animations)
- CONTEXT.md: Added PLANNED section for Phase 12
- Technical stack: rodio 0.17, TDLib downloadFile
- Platforms: Linux (ALSA/PulseAudio), macOS (CoreAudio), Windows (WASAPI)
- Architecture: src/audio/ module with 3 submodules
- LRU cache (100 MB limit)
- Async loading, ticker for progress updates
- Configuration options in config.toml
- Fallback to system players (mpv, ffplay)
- HOTKEYS.md: Added new hotkeys
- `Space` - play/pause (in voice message selection mode)
- `s` / `ы` - stop playback
- `←` / `→` - seek -5s/+5s (during playback)
- `↑` / `↓` - volume +/-10% (during playback)
- Added new "Voice Playback" section
- Added new "Voice Playback Mode" section
- PROJECT_STRUCTURE.md: Added audio/ module documentation
- player.rs - AudioPlayer with rodio
- cache.rs - VoiceCache for downloaded OGG files
- state.rs - PlaybackState (status, position, duration, volume)
- Updated dependencies section (rodio 0.17)
- Updated App state with audio fields
Technical Details:
- rodio 0.17 Pure Rust audio library (cross-platform)
- OGG Opus support (Telegram voice message format)
- Visual progress bar: ▶ ████████░░░░░░ 0:08 / 0:15
- Status indicators: ▶ (playing), ⏸ (paused), ⏹ (stopped), ⏳ (loading)
- Smart caching with size limits
- Async non-blocking file download
- Ticker for smooth progress updates (100ms)
- Graceful fallback to system players
New Configuration (config.toml):
- enabled: bool - enable/disable audio playback
- default_volume: f32 - volume (0.0 - 1.0)
- seek_step_seconds: i32 - seek step in seconds (default 5)
- autoplay: bool - autoplay on selection
- cache_size_mb: usize - cache size limit in MB
- show_waveform: bool - show waveform visualization
- system_player_fallback: bool - use system player fallback
- system_player: String - system player command (mpv, ffplay)
Status: PLANNED (documentation complete, implementation pending)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-05 02:51:04 +03:00 |
|
Mikhail Kilin
|
8844c2953d
|
docs: add Phase 11 - image display in chat
Documented new feature for displaying images directly in terminal
instead of text placeholders like "[Фото]".
Documentation Changes:
- ROADMAP.md: Added Phase 11 with 6 stages
- Stage 1: Infrastructure (media module, ImageCache, dependencies)
- Stage 2: TDLib integration (PhotoInfo, download_photo)
- Stage 3: UI rendering (inline previews, scaling)
- Stage 4: Fullscreen viewer (new ViewImage mode)
- Stage 5: Configuration and UX (MediaConfig in config.toml)
- Stage 6: Error handling and fallback
- CONTEXT.md: Added PLANNED section for Phase 11
- Technical stack: ratatui-image 1.0, TDLib downloadFile
- Protocols: Sixel, Kitty Graphics, iTerm2, Unicode Halfblocks
- Architecture: src/media/ module with 3 submodules
- LRU cache (100 MB limit)
- Async loading, lazy loading for visible images
- Configuration options in config.toml
- HOTKEYS.md: Added new hotkeys
- `v` / `м` - open image in fullscreen (in selection mode)
- `←` / `→` - navigate between images (in viewer mode)
- `Esc` - close image viewer
- Added new "View Image Mode" section
- PROJECT_STRUCTURE.md: Added media/ module documentation
- image_cache.rs - LRU cache for downloaded images
- image_loader.rs - Async loading via TDLib
- image_renderer.rs - Rendering with protocol detection
- Updated dependencies section
- Updated App state with new fields
Technical Details:
- Terminal protocol auto-detection (Sixel/Kitty/iTerm2/Halfblocks)
- Cross-platform support (Linux, macOS, Windows)
- Graceful fallback to Unicode halfblocks for all terminals
- Async non-blocking image loading
- Smart caching with size limits
- Configurable quality and protocol settings
New Configuration (config.toml):
- show_images: bool - enable/disable image display
- image_cache_mb: usize - cache size limit in MB
- preview_quality: "low" | "medium" | "high"
- render_protocol: "auto" | "sixel" | "kitty" | "iterm2" | "halfblocks"
Status: PLANNED (documentation complete, implementation pending)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-05 02:43:04 +03:00 |
|
Mikhail Kilin
|
bea0bcbed0
|
feat: implement desktop notifications with comprehensive filtering
Implemented Phase 10 (Desktop Notifications) with three stages:
notify-rust integration, smart filtering, and production polish.
Stage 1 - Base Implementation:
- Add NotificationManager module (src/notifications.rs, 350+ lines)
- Integrate notify-rust 4.11 with feature flag "notifications"
- Implement NotificationsConfig in config.toml (enabled, only_mentions, show_preview)
- Add notification_manager field to TdClient
- Create configure_notifications() method for config integration
- Hook into handle_new_message_update() to send notifications
- Send notifications for messages outside current chat
- Format notification body with sender name and message preview
Stage 2 - Smart Filtering:
- Sync muted chats from Telegram (sync_muted_chats method)
- Filter muted chats from notifications automatically
- Add MessageInfo::has_mention() to detect @username mentions
- Implement only_mentions filter (notify only when mentioned)
- Beautify media labels with emojis (📷 📹 🎤 🎨 📎 etc.)
- Support 10+ media types in notification preview
Stage 3 - Production Polish:
- Add graceful error handling (no panics on notification failure)
- Implement comprehensive logging (tracing::debug!/warn!)
- Add timeout_ms configuration (0 = system default)
- Add urgency configuration (low/normal/critical, Linux only)
- Platform-specific #[cfg] for urgency support
- Log all notification skip reasons at debug level
Hotkey Change:
- Move profile view from 'i' to Ctrl+i to avoid conflicts
Technical Details:
- Cross-platform support (macOS, Linux, Windows)
- Feature flag for optional notifications support
- Graceful fallback when notifications unavailable
- LRU-friendly muted chats sync
- Test coverage for all core notification logic
- All 75 tests passing
Files Changed:
- NEW: src/notifications.rs - Complete NotificationManager
- NEW: config.example.toml - Example configuration with notifications
- Modified: Cargo.toml - Add notify-rust 4.11 dependency
- Modified: src/config/mod.rs - Add NotificationsConfig struct
- Modified: src/tdlib/types.rs - Add has_mention() method
- Modified: src/tdlib/client.rs - Add notification integration
- Modified: src/tdlib/update_handlers.rs - Hook notifications
- Modified: src/config/keybindings.rs - Change profile to Ctrl+i
- Modified: tests/* - Add notification config to tests
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-05 01:27:44 +03:00 |
|
Mikhail Kilin
|
051c4a0265
|
fixes
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-01-28 01:29:03 +03:00 |
|
Mikhail Kilin
|
f291191577
|
fixes
|
2026-01-27 23:29:00 +03:00 |
|
Mikhail Kilin
|
46720b3584
|
fixes
|
2026-01-25 21:21:07 +03:00 |
|
Mikhail Kilin
|
fa749d24c5
|
fixes
|
2026-01-24 18:53:35 +03:00 |
|
Mikhail Kilin
|
22c4e17377
|
fixes
|
2026-01-24 02:22:47 +03:00 |
|
Mikhail Kilin
|
c18f43664e
|
fixes
|
2026-01-22 15:26:15 +03:00 |
|
Mikhail Kilin
|
9912ac11bd
|
fixes
|
2026-01-20 14:54:30 +03:00 |
|
Mikhail Kilin
|
699f50a59c
|
fixes
|
2026-01-20 13:37:02 +03:00 |
|
Mikhail Kilin
|
b6d9291864
|
fixes
|
2026-01-20 01:00:12 +03:00 |
|