adding some extra checks to avoid showing blocked numbers on some places
This commit is contained in:
parent
5956aef897
commit
cfda56973d
|
@ -368,7 +368,7 @@ fun Context.getSuggestedContacts(): ArrayList<Contact> {
|
|||
queryCursor(uri, projection, selection, selectionArgs, sortOrder, showErrors = true) { cursor ->
|
||||
val senderNumber = cursor.getStringValue(Sms.ADDRESS)
|
||||
val namePhoto = getNameAndPhotoFromPhoneNumber(senderNumber)
|
||||
if (namePhoto == null || namePhoto.name == senderNumber) {
|
||||
if (namePhoto == null || namePhoto.name == senderNumber || isNumberBlocked(senderNumber)) {
|
||||
return@queryCursor
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.bumptech.glide.Glide
|
|||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.smsmessenger.R
|
||||
import com.simplemobiletools.smsmessenger.extensions.getLatestMMS
|
||||
import com.simplemobiletools.smsmessenger.extensions.isNumberBlocked
|
||||
import com.simplemobiletools.smsmessenger.extensions.showReceivedMessageNotification
|
||||
|
||||
// more info at https://github.com/klinker41/android-smsmms
|
||||
|
@ -13,8 +14,11 @@ class MmsReceiver : com.klinker.android.send_message.MmsReceivedReceiver() {
|
|||
override fun onMessageReceived(context: Context, messageUri: Uri) {
|
||||
val mms = context.getLatestMMS() ?: return
|
||||
val address = mms.participants.firstOrNull()?.phoneNumber ?: ""
|
||||
val size = context.resources.getDimension(R.dimen.notification_large_icon_size).toInt()
|
||||
if (context.isNumberBlocked(address)) {
|
||||
return
|
||||
}
|
||||
|
||||
val size = context.resources.getDimension(R.dimen.notification_large_icon_size).toInt()
|
||||
ensureBackgroundThread {
|
||||
val glideBitmap = try {
|
||||
Glide.with(context)
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.content.Intent
|
|||
import android.provider.Telephony
|
||||
import com.simplemobiletools.smsmessenger.extensions.getThreadId
|
||||
import com.simplemobiletools.smsmessenger.extensions.insertNewSMS
|
||||
import com.simplemobiletools.smsmessenger.extensions.isNumberBlocked
|
||||
import com.simplemobiletools.smsmessenger.extensions.showReceivedMessageNotification
|
||||
import com.simplemobiletools.smsmessenger.helpers.refreshMessages
|
||||
|
||||
|
@ -14,6 +15,10 @@ class SmsReceiver : BroadcastReceiver() {
|
|||
val messages = Telephony.Sms.Intents.getMessagesFromIntent(intent)
|
||||
messages.forEach {
|
||||
val address = it.originatingAddress ?: ""
|
||||
if (context.isNumberBlocked(address)) {
|
||||
return@forEach
|
||||
}
|
||||
|
||||
val subject = it.pseudoSubject
|
||||
val body = it.messageBody
|
||||
val date = it.timestampMillis
|
||||
|
|
Loading…
Reference in New Issue