X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=0002e2c4c0631e759e60933a97f981a795fe8611;hb=5b6767cdd9eece7d2a08f52016b3e35340d1f22f;hp=f0a1fb66be111222d4b34f9249c36ec1dff7e57f;hpb=83e51753c5ddd721e9d0b5aeaf211653e564a5d9;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index f0a1fb6..0002e2c 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -37,6 +37,7 @@ import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.freenet.L10nFilter; import net.pterodactylus.sone.freenet.wot.Identity; import net.pterodactylus.sone.main.SonePlugin; +import net.pterodactylus.sone.notify.NewSoneNotification; import net.pterodactylus.sone.template.CollectionAccessor; import net.pterodactylus.sone.template.CssClassNameFilter; import net.pterodactylus.sone.template.GetPagePlugin; @@ -106,6 +107,9 @@ public class WebInterface implements CoreListener { /** The template factory. */ private DefaultTemplateFactory templateFactory; + /** The “new Sone” notification. */ + private final NewSoneNotification newSoneNotification; + /** * Creates a new web interface. * @@ -135,6 +139,10 @@ public class WebInterface implements CoreListener { templateFactory.addPlugin("paginate", new PaginationPlugin()); templateFactory.setTemplateProvider(new ClassPathTemplateProvider(templateFactory)); templateFactory.addTemplateObject("formPassword", formPassword); + + /* create notifications. */ + Template newSoneNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/newSoneNotification.html")); + newSoneNotification = new NewSoneNotification(newSoneNotificationTemplate); } // @@ -363,6 +371,33 @@ public class WebInterface implements CoreListener { } /** + * {@inheritDoc} + */ + @Override + public void markSoneKnown(Sone sone) { + newSoneNotification.removeSone(sone); + if (newSoneNotification.isEmpty()) { + newSoneNotification.dismiss(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void markPostKnown(Post post) { + /* TODO */ + } + + /** + * {@inheritDoc} + */ + @Override + public void markReplyKnown(Reply reply) { + /* TODO */ + } + + /** * Template provider implementation that uses * {@link WebInterface#createReader(String)} to load templates for * inclusion.