X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fnotification%2FNotificationHandlerModule.kt;h=7918758f0ce7158969db1ad7c4dc02164918d125;hb=6d770b3aa761b4432517b4789a980c4ba75ed9fa;hp=a9e4ae8b67e943077b0ec3a0cda21cd70f31b8f5;hpb=f77867b98e3264bec4f0b0b2c3f6bcd7c83691f8;p=Sone.git 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..7918758 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt @@ -23,7 +23,6 @@ import net.pterodactylus.sone.core.* import net.pterodactylus.sone.data.* import net.pterodactylus.sone.main.* import net.pterodactylus.sone.notify.* -import net.pterodactylus.util.notify.* import java.util.concurrent.Executors.* import java.util.function.* import javax.inject.* @@ -38,6 +37,9 @@ class NotificationHandlerModule : AbstractModule() { bind(NotificationHandler::class.java).`in`(Singleton::class.java) bind().asSingleton() bind().asSingleton() + bind().asSingleton() + bind().asSingleton() + bind().asSingleton() } @Provides @@ -50,22 +52,12 @@ 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) @Provides @Singleton - fun getNewRemotePostHandler(notificationManager: NotificationManager, @Named("newRemotePost") newPostNotification: ListNotification) = - NewRemotePostHandler(notificationManager, newPostNotification) - - @Provides - @Singleton @Named("newRemotePost") fun getNewPostNotification(loaders: Loaders) = ListNotification("new-post-notification", "posts", loaders.loadTemplate("/templates/notify/newPostNotification.html"), dismissable = false) @@ -77,9 +69,8 @@ class NotificationHandlerModule : AbstractModule() { ListNotification("sones-locked-notification", "sones", loaders.loadTemplate("/templates/notify/lockedSonesNotification.html"), dismissable = true) @Provides - @Singleton - fun getSoneLockedHandler(notificationManager: NotificationManager, @Named("soneLocked") soneLockedNotification: ListNotification) = - SoneLockedHandler(notificationManager, soneLockedNotification, newScheduledThreadPool(1)) + fun getScheduledExecutorService() = + newScheduledThreadPool(1) private inline fun bind(): AnnotatedBindingBuilder = bind(T::class.java) private fun ScopedBindingBuilder.asSingleton() = `in`(Singleton::class.java)