Show messages in QkReplyActivity

This commit is contained in:
Moez Bhatti
2018-03-28 01:31:01 -04:00
parent 16d49e8e64
commit 5bda23c1c8
7 changed files with 52 additions and 18 deletions
@@ -40,7 +40,11 @@ class QkReplyViewModel(intent: Intent) : QkViewModel<QkReplyView, QkReplyState>(
.asObservable<Conversation>()
.filter { it.isLoaded }
.filter { it.isValid }
.subscribe { conversation -> newState { it.copy(title = conversation.getTitle()) } }
.distinctUntilChanged()
.doOnNext { conversation -> newState { it.copy(title = conversation.getTitle()) } }
.map { conversation -> Pair(conversation, messageRepo.getUnreadMessages(conversation.id)) }
.doOnNext { data -> newState { it.copy(data = data) } }
.subscribe()
}
}