mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
update to the latest commons version
This commit is contained in:
@@ -61,6 +61,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:59f709a2a8'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:10c8ac2f1e'
|
||||||
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
|
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,16 @@ class SimpleCallScreeningService : CallScreeningService() {
|
|||||||
override fun onScreenCall(callDetails: Call.Details) {
|
override fun onScreenCall(callDetails: Call.Details) {
|
||||||
val simpleContactsHelper = SimpleContactsHelper(this)
|
val simpleContactsHelper = SimpleContactsHelper(this)
|
||||||
val number = Uri.decode(callDetails.handle.toString()).substringAfter("tel:")
|
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()
|
val response = CallResponse.Builder()
|
||||||
.setDisallowCall(isBlocked)
|
.setDisallowCall(isBlocked)
|
||||||
.setRejectCall(isBlocked)
|
.setRejectCall(isBlocked)
|
||||||
|
Reference in New Issue
Block a user