From 424b77577c1c302f3a36ba59cd15326610a9fcbd Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 8 Apr 2020 20:20:54 +0200 Subject: [PATCH] removing the Subject of the Messages, doesnt seem to be used --- .../simplemobiletools/smsmessenger/extensions/Context.kt | 9 ++------- .../com/simplemobiletools/smsmessenger/models/Message.kt | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt index 6161d884..104f8b8c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/extensions/Context.kt @@ -30,11 +30,9 @@ import kotlin.collections.ArrayList val Context.config: Config get() = Config.newInstance(applicationContext) fun Context.getMessages(threadId: Int? = null): ArrayList { - val hasContactsPermission = hasPermission(PERMISSION_READ_CONTACTS) val uri = Sms.CONTENT_URI val projection = arrayOf( Sms._ID, - Sms.SUBJECT, Sms.BODY, Sms.TYPE, Sms.ADDRESS, @@ -58,7 +56,6 @@ fun Context.getMessages(threadId: Int? = null): ArrayList { var messages = ArrayList() queryCursor(uri, projection, selection, selectionArgs, showErrors = true) { cursor -> val id = cursor.getIntValue(Sms._ID) - val subject = cursor.getStringValue(Sms.SUBJECT) ?: "" val body = cursor.getStringValue(Sms.BODY) val type = cursor.getIntValue(Sms.TYPE) val senderNumber = cursor.getStringValue(Sms.ADDRESS) @@ -66,7 +63,7 @@ fun Context.getMessages(threadId: Int? = null): ArrayList { val date = (cursor.getLongValue(Sms.DATE) / 1000).toInt() val read = cursor.getIntValue(Sms.READ) == 1 val thread = cursor.getIntValue(Sms.THREAD_ID) - val message = Message(id, subject, body, type, senderName, senderNumber, date, read, thread) + val message = Message(id, body, type, senderName, senderNumber, date, read, thread) messages.add(message) } @@ -86,7 +83,6 @@ fun Context.getMMS(threadId: Int? = null): ArrayList { Mms._ID, Mms.DATE, Mms.READ, - Mms.SUBJECT, Mms.MESSAGE_BOX, Mms.THREAD_ID ) @@ -106,7 +102,6 @@ fun Context.getMMS(threadId: Int? = null): ArrayList { val messages = ArrayList() queryCursor(uri, projection, selection, selectionArgs, showErrors = true) { cursor -> val id = cursor.getIntValue(Mms._ID) - val subject = cursor.getStringValue(Mms.SUBJECT) ?: "" val type = cursor.getIntValue(Mms.MESSAGE_BOX) val date = cursor.getLongValue(Mms.DATE).toInt() val read = cursor.getIntValue(Mms.READ) == 1 @@ -114,7 +109,7 @@ fun Context.getMMS(threadId: Int? = null): ArrayList { val senderName = getThreadRecipients(thread) val senderNumber = senderName val mms = getMmsContent(id) - val message = Message(id, subject, mms?.text ?: "", type, senderName, senderNumber, date, read, thread) + val message = Message(id, mms?.text ?: "", type, senderName, senderNumber, date, read, thread) messages.add(message) } return messages diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/Message.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/Message.kt index 129e21a6..7083008b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/Message.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/models/Message.kt @@ -3,8 +3,8 @@ package com.simplemobiletools.smsmessenger.models import android.provider.Telephony data class Message( - val id: Int, val subject: String, val body: String, val type: Int, val senderName: String, val senderNumber: String, val date: Int, - val read: Boolean, val thread: Int + val id: Int, val body: String, val type: Int, val senderName: String, val senderNumber: String, val date: Int, val read: Boolean, + val thread: Int ) : ThreadItem() { fun isReceivedMessage() = type == Telephony.Sms.MESSAGE_TYPE_INBOX }