Commit 48f93354 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by Lucio Maciel

Fix typing status appearing for the current logged in user.

parent 8dd30e58
...@@ -1006,7 +1006,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -1006,7 +1006,7 @@ class ChatRoomPresenter @Inject constructor(
} }
} }
private suspend fun subscribeTypingStatus() { private fun subscribeTypingStatus() {
launch(CommonPool + strategy.jobs) { launch(CommonPool + strategy.jobs) {
client.subscribeTypingStatus(chatRoomId.toString()) { _, id -> client.subscribeTypingStatus(chatRoomId.toString()) { _, id ->
typingStatusSubscriptionId = id typingStatusSubscriptionId = id
...@@ -1019,22 +1019,25 @@ class ChatRoomPresenter @Inject constructor( ...@@ -1019,22 +1019,25 @@ class ChatRoomPresenter @Inject constructor(
} }
private fun processTypingStatus(typingStatus: Pair<String, Boolean>) { private fun processTypingStatus(typingStatus: Pair<String, Boolean>) {
if (!typingStatusList.any { username -> username == typingStatus.first }) { if (typingStatus.first != currentLoggedUsername) {
if (typingStatus.second) { if (!typingStatusList.any { username -> username == typingStatus.first }) {
typingStatusList.add(typingStatus.first)
}
} else {
typingStatusList.find { username -> username == typingStatus.first }?.let {
typingStatusList.remove(it)
if (typingStatus.second) { if (typingStatus.second) {
typingStatusList.add(typingStatus.first) typingStatusList.add(typingStatus.first)
} }
} else {
typingStatusList.find { username -> username == typingStatus.first }?.let {
typingStatusList.remove(it)
if (typingStatus.second) {
typingStatusList.add(typingStatus.first)
}
}
}
if (typingStatusList.isNotEmpty()) {
view.showTypingStatus(typingStatusList.toList())
} else {
view.hideTypingStatusView()
} }
}
if (typingStatusList.isNotEmpty()) {
view.showTypingStatus(typingStatusList.toList()) // copy typingStatusList
} else {
view.hideTypingStatusView()
} }
} }
......
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