diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 64c68f506..4536491ef 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -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() } diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java index 9cbc4d718..095fc2c82 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/ThreadDatabase.java @@ -778,6 +778,7 @@ public class ThreadDatabase extends Database { if (reader != null) reader.close(); notifyConversationListListeners(); + notifyConversationListeners(threadId); } }