forked from upstream-mirrors/quik
Refresh realm instead of waiting on async query when changing message box and close realm instance when finished
This commit is contained in:
@@ -21,20 +21,18 @@ package interactor
|
||||
import common.util.NotificationManager
|
||||
import data.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import javax.inject.Inject
|
||||
|
||||
class MarkFailed @Inject constructor(
|
||||
private val messageRepo: MessageRepository,
|
||||
private val notificationManager: NotificationManager
|
||||
) : Interactor<MarkFailed.Params, Any>() {
|
||||
) : Interactor<MarkFailed.Params, Unit>() {
|
||||
|
||||
data class Params(val id: Long, val resultCode: Int)
|
||||
|
||||
override fun buildObservable(params: Params): Flowable<Any> {
|
||||
override fun buildObservable(params: Params): Flowable<Unit> {
|
||||
return Flowable.just(Unit)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap { messageRepo.markFailed(params.id, params.resultCode) }
|
||||
.doOnNext { messageRepo.markFailed(params.id, params.resultCode) }
|
||||
.doOnNext { notificationManager.notifyFailed(params.id) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user