update to the latest commons version

This commit is contained in:
Mysochenko Yuriy 2022-05-27 18:10:37 +03:00
parent d6b7d4c23f
commit a06d4b2596
2 changed files with 11 additions and 2 deletions

View File

@ -61,6 +61,6 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:59f709a2a8'
implementation 'com.github.SimpleMobileTools:Simple-Commons:10c8ac2f1e'
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
}

View File

@ -14,7 +14,16 @@ class SimpleCallScreeningService : CallScreeningService() {
override fun onScreenCall(callDetails: Call.Details) {
val simpleContactsHelper = SimpleContactsHelper(this)
val number = Uri.decode(callDetails.handle.toString()).substringAfter("tel:")
val isBlocked = baseConfig.blockUnknownNumbers && !simpleContactsHelper.exists(number)
if (baseConfig.blockUnknownNumbers) {
simpleContactsHelper.exists(number) { exists ->
respondToCall(callDetails, !exists)
}
} else {
respondToCall(callDetails, false)
}
}
private fun respondToCall(callDetails: Call.Details, isBlocked: Boolean) {
val response = CallResponse.Builder()
.setDisallowCall(isBlocked)
.setRejectCall(isBlocked)