From: David ‘Bombe’ Roden Date: Tue, 10 Dec 2019 15:50:49 +0000 (+0100) Subject: 🐛 Fix new-sone handler X-Git-Tag: v81^2~5^2~68 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=0831ce844d421828bd9a4dc12f33ba58f9990c25 🐛 Fix new-sone handler --- 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 a420f14..f47d456 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NewSoneHandler.kt @@ -22,11 +22,12 @@ import net.pterodactylus.sone.core.event.* import net.pterodactylus.sone.data.* import net.pterodactylus.sone.notify.* import net.pterodactylus.util.notify.* +import javax.inject.* /** * Notification handler for “new Sone discovered” events. */ -class NewSoneHandler(private val notificationManager: NotificationManager, private val notification: ListNotification) { +class NewSoneHandler @Inject constructor(private val notificationManager: NotificationManager, @Named("newSone") private val notification: ListNotification) { @Subscribe fun newSoneFound(newSoneFoundEvent: NewSoneFoundEvent) { diff --git a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt index a9e4ae8..522e983 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt @@ -38,6 +38,7 @@ class NotificationHandlerModule : AbstractModule() { bind(NotificationHandler::class.java).`in`(Singleton::class.java) bind().asSingleton() bind().asSingleton() + bind().asSingleton() } @Provides @@ -50,11 +51,6 @@ class NotificationHandlerModule : AbstractModule() { ListNotification("sone-locked-on-startup", "sones", loaders.loadTemplate("/templates/notify/soneLockedOnStartupNotification.html")) @Provides - @Singleton - fun getNewSoneHandler(notificationManager: NotificationManager, @Named("newSone") notification: ListNotification) = - NewSoneHandler(notificationManager, notification) - - @Provides @Named("newSone") fun getNewSoneNotification(loaders: Loaders) = ListNotification("new-sone-notification", "sones", loaders.loadTemplate("/templates/notify/newSoneNotification.html"), dismissable = false)