import net.pterodactylus.sone.freenet.L10nFilter;
import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.main.SonePlugin;
+import net.pterodactylus.sone.notify.NewPostNotification;
+import net.pterodactylus.sone.notify.NewReplyNotification;
import net.pterodactylus.sone.notify.NewSoneNotification;
import net.pterodactylus.sone.template.CollectionAccessor;
import net.pterodactylus.sone.template.CssClassNameFilter;
import net.pterodactylus.sone.web.ajax.DismissNotificationAjaxPage;
import net.pterodactylus.sone.web.ajax.FollowSoneAjaxPage;
import net.pterodactylus.sone.web.ajax.GetLikesAjaxPage;
+import net.pterodactylus.sone.web.ajax.GetNotificationsAjaxPage;
import net.pterodactylus.sone.web.ajax.GetReplyAjaxPage;
import net.pterodactylus.sone.web.ajax.GetSoneStatusPage;
import net.pterodactylus.sone.web.ajax.GetTranslationPage;
/** The “new Sone” notification. */
private final NewSoneNotification newSoneNotification;
+ /** The “new post” notification. */
+ private final NewPostNotification newPostNotification;
+
+ /** The “new reply” notification. */
+ private final NewReplyNotification newReplyNotification;
+
/**
* Creates a new web interface.
*
/* create notifications. */
Template newSoneNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/newSoneNotification.html"));
newSoneNotification = new NewSoneNotification(newSoneNotificationTemplate);
+
+ Template newPostNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/newPostNotification.html"));
+ newPostNotification = new NewPostNotification(newPostNotificationTemplate);
+
+ Template newReplyNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/newReplyNotification.html"));
+ newReplyNotification = new NewReplyNotification(newReplyNotificationTemplate);
}
//
/* notification templates. */
Template startupNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/startupNotification.html"));
- final TemplateNotification startupNotification = new TemplateNotification(startupNotificationTemplate);
+ final TemplateNotification startupNotification = new TemplateNotification("startup-notification", startupNotificationTemplate);
notificationManager.addNotification(startupNotification);
Ticker.getInstance().registerEvent(System.currentTimeMillis() + (120 * 1000), new Runnable() {
pageToadlets.add(pageToadletFactory.createPageToadlet(new StaticPage("javascript/", "/static/javascript/", "text/javascript")));
pageToadlets.add(pageToadletFactory.createPageToadlet(new StaticPage("images/", "/static/images/", "image/png")));
pageToadlets.add(pageToadletFactory.createPageToadlet(new GetTranslationPage(this)));
+ pageToadlets.add(pageToadletFactory.createPageToadlet(new GetNotificationsAjaxPage(this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new DismissNotificationAjaxPage(this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new GetSoneStatusPage(this)));
pageToadlets.add(pageToadletFactory.createPageToadlet(new CreateReplyAjaxPage(this)));
*/
@Override
public void newPostFound(Post post) {
- /* TODO */
+ newPostNotification.addPost(post);
+ notificationManager.addNotification(newPostNotification);
}
/**
*/
@Override
public void newReplyFound(Reply reply) {
- /* TODO */
+ if (reply.getPost().getSone() == null) {
+ return;
+ }
+ newReplyNotification.addReply(reply);
+ notificationManager.addNotification(newReplyNotification);
}
/**
*/
@Override
public void markPostKnown(Post post) {
- /* TODO */
+ newPostNotification.removePost(post);
+ if (newPostNotification.isEmpty()) {
+ newPostNotification.dismiss();
+ }
}
/**
*/
@Override
public void markReplyKnown(Reply reply) {
- /* TODO */
+ newReplyNotification.removeReply(reply);
+ if (newReplyNotification.isEmpty()) {
+ newReplyNotification.dismiss();
+ }
}
/**