X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fnotification%2FNewSoneHandler.kt;h=83be6fd945079277aa1076baaba93c0f2d84b1ad;hp=9ac6c28000a0f140fb38361d27a6799cde970530;hb=b6a8b559407daefde5ce01967190cccf97e2bb00;hpb=188857148a7b035bfc6033b1fd40d774bd1fac65 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt b/src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt index 9ac6c28..83be6fd 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt @@ -29,7 +29,7 @@ import net.pterodactylus.util.template.* */ class NewSoneHandler(private val notificationManager: NotificationManager, template: Template) { - private val notification = ListNotification("new-sone-notification", "", template) + private val notification = ListNotification("new-sone-notification", "sones", template, dismissable = false) @Subscribe fun newSoneFound(newSoneFoundEvent: NewSoneFoundEvent) { @@ -39,6 +39,16 @@ class NewSoneHandler(private val notificationManager: NotificationManager, templ } } + @Subscribe + fun markedSoneKnown(markSoneKnownEvent: MarkSoneKnownEvent) { + notification.remove(markSoneKnownEvent.sone) + } + + @Subscribe + fun soneRemoved(soneRemovedEvent: SoneRemovedEvent) { + notification.remove(soneRemovedEvent.sone) + } + } private fun NotificationManager.hasNotification(id: String) =