fix showing messages from unstored contacts
This commit is contained in:
parent
e1078d4379
commit
137f0db6f2
|
@ -35,6 +35,7 @@ class SmsReceiver : BroadcastReceiver() {
|
||||||
val read = 0
|
val read = 0
|
||||||
val subscriptionId = intent.getIntExtra("subscription", -1)
|
val subscriptionId = intent.getIntExtra("subscription", -1)
|
||||||
|
|
||||||
|
val privateCursor = context.getMyContactsCursor(false, true)
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
messages.forEach {
|
messages.forEach {
|
||||||
address = it.originatingAddress ?: ""
|
address = it.originatingAddress ?: ""
|
||||||
|
@ -47,7 +48,7 @@ class SmsReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
if (context.baseConfig.blockUnknownNumbers) {
|
if (context.baseConfig.blockUnknownNumbers) {
|
||||||
val simpleContactsHelper = SimpleContactsHelper(context)
|
val simpleContactsHelper = SimpleContactsHelper(context)
|
||||||
simpleContactsHelper.exists(address) { exists ->
|
simpleContactsHelper.exists(address, privateCursor) { exists ->
|
||||||
if (exists) {
|
if (exists) {
|
||||||
handleMessage(context, address, subject, body, date, read, threadId, type, subscriptionId, status)
|
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,
|
private fun handleMessage(
|
||||||
threadId: Long, type: Int, subscriptionId: Int, status: Int) {
|
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)
|
val bitmap = getPhotoForNotification(address, context)
|
||||||
Handler(Looper.getMainLooper()).post {
|
Handler(Looper.getMainLooper()).post {
|
||||||
if (!context.isNumberBlocked(address)) {
|
if (!context.isNumberBlocked(address)) {
|
||||||
|
|
Loading…
Reference in New Issue