import net.pterodactylus.sone.data.*
import net.pterodactylus.sone.notify.*
import net.pterodactylus.util.notify.*
+import javax.inject.*
/**
* Handler for [NewPostFoundEvent]s that adds the new post to the “new posts” notification and
* displays the notification if the “first start” notification is not being shown.
*/
-class NewRemotePostHandler(private val notificationManager: NotificationManager, private val notification: ListNotification<Post>) {
+class NewRemotePostHandler @Inject constructor(private val notificationManager: NotificationManager, @Named("newRemotePost") private val notification: ListNotification<Post>) {
@Subscribe
fun newPostFound(newPostFoundEvent: NewPostFoundEvent) {
bind<MarkPostKnownDuringFirstStartHandler>().asSingleton()
bind<SoneLockedOnStartupHandler>().asSingleton()
bind<NewSoneHandler>().asSingleton()
+ bind<NewRemotePostHandler>().asSingleton()
}
@Provides
@Provides
@Singleton
- fun getNewRemotePostHandler(notificationManager: NotificationManager, @Named("newRemotePost") newPostNotification: ListNotification<Post>) =
- NewRemotePostHandler(notificationManager, newPostNotification)
-
- @Provides
- @Singleton
@Named("newRemotePost")
fun getNewPostNotification(loaders: Loaders) =
ListNotification<Post>("new-post-notification", "posts", loaders.loadTemplate("/templates/notify/newPostNotification.html"), dismissable = false)