forked from upstream-mirrors/quik
Check with Call Control to see if we should block message
This commit is contained in:
@@ -27,6 +27,7 @@ import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import com.moez.QKSMS.repository.SyncRepository
|
||||
import io.reactivex.Flowable
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class ReceiveMms @Inject constructor(
|
||||
@@ -55,6 +56,7 @@ class ReceiveMms @Inject constructor(
|
||||
// turns out that it should be blocked, then delete it
|
||||
// TODO Don't store blocked messages in the first place
|
||||
!blockingClient.shouldBlock(message.address).blockingGet().also { blocked ->
|
||||
Timber.v("Should block: $blocked")
|
||||
if (blocked) messageRepo.deleteMessages(message.id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.moez.QKSMS.manager.ShortcutManager
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.repository.MessageRepository
|
||||
import io.reactivex.Flowable
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
class ReceiveSms @Inject constructor(
|
||||
@@ -45,7 +46,9 @@ class ReceiveSms @Inject constructor(
|
||||
.filter {
|
||||
// Don't continue if the sender is blocked
|
||||
val address = it.messages[0].displayOriginatingAddress
|
||||
!blockingClient.shouldBlock(address).blockingGet()
|
||||
val shouldBlock = blockingClient.shouldBlock(address).blockingGet()
|
||||
Timber.v("Should block: $shouldBlock")
|
||||
!shouldBlock
|
||||
}
|
||||
.map {
|
||||
val messages = it.messages
|
||||
|
||||
Reference in New Issue
Block a user