/* create a configuration. */
Configuration oldConfiguration;
Configuration newConfiguration = null;
+ boolean firstStart = !new File("sone.properties").exists();
try {
oldConfiguration = new Configuration(new MapConfigurationBackend(new File("sone.properties"), false));
newConfiguration = oldConfiguration;
/* create the web interface. */
webInterface = new WebInterface(this);
+ webInterface.setFirstStart(firstStart);
core.addCoreListener(webInterface);
/* create the identity manager. */
import net.pterodactylus.sone.web.page.PageToadletFactory;
import net.pterodactylus.sone.web.page.StaticPage;
import net.pterodactylus.util.logging.Logging;
+import net.pterodactylus.util.notify.Notification;
import net.pterodactylus.util.notify.NotificationManager;
import net.pterodactylus.util.notify.TemplateNotification;
import net.pterodactylus.util.template.DateFilter;
return new HashSet<Reply>(newReplyNotification.getElements());
}
+ /**
+ * Sets whether the current start of the plugin is the first start. It is
+ * considered a first start if the configuration file does not exist.
+ *
+ * @param firstStart
+ * {@code true} if no configuration file existed when Sone was
+ * loaded, {@code false} otherwise
+ */
+ public void setFirstStart(boolean firstStart) {
+ if (firstStart) {
+ Template firstStartNotificationTemplate = new Template(createReader("/templates/notify/firstStartNotification.html"));
+ Notification firstStartNotification = new TemplateNotification("first-start-notification", firstStartNotificationTemplate);
+ notificationManager.addNotification(firstStartNotification);
+ }
+ }
+
//
// ACTIONS
//
WebInterface.SelectBox.No=No
WebInterface.ClickToShow.Replies=Click here to show hidden replies.
+Notification.FirstStart.Text=This seems to be the first time you start Sone. To start, create a new Sone from a web of trust identity and start following other Sones.
Notification.Startup.Text=Sone is currently starting up. It may take a while to retrieve all identities and Sones from the web of trust. If you are missing some elements, please be patient, they will probably reappear very soon.
Notification.Button.Dismiss=Dismiss
Notification.NewSone.Text=New Sones have been discovered:
--- /dev/null
+<div class="text"><%= Notification.FirstStart.Text|l10n|html></div>