X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fnotification%2FNotificationHandlerModule.kt;h=3728620d7b87023991c8dc4b67ffb5bbac1bd515;hb=6fd3d46cae8b06225c862a8b5d0a6aef35328e21;hp=8161cfda54f6266854c986c1e64b4ad23520db56;hpb=2a83103aab6254d877c1b5214ca5a3ef19a6fe83;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt index 8161cfd..3728620 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt @@ -23,6 +23,7 @@ import net.pterodactylus.sone.core.* import net.pterodactylus.sone.data.* import net.pterodactylus.sone.main.* import net.pterodactylus.sone.notify.* +import net.pterodactylus.util.notify.* import java.util.concurrent.Executors.* import java.util.function.* import javax.inject.* @@ -41,6 +42,8 @@ class NotificationHandlerModule : AbstractModule() { bind().asSingleton() bind().asSingleton() bind().asSingleton() + bind().asSingleton() + bind().asSingleton() } @Provides @@ -79,6 +82,30 @@ class NotificationHandlerModule : AbstractModule() { fun getLocalPostNotification(loaders: Loaders) = ListNotification("local-post-notification", "posts", loaders.loadTemplate("/templates/notify/newPostNotification.html"), dismissable = false) + @Provides + @Singleton + @Named("newVersion") + fun getNewVersionNotification(loaders: Loaders) = + TemplateNotification("new-version-notification", loaders.loadTemplate("/templates/notify/newVersionNotification.html")) + + @Provides + @Singleton + @Named("imageInserting") + fun getImageInsertingNotification(loaders: Loaders) = + ListNotification("inserting-images-notification", "images", loaders.loadTemplate("/templates/notify/inserting-images-notification.html"), dismissable = true) + + @Provides + @Singleton + @Named("imageFailed") + fun getImageInsertingFailedNotification(loaders: Loaders) = + ListNotification("image-insert-failed-notification", "images", loaders.loadTemplate("/templates/notify/image-insert-failed-notification.html"), dismissable = true) + + @Provides + @Singleton + @Named("imageInserted") + fun getImageInsertedNotification(loaders: Loaders) = + ListNotification("inserted-images-notification", "images", loaders.loadTemplate("/templates/notify/inserted-images-notification.html"), dismissable = true) + private inline fun bind(): AnnotatedBindingBuilder = bind(T::class.java) private fun ScopedBindingBuilder.asSingleton() = `in`(Singleton::class.java)