Событие печати, смена адреса, иконки

This commit is contained in:
Халимов Рустам
2026-04-17 16:23:52 +03:00
parent cea3f4d669
commit 8c00d1376d
20 changed files with 95 additions and 26 deletions
@@ -107,6 +107,10 @@ class ChatHubClient @Inject constructor() {
_events.tryEmit(ChatEvent.UserTyping(data.chatId ?: "", data.userId ?: ""))
}, ReactionEvent::class.java)
conn.on("user_stopped_typing", { data: ReactionEvent ->
_events.tryEmit(ChatEvent.UserStoppedTyping(data.chatId ?: "", data.userId ?: ""))
}, ReactionEvent::class.java)
conn.on("user_online", { userId: String ->
_events.tryEmit(ChatEvent.UserOnline(userId))
}, String::class.java)
@@ -181,4 +185,18 @@ class ChatHubClient @Inject constructor() {
}
}
}
fun sendTypingIndicator(chatId: String) {
if (hubConnection?.connectionState == HubConnectionState.CONNECTED) {
hubConnection?.send("typing_start", chatId)
Log.d("ChatHubClient", "Sent typing indicator for chat: $chatId")
}
}
fun sendUserStoppedTyping(chatId: String) {
if (hubConnection?.connectionState == HubConnectionState.CONNECTED) {
hubConnection?.send("typing_stop", chatId)
Log.d("ChatHubClient", "Sent user stopped typing for chat: $chatId")
}
}
}