Update badge whenever message read status is modified

This commit is contained in:
Moez Bhatti
2018-03-09 15:46:07 -08:00
parent 6f8dcac958
commit b15568cef9
8 changed files with 72 additions and 13 deletions
+4 -2
View File
@@ -25,13 +25,15 @@ import javax.inject.Inject
class MarkRead @Inject constructor(
private val messageRepo: MessageRepository,
private val notificationManager: NotificationManager
private val notificationManager: NotificationManager,
private val updateBadge: UpdateBadge
) : Interactor<Long>() {
override fun buildObservable(params: Long): Flowable<Unit> {
override fun buildObservable(params: Long): Flowable<*> {
return Flowable.just(Unit)
.doOnNext { messageRepo.markRead(params) }
.doOnNext { notificationManager.update(params) }
.flatMap { updateBadge.buildObservable(Unit) } // Update the badge
}
}