Кэш чатов
This commit is contained in:
@@ -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) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user