mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
adding a null check at blocking calls from not stored contacts
This commit is contained in:
@ -14,11 +14,13 @@ class SimpleCallScreeningService : CallScreeningService() {
|
||||
|
||||
override fun onScreenCall(callDetails: Call.Details) {
|
||||
if (baseConfig.blockUnknownNumbers) {
|
||||
val simpleContactsHelper = SimpleContactsHelper(this)
|
||||
val number = Uri.decode(callDetails.handle?.toString()).substringAfter("tel:")
|
||||
val privateCursor = getMyContactsCursor(false, true)
|
||||
simpleContactsHelper.exists(number, privateCursor) { exists ->
|
||||
respondToCall(callDetails, !exists)
|
||||
if (callDetails.handle != null) {
|
||||
val simpleContactsHelper = SimpleContactsHelper(this)
|
||||
val number = Uri.decode(callDetails.handle?.toString() ?: "").substringAfter("tel:")
|
||||
val privateCursor = getMyContactsCursor(false, true)
|
||||
simpleContactsHelper.exists(number, privateCursor) { exists ->
|
||||
respondToCall(callDetails, !exists)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
respondToCall(callDetails, false)
|
||||
|
Reference in New Issue
Block a user