forked from upstream-mirrors/quik
Add draft support for qkreply
This commit is contained in:
@@ -61,7 +61,7 @@ class QkReplyViewModel(intent: Intent) : QkViewModel<QkReplyView, QkReplyState>(
|
||||
|
||||
disposables += conversation
|
||||
.doOnNext { conversation -> newState { it.copy(title = conversation.getTitle()) } }
|
||||
.take(1) // We only need to set the messages once
|
||||
.distinctUntilChanged { conversation -> conversation.id } // We only need to set the messages once
|
||||
.map { conversation -> Pair(conversation, messageRepo.getUnreadMessages(conversation.id)) }
|
||||
.subscribe { data -> newState { it.copy(data = data) } }
|
||||
}
|
||||
@@ -69,6 +69,12 @@ class QkReplyViewModel(intent: Intent) : QkViewModel<QkReplyView, QkReplyState>(
|
||||
override fun bindView(view: QkReplyView) {
|
||||
super.bindView(view)
|
||||
|
||||
conversation
|
||||
.map { conversation -> conversation.draft }
|
||||
.distinctUntilChanged()
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { draft -> view.setDraft(draft) }
|
||||
|
||||
// Mark read
|
||||
view.menuItemIntent
|
||||
.filter { id -> id == R.id.read }
|
||||
|
||||
Reference in New Issue
Block a user