fix: unread indicator updates properly in ConversationActivityV2

This commit is contained in:
0x330a 2023-07-12 13:17:07 +10:00
parent 258a334de3
commit a382700e6c
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
2 changed files with 3 additions and 3 deletions

View File

@ -512,14 +512,13 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
if (cursor != null) {
val messageTimestamp = messageToScrollTimestamp.getAndSet(-1)
val author = messageToScrollAuthor.getAndSet(null)
val initialUnreadCount: Int
val initialUnreadCount = mmsSmsDb.getUnreadCount(viewModel.threadId)
// Update the unreadCount value to be loaded from the database since we got a new message
if (firstLoad.get() || oldCount != newCount) {
if (firstLoad.get() || oldCount != newCount || initialUnreadCount != unreadCount) {
// Update the unreadCount value to be loaded from the database since we got a new
// message (we need to store it in a local variable as it can get overwritten on
// another thread before the 'firstLoad.getAndSet(false)' case below)
initialUnreadCount = mmsSmsDb.getUnreadCount(viewModel.threadId)
unreadCount = initialUnreadCount
updateUnreadCountIndicator()
}

View File

@ -778,6 +778,7 @@ public class ThreadDatabase extends Database {
if (reader != null)
reader.close();
notifyConversationListListeners();
notifyConversationListeners(threadId);
}
}