Add missing code

This commit is contained in:
AAlier 2023-06-24 04:28:35 +06:00
parent b076da3840
commit 5169539a88
5 changed files with 6 additions and 4 deletions

View File

@ -37,11 +37,13 @@ class DirectReplyReceiver : BroadcastReceiver() {
}
ensureBackgroundThread {
var messageId: Long = 0L
try {
context.sendMessageCompat(body, listOf(address), subscriptionId, emptyList())
val message = context.getMessages(threadId, getImageResolutions = false, includeScheduledMessages = false, limit = 1).lastOrNull()
if (message != null) {
context.messagesDB.insertOrUpdate(message)
messageId = message.id
}
} catch (e: Exception) {
context.showErrorToast(e)
@ -50,7 +52,7 @@ class DirectReplyReceiver : BroadcastReceiver() {
val photoUri = SimpleContactsHelper(context).getPhotoUriFromPhoneNumber(address)
val bitmap = context.getNotificationBitmap(photoUri)
Handler(Looper.getMainLooper()).post {
context.notificationHelper.showMessageNotification(address, body, threadId, bitmap, sender = null, alertOnlyOnce = true)
context.notificationHelper.showMessageNotification(messageId, address, body, threadId, bitmap, sender = null, alertOnlyOnce = true)
}
context.markThreadMessagesRead(threadId)

View File

@ -38,7 +38,7 @@ class MmsReceiver : com.klinker.android.send_message.MmsReceivedReceiver() {
}
Handler(Looper.getMainLooper()).post {
context.showReceivedMessageNotification(address, mms.body, mms.threadId, glideBitmap)
context.showReceivedMessageNotification(mms.id, address, mms.body, mms.threadId, glideBitmap)
val conversation = context.getConversations(mms.threadId).firstOrNull() ?: return@post
ensureBackgroundThread {
context.insertOrUpdateConversation(conversation)

View File

@ -86,9 +86,9 @@ class SmsReceiver : BroadcastReceiver() {
Message(newMessageId, body, type, status, participants, messageDate, false, threadId, false, null, senderName, photoUri, subscriptionId)
context.messagesDB.insertOrUpdate(message)
refreshMessages()
context.showReceivedMessageNotification(newMessageId, address, body, threadId, bitmap)
}
context.showReceivedMessageNotification(address, body, threadId, bitmap)
}
}
}

View File

@ -59,7 +59,6 @@
<item quantity="one">%d conversation</item>
<item quantity="other">%d conversations</item>
</plurals>
<string name="delete_messages">Delete message</string>
<!-- Are you sure you want to delete 5 messages? -->
<plurals name="delete_messages">
<item quantity="one">%d message</item>

View File

@ -52,6 +52,7 @@
<string name="mark_as_read">Mark as Read</string>
<string name="mark_as_unread">Mark as Unread</string>
<string name="me">Me</string>
<string name="delete_messages">Delete message</string>
<!-- Confirmation dialog -->
<string name="delete_whole_conversation_confirmation">Are you sure you want to delete all messages of this conversation?</string>
<!-- Are you sure you want to delete 5 conversations? -->