forked from upstream-mirrors/quik
Don't make threadId for DeleteMessages optional
This commit is contained in:
@@ -31,15 +31,13 @@ class DeleteMessages @Inject constructor(
|
|||||||
private val updateBadge: UpdateBadge
|
private val updateBadge: UpdateBadge
|
||||||
) : Interactor<DeleteMessages.Params>() {
|
) : Interactor<DeleteMessages.Params>() {
|
||||||
|
|
||||||
data class Params(val messageIds: List<Long>, val threadId: Long? = null)
|
data class Params(val messageIds: List<Long>, val threadId: Long)
|
||||||
|
|
||||||
override fun buildObservable(params: Params): Flowable<*> {
|
override fun buildObservable(params: Params): Flowable<*> {
|
||||||
return Flowable.just(params.messageIds.toLongArray())
|
return Flowable.just(params.messageIds.toLongArray())
|
||||||
.doOnNext { messageIds -> messageRepo.deleteMessages(*messageIds) } // Delete the messages
|
.doOnNext { messageIds -> messageRepo.deleteMessages(*messageIds) } // Delete the messages
|
||||||
.doOnNext {
|
.doOnNext { conversationRepo.updateConversations(params.threadId) } // Update the conversation
|
||||||
params.threadId?.let { conversationRepo.updateConversations(it) } // Update the conversation
|
.doOnNext { notificationManager.update(params.threadId) }
|
||||||
}
|
|
||||||
.doOnNext { params.threadId?.let { notificationManager.update(it) } }
|
|
||||||
.flatMap { updateBadge.buildObservable(Unit) } // Update the badge
|
.flatMap { updateBadge.buildObservable(Unit) } // Update the badge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user