mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
fix #206, solving a glitch with number being shown instead of name
This commit is contained in:
@@ -431,7 +431,6 @@ class ThreadActivity : SimpleActivity() {
|
|||||||
participants = if (messages.isEmpty()) {
|
participants = if (messages.isEmpty()) {
|
||||||
val intentNumbers = getPhoneNumbersFromIntent()
|
val intentNumbers = getPhoneNumbersFromIntent()
|
||||||
val participants = getThreadParticipants(threadId, null)
|
val participants = getThreadParticipants(threadId, null)
|
||||||
|
|
||||||
fixParticipantNumbers(participants, intentNumbers)
|
fixParticipantNumbers(participants, intentNumbers)
|
||||||
} else {
|
} else {
|
||||||
messages.first().participants
|
messages.first().participants
|
||||||
|
@@ -6,6 +6,7 @@ import android.content.Intent
|
|||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.provider.Telephony
|
import android.provider.Telephony
|
||||||
|
import com.simplemobiletools.commons.extensions.getMyContactsCursor
|
||||||
import com.simplemobiletools.commons.extensions.isNumberBlocked
|
import com.simplemobiletools.commons.extensions.isNumberBlocked
|
||||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.commons.models.SimpleContact
|
import com.simplemobiletools.commons.models.SimpleContact
|
||||||
@@ -37,6 +38,7 @@ class SmsReceiver : BroadcastReceiver() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handler(Looper.getMainLooper()).post {
|
Handler(Looper.getMainLooper()).post {
|
||||||
|
val privateCursor = context.getMyContactsCursor(false, true)?.loadInBackground()
|
||||||
if (!context.isNumberBlocked(address)) {
|
if (!context.isNumberBlocked(address)) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val newMessageId = context.insertNewSMS(address, subject, body, date, read, threadId, type, subscriptionId)
|
val newMessageId = context.insertNewSMS(address, subject, body, date, read, threadId, type, subscriptionId)
|
||||||
@@ -52,9 +54,11 @@ class SmsReceiver : BroadcastReceiver() {
|
|||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
|
|
||||||
val participant = SimpleContact(0, 0, address, "", arrayListOf(address), ArrayList(), ArrayList())
|
val senderName = context.getNameFromAddress(address, privateCursor)
|
||||||
|
val participant = SimpleContact(0, 0, senderName, "", arrayListOf(address), ArrayList(), ArrayList())
|
||||||
val participants = arrayListOf(participant)
|
val participants = arrayListOf(participant)
|
||||||
val messageDate = (date / 1000).toInt()
|
val messageDate = (date / 1000).toInt()
|
||||||
|
|
||||||
val message =
|
val message =
|
||||||
Message(newMessageId, body, type, status, participants, messageDate, false, threadId, false, null, address, "", subscriptionId)
|
Message(newMessageId, body, type, status, participants, messageDate, false, threadId, false, null, address, "", subscriptionId)
|
||||||
context.messagesDB.insertOrUpdate(message)
|
context.messagesDB.insertOrUpdate(message)
|
||||||
|
Reference in New Issue
Block a user