From 545319756e7a956f982186ef78445264582c9664 Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Mon, 5 Mar 2018 16:37:20 -0500 Subject: [PATCH] Don't notify for blocked messages --- qksms/src/main/java/interactor/ReceiveMms.kt | 1 + qksms/src/main/java/interactor/ReceiveSms.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/qksms/src/main/java/interactor/ReceiveMms.kt b/qksms/src/main/java/interactor/ReceiveMms.kt index 5cab6f1c..3315a79d 100644 --- a/qksms/src/main/java/interactor/ReceiveMms.kt +++ b/qksms/src/main/java/interactor/ReceiveMms.kt @@ -37,6 +37,7 @@ class ReceiveMms @Inject constructor( return Flowable.just(params) .flatMap { uri -> syncManager.syncMessage(uri) } // Sync the message .mapNotNull { message -> messageRepo.getOrCreateConversation(message.threadId) } // Map message to conversation + .filter { conversation -> !conversation.blocked } // Don't notify for blocked conversations .doOnNext { conversation -> if (conversation.archived) messageRepo.markUnarchived(conversation.id) } // Unarchive conversation if necessary .doOnNext { conversation -> notificationManager.update(conversation.id) } // Update the notification } diff --git a/qksms/src/main/java/interactor/ReceiveSms.kt b/qksms/src/main/java/interactor/ReceiveSms.kt index 355067e4..beaca33e 100644 --- a/qksms/src/main/java/interactor/ReceiveSms.kt +++ b/qksms/src/main/java/interactor/ReceiveSms.kt @@ -44,6 +44,7 @@ class ReceiveSms @Inject constructor( messageRepo.insertReceivedSms(address, body, time) // Add the message to the db } .mapNotNull { message -> messageRepo.getOrCreateConversation(message.threadId) } // Map message to conversation + .filter { conversation -> !conversation.blocked } // Don't notify for blocked conversations .doOnNext { conversation -> if (conversation.archived) messageRepo.markUnarchived(conversation.id) } // Unarchive conversation if necessary .doOnNext { conversation -> notificationManager.update(conversation.id) } // Update the notification }