Change Notifier to be injectable service

Move notify methods to Notifier and change it to be injectable Guice
service.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2017-12-24 03:04:29 +01:00
parent 82d277a8a5
commit 82ee4a0036
6 changed files with 121 additions and 46 deletions

View File

@@ -34,7 +34,6 @@ import java.awt.AWTException;
import java.awt.Frame;
import java.awt.Image;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@@ -118,7 +117,7 @@ public class RuneLite
private AccountSession accountSession;
private Notifier notifier;
Notifier notifier;
static
{
@@ -186,7 +185,7 @@ public class RuneLite
eventBus.register(chatMessageManager);
// Setup the notifier
notifier = new Notifier(trayIcon);
notifier = new Notifier(properties.getTitle(), trayIcon);
// Load the plugins, but does not start them yet.
// This will initialize configuration
@@ -409,17 +408,6 @@ public class RuneLite
return trayIcon;
}
public void notify(String message)
{
notify(message, TrayIcon.MessageType.NONE);
}
public void notify(String message, TrayIcon.MessageType type)
{
notifier.sendNotification(properties.getTitle(), message, type, null);
Toolkit.getDefaultToolkit().beep();
}
public AccountSession getAccountSession()
{
return accountSession;