Mikhail Kilin
|
7b2dd6c9a9
|
refactor: encapsulate auth fields (Group 1/5)
Фаза 1, Подход 2 - постепенная инкапсуляция полей App.
Changes:
- src/app/mod.rs: сделаны приватными phone_input, code_input, password_input
- src/input/auth.rs: замены на phone_input_mut(), code_input_mut(), password_input_mut()
- src/ui/auth.rs: замены на phone_input(), code_input(), password_input()
- tests/helpers/app_builder.rs: замены на set_phone_input(), set_code_input(), set_password_input()
Используются существующие геттеры/сеттеры (были добавлены ранее).
Progress: Group 1/5 complete (auth fields)
Next: Group 2 (UI state: screen, is_loading, needs_redraw, is_searching)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-02 17:56:34 +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
|
644e36597d
|
fixes
|
2026-01-31 03:48:50 +03:00 |
|
Mikhail Kilin
|
7081a886ad
|
refactor: implement newtype pattern for IDs (P2.4)
Добавлены типобезопасные обёртки ChatId, MessageId, UserId для предотвращения
смешивания разных типов идентификаторов на этапе компиляции.
Изменения:
- Создан src/types.rs с тремя newtype структурами
- Реализованы методы: new(), as_i64(), From<i64>, Display
- Добавлены traits: Hash, Eq, Serialize, Deserialize
- Обновлены 15+ модулей для использования новых типов:
* tdlib: types.rs, chats.rs, messages.rs, users.rs, reactions.rs, client.rs
* app: mod.rs, chat_state.rs
* input: main_input.rs
* tests: app_builder.rs, test_data.rs
- Исправлены 53 ошибки компиляции связанные с type conversions
Преимущества:
- Компилятор предотвращает смешивание разных типов ID
- Улучшенная читаемость кода (явные типы вместо i64)
- Самодокументирующиеся типы
Статус: Priority 2 теперь 60% (3/5 задач)
- ✅ Error enum
- ✅ Config validation
- ✅ Newtype для ID
- ⏳ MessageInfo реструктуризация
- ⏳ MessageBuilder pattern
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-01-31 01:33:18 +03:00 |
|
Mikhail Kilin
|
bba5cbd22d
|
fixes
|
2026-01-30 23:55:01 +03:00 |
|
Mikhail Kilin
|
433233d766
|
commit
|
2026-01-30 17:26:21 +03:00 |
|
Mikhail Kilin
|
4deb0fbe00
|
commit
|
2026-01-30 15:07:13 +03:00 |
|
Mikhail Kilin
|
126c7482af
|
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-29 01:22:57 +03:00 |
|
Mikhail Kilin
|
68a2b7a982
|
fixes
|
2026-01-28 11:39:21 +03:00 |
|