handle sending group SMS

- in Context.getMessages, split the sender number by spaces " " to get each contact.
- apply update in the android-smsmms lib - do not pass threadId in Transaction.sendNewMessage
This commit is contained in:
darthpaul
2022-05-01 03:33:47 +01:00
parent 43d5a0f665
commit 72cbb342a6
4 changed files with 9 additions and 6 deletions

View File

@@ -829,7 +829,7 @@ class ThreadActivity : SimpleActivity() {
transaction.setExplicitBroadcastForDeliveredSms(deliveredIntent)
refreshedSinceSent = false
transaction.sendNewMessage(message, threadId)
transaction.sendNewMessage(message)
thread_type_message.setText("")
attachmentSelections.clear()
thread_attachments_holder.beGone()

View File

@@ -103,10 +103,13 @@ fun Context.getMessages(threadId: Long, getImageResolutions: Boolean): ArrayList
val thread = cursor.getLongValue(Sms.THREAD_ID)
val subscriptionId = cursor.getIntValue(Sms.SUBSCRIPTION_ID)
val status = cursor.getIntValue(Sms.STATUS)
val phoneNumber = PhoneNumber(senderNumber, 0, "", senderNumber)
val participant = SimpleContact(0, 0, senderName, photoUri, arrayListOf(phoneNumber), ArrayList(), ArrayList())
val participants = senderNumber.split(" ").filter { it.areDigitsOnly() }.map { number ->
val phoneNumber = PhoneNumber(number, 0, "", number)
val participantPhoto = getNameAndPhotoFromPhoneNumber(number)
SimpleContact(0, 0, participantPhoto.name, photoUri, arrayListOf(phoneNumber), ArrayList(), ArrayList())
}
val isMMS = false
val message = Message(id, body, type, status, arrayListOf(participant), date, read, thread, isMMS, null, senderName, photoUri, subscriptionId)
val message = Message(id, body, type, status, ArrayList(participants), date, read, thread, isMMS, null, senderName, photoUri, subscriptionId)
messages.add(message)
}

View File

@@ -35,7 +35,7 @@ class DirectReplyReceiver : BroadcastReceiver() {
transaction.setExplicitBroadcastForSentSms(smsSentIntent)
transaction.setExplicitBroadcastForDeliveredSms(deliveredIntent)
transaction.sendNewMessage(message, threadId)
transaction.sendNewMessage(message)
} catch (e: Exception) {
context.showErrorToast(e)
}

View File

@@ -30,7 +30,7 @@ class HeadlessSmsSendService : Service() {
transaction.setExplicitBroadcastForSentSms(smsSentIntent)
transaction.setExplicitBroadcastForDeliveredSms(deliveredIntent)
transaction.sendNewMessage(message, getThreadId(number))
transaction.sendNewMessage(message)
} catch (ignored: Exception) {
}