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<Sone>) {
+class NewSoneHandler @Inject constructor(private val notificationManager: NotificationManager, @Named("newSone") private val notification: ListNotification<Sone>) {
@Subscribe
fun newSoneFound(newSoneFoundEvent: NewSoneFoundEvent) {
bind(NotificationHandler::class.java).`in`(Singleton::class.java)
bind<MarkPostKnownDuringFirstStartHandler>().asSingleton()
bind<SoneLockedOnStartupHandler>().asSingleton()
+ bind<NewSoneHandler>().asSingleton()
}
@Provides
ListNotification<Sone>("sone-locked-on-startup", "sones", loaders.loadTemplate("/templates/notify/soneLockedOnStartupNotification.html"))
@Provides
- @Singleton
- fun getNewSoneHandler(notificationManager: NotificationManager, @Named("newSone") notification: ListNotification<Sone>) =
- NewSoneHandler(notificationManager, notification)
-
- @Provides
@Named("newSone")
fun getNewSoneNotification(loaders: Loaders) =
ListNotification<Sone>("new-sone-notification", "sones", loaders.loadTemplate("/templates/notify/newSoneNotification.html"), dismissable = false)