X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=441e32336c899397c49a77301c86aaf1cd7e8471;hb=c26c8d115cd895ac1c187552ac46350a501c250a;hp=db1880bb6aed1b15942a6a8a71bef6485891c212;hpb=2a9b6883dfa5a8e2d13c1ab0fbe8b30c609bf9e9;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 db1880b..441e323 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -119,6 +119,12 @@ public class WebInterface implements CoreListener { /** The “new reply” notification. */ private final ListNotification newReplyNotification; + /** The “rescuing Sone” notification. */ + private final ListNotification rescuingSonesNotification; + + /** The “Sone rescued” notification. */ + private final ListNotification sonesRescuedNotification; + /** * Creates a new web interface. * @@ -158,6 +164,12 @@ public class WebInterface implements CoreListener { Template newReplyNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/newReplyNotification.html")); newReplyNotification = new ListNotification("new-replies-notification", "replies", newReplyNotificationTemplate); + + Template rescuingSonesTemplate = templateFactory.createTemplate(createReader("/templates/notify/rescuingSonesNotification.html")); + rescuingSonesNotification = new ListNotification("sones-being-rescued-notification", "sones", rescuingSonesTemplate); + + Template sonesRescuedTemplate = templateFactory.createTemplate(createReader("/templates/notify/sonesRescuedNotification.html")); + sonesRescuedNotification = new ListNotification("sones-rescued-notification", "sones", sonesRescuedTemplate); } // @@ -387,6 +399,25 @@ public class WebInterface implements CoreListener { * {@inheritDoc} */ @Override + public void rescuingSone(Sone sone) { + rescuingSonesNotification.add(sone); + notificationManager.addNotification(rescuingSonesNotification); + } + + /** + * {@inheritDoc} + */ + @Override + public void rescuedSone(Sone sone) { + rescuingSonesNotification.remove(sone); + sonesRescuedNotification.add(sone); + notificationManager.addNotification(sonesRescuedNotification); + } + + /** + * {@inheritDoc} + */ + @Override public void newSoneFound(Sone sone) { newSoneNotification.add(sone); notificationManager.addNotification(newSoneNotification); @@ -419,9 +450,6 @@ public class WebInterface implements CoreListener { @Override public void markSoneKnown(Sone sone) { newSoneNotification.remove(sone); - if (newSoneNotification.isEmpty()) { - newSoneNotification.dismiss(); - } } /** @@ -430,9 +458,6 @@ public class WebInterface implements CoreListener { @Override public void markPostKnown(Post post) { newPostNotification.remove(post); - if (newPostNotification.isEmpty()) { - newPostNotification.dismiss(); - } } /** @@ -441,9 +466,6 @@ public class WebInterface implements CoreListener { @Override public void markReplyKnown(Reply reply) { newReplyNotification.remove(reply); - if (newReplyNotification.isEmpty()) { - newReplyNotification.dismiss(); - } } /**