Remove notification state cleanup based on displayed notifications.

This commit is contained in:
Cody Henthorne
2025-06-23 11:48:32 -04:00
parent 79de5f733f
commit a181b35e8d

View File

@@ -178,22 +178,6 @@ class DefaultMessageNotifier(context: Application) : MessageNotifier {
return
}
val displayedNotifications: Set<Int>? = ServiceUtil.getNotificationManager(context).getDisplayedNotificationIds().getOrNull()
if (displayedNotifications != null) {
val cleanedUpThreads: MutableSet<ConversationId> = mutableSetOf()
state.conversations.filterNot { it.hasNewNotifications() || displayedNotifications.contains(it.notificationId) }
.forEach { conversation ->
cleanedUpThreads += conversation.thread
conversation.notificationItems.forEach { item ->
SignalDatabase.messages.markAsNotified(item.id)
}
}
if (cleanedUpThreads.isNotEmpty()) {
Log.i(TAG, "Cleaned up ${cleanedUpThreads.size} thread(s) with dangling notifications")
state = state.copy(conversations = state.conversations.filterNot { cleanedUpThreads.contains(it.thread) })
}
}
val retainStickyThreadIds: Set<ConversationId> = state.getThreadsWithMostRecentNotificationFromSelf()
stickyThreads.keys.retainAll { retainStickyThreadIds.contains(it) }