#1234 - Mark conversation as read when archiving

This commit is contained in:
Moez Bhatti
2018-07-24 15:13:39 -04:00
parent b2f5ccedf9
commit 27ff7f1ad4
@@ -22,11 +22,15 @@ import com.moez.QKSMS.repository.ConversationRepository
import io.reactivex.Flowable
import javax.inject.Inject
class MarkArchived @Inject constructor(private val conversationRepo: ConversationRepository) : Interactor<List<Long>>() {
class MarkArchived @Inject constructor(
private val conversationRepo: ConversationRepository,
private val markRead: MarkRead
) : Interactor<List<Long>>() {
override fun buildObservable(params: List<Long>): Flowable<*> {
return Flowable.just(params.toLongArray())
.doOnNext { threadIds -> conversationRepo.markArchived(*threadIds) }
.flatMap { markRead.buildObservable(params) }
}
}