Dismiss qkreply after marking read or sending message

This commit is contained in:
Moez Bhatti
2018-03-28 17:59:37 -04:00
parent 96c6d5ca53
commit 3fc81b4c86
2 changed files with 6 additions and 2 deletions
@@ -28,5 +28,6 @@ interface QkReplyView : QkView<QkReplyState> {
val sendIntent: Observable<Unit>
fun setDraft(draft: String)
fun finish()
}
@@ -72,7 +72,7 @@ class QkReplyViewModel(intent: Intent) : QkViewModel<QkReplyView, QkReplyState>(
.withLatestFrom(conversation, { _, conversation -> conversation })
.map { conversation -> conversation.id }
.autoDisposable(view.scope())
.subscribe { threadId -> markRead.execute(threadId) }
.subscribe { threadId -> markRead.execute(threadId) { view.finish() } }
// Show all messages
view.menuItemIntent
@@ -133,8 +133,11 @@ class QkReplyViewModel(intent: Intent) : QkViewModel<QkReplyView, QkReplyState>(
.withLatestFrom(conversation, { body, conversation ->
val threadId = conversation.id
val addresses = conversation.recipients.map { it.address }
sendMessage.execute(SendMessage.Params(threadId, addresses, body, listOf()))
view.setDraft("")
sendMessage.execute(SendMessage.Params(threadId, addresses, body, listOf())) {
view.finish()
}
})
.autoDisposable(view.scope())
.subscribe()