override fun configure() {
bind(NotificationHandler::class.java).`in`(Singleton::class.java)
bind<MarkPostKnownDuringFirstStartHandler>().asSingleton()
+ bind<SoneLockedOnStartupHandler>().asSingleton()
}
@Provides
@Provides
@Singleton
- fun getSoneLockedOnStartupHandler(notificationManager: NotificationManager, @Named("soneLockedOnStartup") notification: ListNotification<Sone>) =
- SoneLockedOnStartupHandler(notificationManager, notification)
-
- @Provides
- @Singleton
@Named("soneLockedOnStartup")
fun getSoneLockedOnStartupNotification(loaders: Loaders) =
ListNotification<Sone>("sone-locked-on-startup", "sones", loaders.loadTemplate("/templates/notify/soneLockedOnStartupNotification.html"))
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<Sone>) {
+class SoneLockedOnStartupHandler @Inject constructor(private val notificationManager: NotificationManager, @Named("soneLockedOnStartup") private val notification: ListNotification<Sone>) {
@Subscribe
@Suppress("UnstableApiUsage")