+ override fun configure() {
+ bind(NotificationHandler::class.java).`in`(Singleton::class.java)
+ bind<MarkPostKnownDuringFirstStartHandler>().asSingleton()
+ bind<MarkPostReplyKnownDuringFirstStartHandler>().asSingleton()
+ bind<SoneLockedOnStartupHandler>().asSingleton()
+ bind<NewSoneHandler>().asSingleton()
+ bind<NewRemotePostHandler>().asSingleton()
+ bind<RemotePostReplyHandler>().asSingleton()
+ bind<SoneLockedHandler>().asSingleton()
+ bind<LocalPostHandler>().asSingleton()
+ bind<LocalReplyHandler>().asSingleton()
+ bind<NewVersionHandler>().asSingleton()
+ bind<ImageInsertHandler>().asSingleton()
+ bind<FirstStartHandler>().asSingleton()
+ bind<ConfigNotReadHandler>().asSingleton()
+ bind<StartupHandler>().asSingleton()
+ bind<WebOfTrustHandler>().asSingleton()
+ bind<SoneMentionDetector>().asSingleton()
+ bind<SoneMentionedHandler>().asSingleton()
+ bind<SoneInsertHandler>().asSingleton()
+ }
+
+ @Provides
+ fun getMarkPostKnownHandler(core: Core): Consumer<Post> = Consumer { core.markPostKnown(it) }
+
+ @Provides
+ fun getMarkPostReplyKnownHandler(core: Core): Consumer<PostReply> = Consumer { core.markReplyKnown(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("newRemotePostReply")
+ fun getNewRemotePostReplyNotification(loaders: Loaders) =
+ ListNotification<PostReply>("new-reply-notification", "replies", loaders.loadTemplate("/templates/notify/newReplyNotification.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
+ @Singleton
+ @Named("localPost")
+ fun getLocalPostNotification(loaders: Loaders) =
+ ListNotification<Post>("local-post-notification", "posts", loaders.loadTemplate("/templates/notify/newPostNotification.html"), dismissable = false)
+
+ @Provides
+ @Singleton
+ @Named("localReply")
+ fun getLocalReplyNotification(loaders: Loaders) =
+ ListNotification<PostReply>("local-reply-notification", "replies", loaders.loadTemplate("/templates/notify/newReplyNotification.html"), dismissable = false)
+
+ @Provides
+ @Singleton
+ @Named("newVersion")
+ fun getNewVersionNotification(loaders: Loaders) =
+ TemplateNotification("new-version-notification", loaders.loadTemplate("/templates/notify/newVersionNotification.html"))
+