Don't notify for blocked messages

This commit is contained in:
Moez Bhatti
2018-03-05 16:37:20 -05:00
parent 89b68672a2
commit 545319756e
2 changed files with 2 additions and 0 deletions
@@ -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
}
@@ -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
}