make sure sent messages have proper SIM card associated

This commit is contained in:
tibbi 2021-01-01 17:04:41 +01:00
parent 099caf96eb
commit cf75ab71d4
7 changed files with 70 additions and 12 deletions

View file

@ -554,6 +554,16 @@ fun Context.markThreadMessagesUnread(threadId: Long) {
}
}
fun Context.updateMessageSubscriptionId(messageId: Long, subscriptionId: Int) {
val uri = Sms.CONTENT_URI
val contentValues = ContentValues().apply {
put(Sms.SUBSCRIPTION_ID, subscriptionId)
}
val selection = "${Sms._ID} = ?"
val selectionArgs = arrayOf(messageId.toString())
contentResolver.update(uri, contentValues, selection, selectionArgs)
}
fun Context.updateUnreadCountBadge(conversations: List<Conversation>) {
val unreadCount = conversations.count { !it.read }
if (unreadCount == 0) {