From: David ‘Bombe’ Roden Date: Tue, 10 Dec 2019 15:48:37 +0000 (+0100) Subject: 🐛 Fix sone-locked-on-startup handler X-Git-Tag: v81^2~5^2~69 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=f77867b98e3264bec4f0b0b2c3f6bcd7c83691f8 🐛 Fix sone-locked-on-startup handler --- 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 4737267..a9e4ae8 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt @@ -37,6 +37,7 @@ class NotificationHandlerModule : AbstractModule() { override fun configure() { bind(NotificationHandler::class.java).`in`(Singleton::class.java) bind().asSingleton() + bind().asSingleton() } @Provides @@ -44,11 +45,6 @@ class NotificationHandlerModule : AbstractModule() { @Provides @Singleton - fun getSoneLockedOnStartupHandler(notificationManager: NotificationManager, @Named("soneLockedOnStartup") notification: ListNotification) = - SoneLockedOnStartupHandler(notificationManager, notification) - - @Provides - @Singleton @Named("soneLockedOnStartup") fun getSoneLockedOnStartupNotification(loaders: Loaders) = ListNotification("sone-locked-on-startup", "sones", loaders.loadTemplate("/templates/notify/soneLockedOnStartupNotification.html")) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/notification/SoneLockedOnStartupHandler.kt b/src/main/kotlin/net/pterodactylus/sone/web/notification/SoneLockedOnStartupHandler.kt index aa3a417..c6de63f 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/SoneLockedOnStartupHandler.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/SoneLockedOnStartupHandler.kt @@ -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 [SoneLockedOnStartup][net.pterodactylus.sone.core.event.SoneLockedOnStartup] events * that adds the appropriate notification to the [NotificationManager]. */ -class SoneLockedOnStartupHandler(private val notificationManager: NotificationManager, private val notification: ListNotification) { +class SoneLockedOnStartupHandler @Inject constructor(private val notificationManager: NotificationManager, @Named("soneLockedOnStartup") private val notification: ListNotification) { @Subscribe @Suppress("UnstableApiUsage")