+ override fun configure() {
+ bind(NotificationHandler::class.java).`in`(Singleton::class.java)
+ bind<MarkPostKnownDuringFirstStartHandler>().asSingleton()
+ bind<SoneLockedOnStartupHandler>().asSingleton()
+ bind<NewSoneHandler>().asSingleton()
+ bind<NewRemotePostHandler>().asSingleton()
+ bind<SoneLockedHandler>().asSingleton()
+ bind<LocalPostHandler>().asSingleton()
+ bind<NewVersionHandler>().asSingleton()
+ }
+
+ @Provides
+ fun getMarkPostKnownHandler(core: Core): Consumer<Post> = Consumer { core.markPostKnown(it) }
+
+ @Provides
+ @Singleton
+ @Named("soneLockedOnStartup")
+ fun getSoneLockedOnStartupNotification(loaders: Loaders) =
+ ListNotification<Sone>("sone-locked-on-startup", "sones", loaders.loadTemplate("/templates/notify/soneLockedOnStartupNotification.html"))
+
+ @Provides
+ @Named("newSone")
+ fun getNewSoneNotification(loaders: Loaders) =
+ ListNotification<Sone>("new-sone-notification", "sones", loaders.loadTemplate("/templates/notify/newSoneNotification.html"), dismissable = false)
+
+ @Provides
+ @Singleton
+ @Named("newRemotePost")
+ fun getNewPostNotification(loaders: Loaders) =
+ ListNotification<Post>("new-post-notification", "posts", loaders.loadTemplate("/templates/notify/newPostNotification.html"), dismissable = false)
+
+ @Provides
+ @Singleton
+ @Named("soneLocked")
+ fun getSoneLockedNotification(loaders: Loaders) =
+ ListNotification<Sone>("sones-locked-notification", "sones", loaders.loadTemplate("/templates/notify/lockedSonesNotification.html"), dismissable = true)
+
+ @Provides
+ fun getScheduledExecutorService() =
+ newScheduledThreadPool(1)
+
+ @Provides
+ @Singleton
+ @Named("localPost")
+ fun getLocalPostNotification(loaders: Loaders) =
+ ListNotification<Post>("local-post-notification", "posts", loaders.loadTemplate("/templates/notify/newPostNotification.html"), dismissable = false)
+