Commit e17d1817 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Fix typing status appearing for the current logged in user.

parent 18afd21c
......@@ -959,7 +959,7 @@ class ChatRoomPresenter @Inject constructor(
}
}
private suspend fun subscribeTypingStatus() {
private fun subscribeTypingStatus() {
launch(CommonPool + strategy.jobs) {
client.subscribeTypingStatus(chatRoomId.toString()) { _, id ->
typingStatusSubscriptionId = id
......@@ -972,6 +972,7 @@ class ChatRoomPresenter @Inject constructor(
}
private fun processTypingStatus(typingStatus: Pair<String, Boolean>) {
if (typingStatus.first != currentLoggedUsername) {
if (!typingStatusList.any { username -> username == typingStatus.first }) {
if (typingStatus.second) {
typingStatusList.add(typingStatus.first)
......@@ -984,12 +985,14 @@ class ChatRoomPresenter @Inject constructor(
}
}
}
if (typingStatusList.isNotEmpty()) {
view.showTypingStatus(typingStatusList.toList()) // copy typingStatusList
view.showTypingStatus(typingStatusList.toList())
} else {
view.hideTypingStatusView()
}
}
}
private fun unsubscribeTypingStatus() {
typingStatusSubscriptionId?.let {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment