🚨 Suppress some warnings about unused parameters
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / notification / NewRemotePostHandler.kt
index 1127fea..6efff85 100644 (file)
@@ -22,12 +22,13 @@ import net.pterodactylus.sone.core.event.*
 import net.pterodactylus.sone.data.*
 import net.pterodactylus.sone.notify.*
 import net.pterodactylus.util.notify.*
+import javax.inject.*
 
 /**
  * Handler for [NewPostFoundEvent]s that adds the new post to the â€śnew posts” notification and
  * displays the notification if the â€śfirst start” notification is not being shown.
  */
-class NewRemotePostHandler(private val notificationManager: NotificationManager, private val notification: ListNotification<Post>) {
+class NewRemotePostHandler @Inject constructor(private val notificationManager: NotificationManager, @Named("newRemotePost") private val notification: ListNotification<Post>) {
 
        @Subscribe
        fun newPostFound(newPostFoundEvent: NewPostFoundEvent) {
@@ -39,4 +40,14 @@ class NewRemotePostHandler(private val notificationManager: NotificationManager,
                }
        }
 
+       @Subscribe
+       fun postRemoved(event: PostRemovedEvent) {
+               notification.remove(event.post)
+       }
+
+       @Subscribe
+       fun postMarkedKnown(event: MarkPostKnownEvent) {
+               notification.remove(event.post)
+       }
+
 }