better method: limit the total of sms+mms to MESSAGES_LIMIT

this causes the sms and mms to load together for a smoother flow
This commit is contained in:
yparitcher 2023-05-10 20:35:12 -04:00
parent 7b5d32e624
commit 707d7499e3
No known key found for this signature in database
GPG key ID: 551EFB312130B5D9
2 changed files with 3 additions and 2 deletions

View file

@ -135,6 +135,7 @@ fun Context.getMessages(
.filter { it.participants.isNotEmpty() }
.filterNot { it.isScheduled && it.millis() < System.currentTimeMillis() }
.sortedWith(compareBy<Message> { it.date }.thenBy { it.id })
.takeLast(limit)
.toMutableList() as ArrayList<Message>
return messages