🎨 Move new-sone template creation into module
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / notification / NewSoneHandler.kt
index 83be6fd..a420f14 100644 (file)
@@ -22,18 +22,15 @@ import net.pterodactylus.sone.core.event.*
 import net.pterodactylus.sone.data.*
 import net.pterodactylus.sone.notify.*
 import net.pterodactylus.util.notify.*
-import net.pterodactylus.util.template.*
 
 /**
  * Notification handler for â€śnew Sone discovered” events.
  */
-class NewSoneHandler(private val notificationManager: NotificationManager, template: Template) {
-
-       private val notification = ListNotification<Sone>("new-sone-notification", "sones", template, dismissable = false)
+class NewSoneHandler(private val notificationManager: NotificationManager, private val notification: ListNotification<Sone>) {
 
        @Subscribe
        fun newSoneFound(newSoneFoundEvent: NewSoneFoundEvent) {
-               if (!notificationManager.hasNotification("first-start-notification")) {
+               if (!notificationManager.hasFirstStartNotification()) {
                        notification.add(newSoneFoundEvent.sone)
                        notificationManager.addNotification(notification)
                }
@@ -50,6 +47,3 @@ class NewSoneHandler(private val notificationManager: NotificationManager, templ
        }
 
 }
-
-private fun NotificationManager.hasNotification(id: String) =
-               getNotification(id) != null