prevent calling blocked numbers

This commit is contained in:
Osama Bashir
2022-12-27 01:21:40 +03:00
parent 362757fa42
commit f78762aad4
3 changed files with 8 additions and 0 deletions

View File

@ -36,6 +36,12 @@ class DialerActivity : SimpleActivity() {
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
private fun initOutgoingCall() { private fun initOutgoingCall() {
try { try {
if (this.isNumberBlocked(callNumber.toString().replace("tel:", ""), this.getBlockedNumbers())) {
toast(R.string.blocked_number)
finish()
return
}
getHandleToUse(intent, callNumber.toString()) { handle -> getHandleToUse(intent, callNumber.toString()) { handle ->
if (handle != null) { if (handle != null) {
Bundle().apply { Bundle().apply {

View File

@ -22,6 +22,7 @@
<string name="call_number">Call number</string> <string name="call_number">Call number</string>
<string name="dialpad_beeps">Enable beeps on dialpad button clicks</string> <string name="dialpad_beeps">Enable beeps on dialpad button clicks</string>
<string name="dialpad_vibrations">Enable vibrations on dialpad button clicks</string> <string name="dialpad_vibrations">Enable vibrations on dialpad button clicks</string>
<string name="calling_blocked_numbe">الرقم الذي تحاول الإتصال به محظور</string>
<!-- Dialer --> <!-- Dialer -->
<string name="dialer">Dialer</string> <string name="dialer">Dialer</string>
<string name="accept">Accept</string> <string name="accept">Accept</string>

View File

@ -64,6 +64,7 @@
<string name="audio_route_wired_headset">Wired Headset</string> <string name="audio_route_wired_headset">Wired Headset</string>
<string name="audio_route_wired_or_earpiece">Wired or Earpiece</string> <string name="audio_route_wired_or_earpiece">Wired or Earpiece</string>
<string name="choose_audio_route">Choose audio route</string> <string name="choose_audio_route">Choose audio route</string>
<string name="calling_blocked_numbe">The calling number is blocked</string>
<!-- Speed dial --> <!-- Speed dial -->
<string name="speed_dial">Speed dial</string> <string name="speed_dial">Speed dial</string>