mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
Add Delete action for notification (#1275)
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package com.moez.QKSMS.interactor
|
||||
|
||||
import com.moez.QKSMS.manager.NotificationManager
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
@@ -26,6 +27,7 @@ import javax.inject.Inject
|
||||
class DeleteMessages @Inject constructor(
|
||||
private val conversationRepo: ConversationRepository,
|
||||
private val messageRepo: MessageRepository,
|
||||
private val notificationManager: NotificationManager,
|
||||
private val updateBadge: UpdateBadge
|
||||
) : Interactor<DeleteMessages.Params>() {
|
||||
|
||||
@@ -35,6 +37,7 @@ class DeleteMessages @Inject constructor(
|
||||
return Flowable.just(params.messageIds.toLongArray())
|
||||
.doOnNext { messageIds -> messageRepo.deleteMessages(*messageIds) } // Delete the messages
|
||||
.doOnNext { params.threadId?.let { conversationRepo.updateConversations(it) } } // Update the conversation
|
||||
.doOnNext { params.threadId?.let { notificationManager.update(it) } }
|
||||
.flatMap { updateBadge.buildObservable(Unit) } // Update the badge
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user