From f77867b98e3264bec4f0b0b2c3f6bcd7c83691f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 10 Dec 2019 16:48:37 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=90=9B=20Fix=20sone-locked-on-startup=20ha?= =?utf8?q?ndler?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../sone/web/notification/NotificationHandlerModule.kt | 6 +----- .../sone/web/notification/SoneLockedOnStartupHandler.kt | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) 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") -- 2.7.4