Кэш чатов

This commit is contained in:
Халимов Рустам
2026-04-20 00:25:40 +03:00
parent 945134f029
commit 7c66e1c0c0
35 changed files with 2131 additions and 92 deletions
@@ -106,14 +106,14 @@ class ContactListViewModel @Inject constructor(
}
}
fun startChat(userId: String) {
fun startChat(userId: String, userName: String) {
viewModelScope.launch {
try {
// В вебе мы ищем существующий чат или создаем новый.
// В мобилке мы для начала можем просто вызвать createPersonalChat.
// Бэкенд обычно возвращает существующий чат, если он уже есть.
val chat = chatRepository.createPersonalChat(userId)
navigationManager.navigateToChat(chat.id)
navigationManager.navigateToChat(chat.id, userName)
} catch (e: Exception) {
_state.update { it.copy(error = e.message) }
}