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,6 +1019,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -1019,6 +1019,7 @@ class ChatRoomPresenter @Inject constructor(
} }
private fun processTypingStatus(typingStatus: Pair<String, Boolean>) { private fun processTypingStatus(typingStatus: Pair<String, Boolean>) {
if (typingStatus.first != currentLoggedUsername) {
if (!typingStatusList.any { username -> username == typingStatus.first }) { if (!typingStatusList.any { username -> username == typingStatus.first }) {
if (typingStatus.second) { if (typingStatus.second) {
typingStatusList.add(typingStatus.first) typingStatusList.add(typingStatus.first)
...@@ -1031,12 +1032,14 @@ class ChatRoomPresenter @Inject constructor( ...@@ -1031,12 +1032,14 @@ class ChatRoomPresenter @Inject constructor(
} }
} }
} }
if (typingStatusList.isNotEmpty()) { if (typingStatusList.isNotEmpty()) {
view.showTypingStatus(typingStatusList.toList()) // copy typingStatusList view.showTypingStatus(typingStatusList.toList())
} else { } else {
view.hideTypingStatusView() view.hideTypingStatusView()
} }
} }
}
private fun unsubscribeTypingStatus() { private fun unsubscribeTypingStatus() {
typingStatusSubscriptionId?.let { 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