ignore messages and contacts without number

This commit is contained in:
tibbi 2020-05-13 14:58:20 +02:00
parent dcc98c0a25
commit e4d01a7607
1 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ fun Context.getMessages(threadId: Int): ArrayList<Message> {
val blockStatus = HashMap<String, Boolean>()
var messages = ArrayList<Message>()
queryCursor(uri, projection, selection, selectionArgs, sortOrder, showErrors = true) { cursor ->
val senderNumber = cursor.getStringValue(Sms.ADDRESS)
val senderNumber = cursor.getStringValue(Sms.ADDRESS) ?: return@queryCursor
val isNumberBlocked = if (blockStatus.containsKey(senderNumber)) {
blockStatus[senderNumber]!!
@ -375,7 +375,7 @@ fun Context.getSuggestedContacts(): ArrayList<SimpleContact> {
val sortOrder = "${Sms.DATE} DESC LIMIT 20"
queryCursor(uri, projection, selection, selectionArgs, sortOrder, showErrors = true) { cursor ->
val senderNumber = cursor.getStringValue(Sms.ADDRESS)
val senderNumber = cursor.getStringValue(Sms.ADDRESS) ?: return@queryCursor
val namePhoto = getNameAndPhotoFromPhoneNumber(senderNumber)
if (namePhoto == null || namePhoto.name == senderNumber || isNumberBlocked(senderNumber)) {
return@queryCursor