Merge remote-tracking branch 'origin/master' into task/older-messages
This commit is contained in:
commit
d2f824ed66
37 changed files with 68 additions and 25 deletions
|
|
@ -683,7 +683,8 @@ class ThreadActivity : SimpleActivity() {
|
|||
val message = messages.getOrNull(i) ?: continue
|
||||
// do not show the date/time above every message, only if the difference between the 2 messages is at least MIN_DATE_TIME_DIFF_SECS,
|
||||
// or if the message is sent from a different SIM
|
||||
if (message.date - prevDateTime > MIN_DATE_TIME_DIFF_SECS || prevSIMId != message.subscriptionId) {
|
||||
val isSentFromDifferentKnownSIM = prevSIMId != -1 && message.subscriptionId != -1 && prevSIMId != message.subscriptionId
|
||||
if (message.date - prevDateTime > MIN_DATE_TIME_DIFF_SECS || isSentFromDifferentKnownSIM) {
|
||||
val simCardID = subscriptionIdToSimId[message.subscriptionId] ?: "?"
|
||||
items.add(ThreadDateTime(message.date, simCardID))
|
||||
prevDateTime = message.date
|
||||
|
|
|
|||
|
|
@ -813,9 +813,9 @@ fun Context.showMessageNotification(address: String, body: String, threadId: Lon
|
|||
notificationManager.notify(threadId.hashCode(), builder.build())
|
||||
}
|
||||
|
||||
private fun getMessagesStyle(notificationManager: NotificationManager, threadId: Long, sender: String, body: String): NotificationCompat.MessagingStyle {
|
||||
private fun Context.getMessagesStyle(notificationManager: NotificationManager, threadId: Long, sender: String, body: String): NotificationCompat.MessagingStyle {
|
||||
val oldMessages = getOldMessages(notificationManager, threadId)
|
||||
val messages = NotificationCompat.MessagingStyle(sender)
|
||||
val messages = NotificationCompat.MessagingStyle(getString(R.string.me))
|
||||
oldMessages.forEach {
|
||||
messages.addMessage(it)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,15 @@ class SmsStatusSentReceiver : SentReceiver() {
|
|||
}
|
||||
|
||||
context.updateMessageType(messageId, type)
|
||||
context.messagesDB.updateType(messageId, type)
|
||||
val updated = context.messagesDB.updateType(messageId, type)
|
||||
if (updated == 0) {
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
ensureBackgroundThread {
|
||||
context.messagesDB.updateType(messageId, type)
|
||||
}
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
refreshMessages()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue