Merge branch 'call-blocker'

This commit is contained in:
Moez Bhatti
2021-06-23 16:04:10 -07:00
66 changed files with 985 additions and 531 deletions
@@ -52,7 +52,14 @@ interface BlockingClient {
/**
* Returns the recommendation action to perform given a message from the [address]
*/
fun getAction(address: String): Single<Action>
fun shouldBlock(address: String): Single<Action>
/**
* Returns whether or not the [address] is in the blocking manager's blacklist
* In most cases this will return the same result as [shouldBlock], but it's possible for an app's blacklist
* to be temporarily deactivated, in which case the results will differ
*/
fun isBlacklisted(address: String): Single<Action>
/**
* Blocks the numbers or opens the manager
@@ -57,7 +57,7 @@ class ReceiveMms @Inject constructor(
// to check if it should be blocked after we've pulled it into realm. If it
// turns out that it should be dropped, then delete it
// TODO Don't store blocked messages in the first place
val action = blockingClient.getAction(message.address).blockingGet()
val action = blockingClient.shouldBlock(message.address).blockingGet()
val shouldDrop = prefs.drop.get()
Timber.v("block=$action, drop=$shouldDrop")
@@ -49,7 +49,7 @@ class ReceiveSms @Inject constructor(
// Don't continue if the sender is blocked
val messages = it.messages
val address = messages[0].displayOriginatingAddress
val action = blockingClient.getAction(address).blockingGet()
val action = blockingClient.shouldBlock(address).blockingGet()
val shouldDrop = prefs.drop.get()
Timber.v("block=$action, drop=$shouldDrop")
@@ -75,6 +75,7 @@ class Preferences @Inject constructor(
const val BLOCKING_MANAGER_QKSMS = 0
const val BLOCKING_MANAGER_CC = 1
const val BLOCKING_MANAGER_SIA = 2
const val BLOCKING_MANAGER_CB = 3
}
// Internal