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( ...@@ -959,7 +959,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
...@@ -972,6 +972,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -972,6 +972,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)
...@@ -984,12 +985,14 @@ class ChatRoomPresenter @Inject constructor( ...@@ -984,12 +985,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