Skip to content

Commit 2038d6d

Browse files
authored
fix(Android): remove notification from collection when notification is clicked (#6955)
1 parent 1410088 commit 2038d6d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

android/app/src/main/java/chat/rocket/reactnative/notification/NotificationIntentHandler.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,20 @@ class NotificationIntentHandler {
9393
}
9494

9595
try {
96+
val notId = extras.getString("notId")
97+
98+
// Clear the notification messages from the static map to prevent stacking
99+
if (!notId.isNullOrEmpty()) {
100+
try {
101+
val notIdInt = notId.toIntOrNull()
102+
if (notIdInt != null) {
103+
CustomPushNotification.clearMessages(notIdInt)
104+
}
105+
} catch (e: Exception) {
106+
Log.e(TAG, "Error clearing notification messages for ID $notId: ${e.message}", e)
107+
}
108+
}
109+
96110
// Extract all notification data from Intent extras
97111
// Only include serializable types to avoid JSON serialization errors
98112
val notificationData = mutableMapOf<String, Any?>()

0 commit comments

Comments
 (0)