do not show blocked number messages on the main screen

This commit is contained in:
tibbi 2020-04-08 13:41:47 +02:00
parent bed5a80ccf
commit 88389a09c9
1 changed files with 6 additions and 0 deletions

View File

@ -90,6 +90,7 @@ fun Context.getMessages(threadId: Int? = null): ArrayList<Message> {
messages = messages.distinctBy { it.thread }.toMutableList() as ArrayList<Message>
}
messages = messages.filter { !isNumberBlocked(it.senderNumber) }.toMutableList() as ArrayList<Message>
return messages
}
@ -470,3 +471,8 @@ fun Context.getThreadId(address: String): Long {
0
}
}
fun Context.isNumberBlocked(number: String): Boolean {
val blockedNumbers = getBlockedNumbers()
return blockedNumbers.map { it.number }.contains(number) && !blockedNumbers.map { it.normalizedNumber }.contains(number)
}