Событие печати, смена адреса, иконки
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user