Mark conversation read in onResume

This commit is contained in:
Moez Bhatti
2018-09-05 19:53:16 -04:00
parent 957a1ad1d4
commit cbf690c10a
@@ -166,7 +166,6 @@ class ComposeViewModel @Inject constructor(
// When the conversation changes, mark read, and update the threadId and the messages for the adapter
disposables += conversation
.distinctUntilChanged { conversation -> conversation.id }
.doOnNext { conversation -> markRead.execute(listOf(conversation.id)) }
.observeOn(AndroidSchedulers.mainThread())
.map { conversation ->
val messages = messageRepo.getMessages(conversation.id)
@@ -435,7 +434,11 @@ class ComposeViewModel @Inject constructor(
conversation.mapNotNull { conversation -> conversation.takeIf { it.isValid }?.id }.distinctUntilChanged())
{ visible, threadId ->
when (visible) {
true -> activeConversationManager.setActiveConversation(threadId)
true -> {
activeConversationManager.setActiveConversation(threadId)
markRead.execute(listOf(threadId))
}
false -> activeConversationManager.setActiveConversation(null)
}
}