fix showing messages from unstored contacts

This commit is contained in:
Tibor Kaputa 2022-05-27 18:47:16 +02:00 committed by GitHub
parent e1078d4379
commit 137f0db6f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -35,6 +35,7 @@ class SmsReceiver : BroadcastReceiver() {
val read = 0
val subscriptionId = intent.getIntExtra("subscription", -1)
val privateCursor = context.getMyContactsCursor(false, true)
ensureBackgroundThread {
messages.forEach {
address = it.originatingAddress ?: ""
@ -47,7 +48,7 @@ class SmsReceiver : BroadcastReceiver() {
if (context.baseConfig.blockUnknownNumbers) {
val simpleContactsHelper = SimpleContactsHelper(context)
simpleContactsHelper.exists(address) { exists ->
simpleContactsHelper.exists(address, privateCursor) { exists ->
if (exists) {
handleMessage(context, address, subject, body, date, read, threadId, type, subscriptionId, status)
}
@ -58,8 +59,9 @@ class SmsReceiver : BroadcastReceiver() {
}
}
private fun handleMessage(context: Context, address: String, subject: String, body: String, date: Long, read: Int,
threadId: Long, type: Int, subscriptionId: Int, status: Int) {
private fun handleMessage(
context: Context, address: String, subject: String, body: String, date: Long, read: Int, threadId: Long, type: Int, subscriptionId: Int, status: Int
) {
val bitmap = getPhotoForNotification(address, context)
Handler(Looper.getMainLooper()).post {
if (!context.isNumberBlocked(address)) {