mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
properly fetch the SIM card ID at messages
This commit is contained in:
@@ -73,9 +73,10 @@ fun Context.getMessages(threadId: Int): ArrayList<Message> {
|
|||||||
val date = (cursor.getLongValue(Sms.DATE) / 1000).toInt()
|
val date = (cursor.getLongValue(Sms.DATE) / 1000).toInt()
|
||||||
val read = cursor.getIntValue(Sms.READ) == 1
|
val read = cursor.getIntValue(Sms.READ) == 1
|
||||||
val thread = cursor.getIntValue(Sms.THREAD_ID)
|
val thread = cursor.getIntValue(Sms.THREAD_ID)
|
||||||
|
val subscriptionId = cursor.getIntValue(Sms.SUBSCRIPTION_ID)
|
||||||
val participant = SimpleContact(0, 0, senderName, photoUri, senderNumber)
|
val participant = SimpleContact(0, 0, senderName, photoUri, senderNumber)
|
||||||
val isMMS = false
|
val isMMS = false
|
||||||
val message = Message(id, body, type, arrayListOf(participant), date, read, thread, isMMS, null, senderName, photoUri)
|
val message = Message(id, body, type, arrayListOf(participant), date, read, thread, isMMS, null, senderName, photoUri, subscriptionId)
|
||||||
messages.add(message)
|
messages.add(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +95,8 @@ fun Context.getMMS(threadId: Int? = null, sortOrder: String? = null): ArrayList<
|
|||||||
Mms.DATE,
|
Mms.DATE,
|
||||||
Mms.READ,
|
Mms.READ,
|
||||||
Mms.MESSAGE_BOX,
|
Mms.MESSAGE_BOX,
|
||||||
Mms.THREAD_ID
|
Mms.THREAD_ID,
|
||||||
|
Mms.SUBSCRIPTION_ID
|
||||||
)
|
)
|
||||||
|
|
||||||
val selection = if (threadId == null) {
|
val selection = if (threadId == null) {
|
||||||
@@ -118,6 +120,7 @@ fun Context.getMMS(threadId: Int? = null, sortOrder: String? = null): ArrayList<
|
|||||||
val date = cursor.getLongValue(Mms.DATE).toInt()
|
val date = cursor.getLongValue(Mms.DATE).toInt()
|
||||||
val read = cursor.getIntValue(Mms.READ) == 1
|
val read = cursor.getIntValue(Mms.READ) == 1
|
||||||
val threadId = cursor.getIntValue(Mms.THREAD_ID)
|
val threadId = cursor.getIntValue(Mms.THREAD_ID)
|
||||||
|
val subscriptionId = cursor.getIntValue(Mms.SUBSCRIPTION_ID)
|
||||||
val participants = if (threadParticipants.containsKey(threadId)) {
|
val participants = if (threadParticipants.containsKey(threadId)) {
|
||||||
threadParticipants[threadId]!!
|
threadParticipants[threadId]!!
|
||||||
} else {
|
} else {
|
||||||
@@ -141,7 +144,7 @@ fun Context.getMMS(threadId: Int? = null, sortOrder: String? = null): ArrayList<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val message = Message(mmsId, body, type, participants, date, read, threadId, isMMS, attachment, senderName, senderPhotoUri)
|
val message = Message(mmsId, body, type, participants, date, read, threadId, isMMS, attachment, senderName, senderPhotoUri, subscriptionId)
|
||||||
messages.add(message)
|
messages.add(message)
|
||||||
|
|
||||||
participants.forEach {
|
participants.forEach {
|
||||||
|
@@ -5,6 +5,6 @@ import com.simplemobiletools.commons.models.SimpleContact
|
|||||||
|
|
||||||
data class Message(
|
data class Message(
|
||||||
val id: Int, val body: String, val type: Int, val participants: ArrayList<SimpleContact>, val date: Int, val read: Boolean, val thread: Int,
|
val id: Int, val body: String, val type: Int, val participants: ArrayList<SimpleContact>, val date: Int, val read: Boolean, val thread: Int,
|
||||||
val isMMS: Boolean, val attachment: MessageAttachment?, val senderName: String, val senderPhotoUri: String) : ThreadItem() {
|
val isMMS: Boolean, val attachment: MessageAttachment?, val senderName: String, val senderPhotoUri: String, val subscriptionId: Int) : ThreadItem() {
|
||||||
fun isReceivedMessage() = type == Telephony.Sms.MESSAGE_TYPE_INBOX
|
fun isReceivedMessage() = type == Telephony.Sms.MESSAGE_TYPE_INBOX
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user