From d233a386e5e8417e500265f57a3911053f813923 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 16 Nov 2010 05:53:46 +0100 Subject: [PATCH] Use a notification! --- .../java/net/pterodactylus/sone/web/WebInterface.java | 17 +++++++++++++++++ .../templates/notify/wotMissingNotification.html | 4 ++++ 2 files changed, 21 insertions(+) create mode 100644 src/main/resources/templates/notify/wotMissingNotification.html diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index a74c125..f68fec2 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -237,6 +237,23 @@ public class WebInterface implements CoreListener { startupNotification.dismiss(); } }, "Sone Startup Notification Remover"); + + Template wotMissingNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/wotMissingNotification.html")); + final TemplateNotification wotMissingNotification = new TemplateNotification("wot-missing-notification", wotMissingNotificationTemplate); + Ticker.getInstance().registerEvent(System.currentTimeMillis() + (15 * 1000), new Runnable() { + + @Override + @SuppressWarnings("synthetic-access") + public void run() { + if (getCore().getIdentityManager().isConnected()) { + wotMissingNotification.dismiss(); + } else { + notificationManager.addNotification(wotMissingNotification); + } + Ticker.getInstance().registerEvent(System.currentTimeMillis() + (15 * 1000), this, "Sone WoT Connector Checker"); + } + + }, "Sone WoT Connector Checker"); } /** diff --git a/src/main/resources/templates/notify/wotMissingNotification.html b/src/main/resources/templates/notify/wotMissingNotification.html new file mode 100644 index 0000000..02fc451 --- /dev/null +++ b/src/main/resources/templates/notify/wotMissingNotification.html @@ -0,0 +1,4 @@ +
+ <%= Page.WotPluginMissing.Text.WotRequired|l10n|html> + <%= Page.WotPluginMissing.Text.LoadPlugin|l10n|html|replace needle="{link}" replacement=''|replace needle="{/link}" replacement=''> +
-- 2.7.4