client: bind runelite.properties to guice
This commit is contained in:
@@ -45,6 +45,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
@@ -101,8 +102,6 @@ public class Notifier
|
||||
private static final int MINIMUM_FLASH_DURATION_MILLIS = 2000;
|
||||
private static final int MINIMUM_FLASH_DURATION_TICKS = MINIMUM_FLASH_DURATION_MILLIS / Constants.CLIENT_TICK_LENGTH;
|
||||
|
||||
private static final String appName = RuneLiteProperties.getTitle();
|
||||
|
||||
private static final File NOTIFICATION_FILE = new File(RuneLite.RUNELITE_DIR, "notification.wav");
|
||||
private static final long CLIP_MTIME_UNLOADED = -2;
|
||||
private static final long CLIP_MTIME_BUILTIN = -1;
|
||||
@@ -113,6 +112,7 @@ public class Notifier
|
||||
private final ScheduledExecutorService executorService;
|
||||
private final ChatMessageManager chatMessageManager;
|
||||
private final EventBus eventBus;
|
||||
private final String appName;
|
||||
private final Path notifyIconPath;
|
||||
private boolean terminalNotifierAvailable;
|
||||
private Instant flashStart;
|
||||
@@ -127,7 +127,9 @@ public class Notifier
|
||||
final RuneLiteConfig runeliteConfig,
|
||||
final ScheduledExecutorService executorService,
|
||||
final ChatMessageManager chatMessageManager,
|
||||
final EventBus eventBus)
|
||||
final EventBus eventBus,
|
||||
@Named("runelite.title") final String appName
|
||||
)
|
||||
{
|
||||
this.client = client;
|
||||
this.clientUI = clientUI;
|
||||
@@ -135,6 +137,7 @@ public class Notifier
|
||||
this.executorService = executorService;
|
||||
this.chatMessageManager = chatMessageManager;
|
||||
this.eventBus = eventBus;
|
||||
this.appName = appName;
|
||||
this.notifyIconPath = RuneLite.RUNELITE_DIR.toPath().resolve("icon.png");
|
||||
|
||||
// First check if we are running in launcher
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.google.inject.Provides;
|
||||
import com.google.inject.name.Names;
|
||||
import java.applet.Applet;
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.function.Supplier;
|
||||
@@ -66,6 +67,12 @@ public class RuneLiteModule extends AbstractModule
|
||||
@Override
|
||||
protected void configure()
|
||||
{
|
||||
Properties properties = RuneLiteProperties.getProperties();
|
||||
for (String key : properties.stringPropertyNames())
|
||||
{
|
||||
String value = properties.getProperty(key);
|
||||
bindConstant().annotatedWith(Names.named(key)).to(value);
|
||||
}
|
||||
bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode);
|
||||
bindConstant().annotatedWith(Names.named("safeMode")).to(safeMode);
|
||||
bind(File.class).annotatedWith(Names.named("sessionfile")).toInstance(sessionfile);
|
||||
|
||||
@@ -28,18 +28,14 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
public class RuneLiteProperties
|
||||
{
|
||||
private static final String RUNELITE_TITLE = "runelite.title";
|
||||
private static final String RUNELITE_VERSION = "runelite.version";
|
||||
private static final String RUNESCAPE_VERSION = "runescape.version";
|
||||
private static final String DISCORD_APP_ID = "runelite.discord.appid";
|
||||
private static final String DISCORD_INVITE = "runelite.discord.invite";
|
||||
private static final String GITHUB_LINK = "runelite.github.link";
|
||||
private static final String WIKI_LINK = "runelite.wiki.link";
|
||||
private static final String PATREON_LINK = "runelite.patreon.link";
|
||||
private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version";
|
||||
private static final String INSECURE_SKIP_TLS_VERIFICATION_PROPERTY = "runelite.insecure-skip-tls-verification";
|
||||
private static final String TROUBLESHOOTING_LINK = "runelite.wiki.troubleshooting.link";
|
||||
@@ -49,8 +45,8 @@ public class RuneLiteProperties
|
||||
private static final String JAV_CONFIG_BACKUP = "runelite.jav_config_backup";
|
||||
private static final String PLUGINHUB_BASE = "runelite.pluginhub.url";
|
||||
private static final String PLUGINHUB_VERSION = "runelite.pluginhub.version";
|
||||
private static final String IMGUR_CLIENT_ID = "runelite.imgur.client.id";
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private static final Properties properties = new Properties();
|
||||
|
||||
static
|
||||
@@ -65,46 +61,16 @@ public class RuneLiteProperties
|
||||
}
|
||||
}
|
||||
|
||||
public static String getTitle()
|
||||
{
|
||||
return properties.getProperty(RUNELITE_TITLE);
|
||||
}
|
||||
|
||||
public static String getVersion()
|
||||
{
|
||||
return properties.getProperty(RUNELITE_VERSION);
|
||||
}
|
||||
|
||||
public static String getRunescapeVersion()
|
||||
{
|
||||
return properties.getProperty(RUNESCAPE_VERSION);
|
||||
}
|
||||
|
||||
public static String getDiscordAppId()
|
||||
{
|
||||
return properties.getProperty(DISCORD_APP_ID);
|
||||
}
|
||||
|
||||
public static String getDiscordInvite()
|
||||
{
|
||||
return properties.getProperty(DISCORD_INVITE);
|
||||
}
|
||||
|
||||
public static String getGithubLink()
|
||||
{
|
||||
return properties.getProperty(GITHUB_LINK);
|
||||
}
|
||||
|
||||
public static String getWikiLink()
|
||||
{
|
||||
return properties.getProperty(WIKI_LINK);
|
||||
}
|
||||
|
||||
public static String getPatreonLink()
|
||||
{
|
||||
return properties.getProperty(PATREON_LINK);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getLauncherVersion()
|
||||
{
|
||||
@@ -146,9 +112,4 @@ public class RuneLiteProperties
|
||||
String version = System.getProperty(PLUGINHUB_VERSION, properties.getProperty(PLUGINHUB_VERSION));
|
||||
return HttpUrl.parse(properties.get(PLUGINHUB_BASE) + "/" + version);
|
||||
}
|
||||
|
||||
public static String getImgurClientId()
|
||||
{
|
||||
return properties.getProperty(IMGUR_CLIENT_ID);
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,10 @@ import com.google.common.base.Strings;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.discord.events.DiscordDisconnected;
|
||||
import net.runelite.client.discord.events.DiscordErrored;
|
||||
import net.runelite.client.discord.events.DiscordJoinGame;
|
||||
@@ -50,6 +50,7 @@ public class DiscordService implements AutoCloseable
|
||||
{
|
||||
private final EventBus eventBus;
|
||||
private final ScheduledExecutorService executorService;
|
||||
private final String discordAppId;
|
||||
private final DiscordRPC discordRPC;
|
||||
|
||||
// Hold a reference to the event handlers to prevent the garbage collector from deleting them
|
||||
@@ -61,11 +62,14 @@ public class DiscordService implements AutoCloseable
|
||||
@Inject
|
||||
private DiscordService(
|
||||
final EventBus eventBus,
|
||||
final ScheduledExecutorService executorService)
|
||||
final ScheduledExecutorService executorService,
|
||||
@Named("runelite.discord.appid") final String discordAppId
|
||||
)
|
||||
{
|
||||
|
||||
this.eventBus = eventBus;
|
||||
this.executorService = executorService;
|
||||
this.discordAppId = discordAppId;
|
||||
|
||||
DiscordRPC discordRPC = null;
|
||||
DiscordEventHandlers discordEventHandlers = null;
|
||||
@@ -103,7 +107,7 @@ public class DiscordService implements AutoCloseable
|
||||
discordEventHandlers.joinGame = this::joinGame;
|
||||
discordEventHandlers.spectateGame = this::spectateGame;
|
||||
discordEventHandlers.joinRequest = this::joinRequest;
|
||||
discordRPC.Discord_Initialize(RuneLiteProperties.getDiscordAppId(), discordEventHandlers, true, null);
|
||||
discordRPC.Discord_Initialize(discordAppId, discordEventHandlers, true, null);
|
||||
executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.chat.ChatColorType;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -70,6 +70,10 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
@Inject
|
||||
private Notifier notifier;
|
||||
|
||||
@Inject
|
||||
@Named("runelite.title")
|
||||
private String runeliteTitle;
|
||||
|
||||
//Custom Highlights
|
||||
private Pattern usernameMatcher = null;
|
||||
private String usernameReplacer = "";
|
||||
@@ -163,7 +167,7 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
break;
|
||||
case CONSOLE:
|
||||
// Don't notify for notification messages
|
||||
if (chatMessage.getName().equals(RuneLiteProperties.getTitle()))
|
||||
if (chatMessage.getName().equals(runeliteTitle))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Named;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
@@ -46,7 +47,6 @@ import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.StatChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.discord.DiscordService;
|
||||
import net.runelite.client.discord.events.DiscordJoinGame;
|
||||
@@ -106,6 +106,10 @@ public class DiscordPlugin extends Plugin
|
||||
@Inject
|
||||
private OkHttpClient okHttpClient;
|
||||
|
||||
@Inject
|
||||
@Named("runelite.discord.invite")
|
||||
private String discordInvite;
|
||||
|
||||
private final Map<Skill, Integer> skillExp = new HashMap<>();
|
||||
private NavigationButton discordButton;
|
||||
private boolean loginFlag;
|
||||
@@ -125,7 +129,7 @@ public class DiscordPlugin extends Plugin
|
||||
.tab(false)
|
||||
.tooltip("Join Discord")
|
||||
.icon(icon)
|
||||
.onClick(() -> LinkBrowser.browse(RuneLiteProperties.getDiscordInvite()))
|
||||
.onClick(() -> LinkBrowser.browse(discordInvite))
|
||||
.build();
|
||||
|
||||
clientToolbar.addNavigation(discordButton);
|
||||
|
||||
@@ -35,8 +35,8 @@ import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import lombok.Data;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.discord.DiscordPresence;
|
||||
import net.runelite.client.discord.DiscordService;
|
||||
import net.runelite.client.ws.PartyService;
|
||||
@@ -60,14 +60,24 @@ class DiscordState
|
||||
private final DiscordService discordService;
|
||||
private final DiscordConfig config;
|
||||
private final PartyService party;
|
||||
private final String runeliteTitle;
|
||||
private final String runeliteVersion;
|
||||
private DiscordPresence lastPresence;
|
||||
|
||||
@Inject
|
||||
private DiscordState(final DiscordService discordService, final DiscordConfig config, final PartyService party)
|
||||
private DiscordState(
|
||||
final DiscordService discordService,
|
||||
final DiscordConfig config,
|
||||
final PartyService party,
|
||||
@Named("runelite.title") final String runeliteTitle,
|
||||
@Named("runelite.version") final String runeliteVersion
|
||||
)
|
||||
{
|
||||
this.discordService = discordService;
|
||||
this.config = config;
|
||||
this.party = party;
|
||||
this.runeliteTitle = runeliteTitle;
|
||||
this.runeliteVersion = runeliteVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,12 +198,12 @@ class DiscordState
|
||||
}
|
||||
|
||||
// Replace snapshot with + to make tooltip shorter (so it will span only 1 line)
|
||||
final String versionShortHand = RuneLiteProperties.getVersion().replace("-SNAPSHOT", "+");
|
||||
final String versionShortHand = runeliteVersion.replace("-SNAPSHOT", "+");
|
||||
|
||||
final DiscordPresence.DiscordPresenceBuilder presenceBuilder = DiscordPresence.builder()
|
||||
.state(MoreObjects.firstNonNull(state, ""))
|
||||
.details(MoreObjects.firstNonNull(details, ""))
|
||||
.largeImageText(RuneLiteProperties.getTitle() + " v" + versionShortHand)
|
||||
.largeImageText(runeliteTitle + " v" + versionShortHand)
|
||||
.smallImageKey(imageKey)
|
||||
.partyMax(PARTY_MAX)
|
||||
.partySize(party.getMembers().size());
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.ImageIcon;
|
||||
@@ -91,6 +92,26 @@ public class InfoPanel extends PluginPanel
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
@Named("runelite.version")
|
||||
private String runeliteVersion;
|
||||
|
||||
@Inject
|
||||
@Named("runelite.github.link")
|
||||
private String githubLink;
|
||||
|
||||
@Inject
|
||||
@Named("runelite.discord.invite")
|
||||
private String discordInvite;
|
||||
|
||||
@Inject
|
||||
@Named("runelite.patreon.link")
|
||||
private String patreonLink;
|
||||
|
||||
@Inject
|
||||
@Named("runelite.wiki.link")
|
||||
private String wikiLink;
|
||||
|
||||
static
|
||||
{
|
||||
ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(InfoPanel.class, "/util/arrow_right.png"));
|
||||
@@ -114,7 +135,7 @@ public class InfoPanel extends PluginPanel
|
||||
|
||||
final Font smallFont = FontManager.getRunescapeSmallFont();
|
||||
|
||||
JLabel version = new JLabel(htmlLabel("RuneLite version: ", RuneLiteProperties.getVersion()));
|
||||
JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeliteVersion));
|
||||
version.setFont(smallFont);
|
||||
|
||||
JLabel revision = new JLabel();
|
||||
@@ -173,10 +194,10 @@ public class InfoPanel extends PluginPanel
|
||||
}
|
||||
});
|
||||
|
||||
actionsContainer.add(buildLinkPanel(GITHUB_ICON, "Report an issue or", "make a suggestion", RuneLiteProperties.getGithubLink()));
|
||||
actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "Discord server", RuneLiteProperties.getDiscordInvite()));
|
||||
actionsContainer.add(buildLinkPanel(PATREON_ICON, "Become a patron to", "help support RuneLite", RuneLiteProperties.getPatreonLink()));
|
||||
actionsContainer.add(buildLinkPanel(WIKI_ICON, "Information about", "RuneLite and plugins", RuneLiteProperties.getWikiLink()));
|
||||
actionsContainer.add(buildLinkPanel(GITHUB_ICON, "Report an issue or", "make a suggestion", githubLink));
|
||||
actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "Discord server", discordInvite));
|
||||
actionsContainer.add(buildLinkPanel(PATREON_ICON, "Become a patron to", "help support RuneLite", patreonLink));
|
||||
actionsContainer.add(buildLinkPanel(WIKI_ICON, "Information about", "RuneLite and plugins", wikiLink));
|
||||
|
||||
add(versionPanel, BorderLayout.NORTH);
|
||||
add(actionsContainer, BorderLayout.CENTER);
|
||||
|
||||
@@ -71,7 +71,6 @@ import net.runelite.api.Point;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.ExpandResizeType;
|
||||
@@ -122,6 +121,7 @@ public class ClientUI
|
||||
private final Provider<ClientThread> clientThreadProvider;
|
||||
private final EventBus eventBus;
|
||||
private final boolean safeMode;
|
||||
private final String title;
|
||||
|
||||
private final CardLayout cardLayout = new CardLayout();
|
||||
private final Rectangle sidebarButtonPosition = new Rectangle();
|
||||
@@ -151,7 +151,9 @@ public class ClientUI
|
||||
ConfigManager configManager,
|
||||
Provider<ClientThread> clientThreadProvider,
|
||||
EventBus eventBus,
|
||||
@Named("safeMode") boolean safeMode)
|
||||
@Named("safeMode") boolean safeMode,
|
||||
@Named("runelite.title") String title
|
||||
)
|
||||
{
|
||||
this.config = config;
|
||||
this.keyManager = keyManager;
|
||||
@@ -161,6 +163,7 @@ public class ClientUI
|
||||
this.clientThreadProvider = clientThreadProvider;
|
||||
this.eventBus = eventBus;
|
||||
this.safeMode = safeMode;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -293,7 +296,7 @@ public class ClientUI
|
||||
return false;
|
||||
}
|
||||
|
||||
frame.setTitle(RuneLiteProperties.getTitle() + " - " + name);
|
||||
frame.setTitle(title + " - " + name);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -320,7 +323,7 @@ public class ClientUI
|
||||
// Try to enable fullscreen on OSX
|
||||
OSXUtil.tryEnableFullscreen(frame);
|
||||
|
||||
frame.setTitle(RuneLiteProperties.getTitle());
|
||||
frame.setTitle(title);
|
||||
frame.setIconImage(ICON);
|
||||
frame.getLayeredPane().setCursor(Cursor.getDefaultCursor()); // Prevent substance from using a resize cursor for pointing
|
||||
frame.setLocationRelativeTo(frame.getOwner());
|
||||
@@ -506,7 +509,7 @@ public class ClientUI
|
||||
frame.revalidateMinimumSize();
|
||||
|
||||
// Create tray icon (needs to be created after frame is packed)
|
||||
trayIcon = SwingUtil.createTrayIcon(ICON, RuneLiteProperties.getTitle(), frame);
|
||||
trayIcon = SwingUtil.createTrayIcon(ICON, title, frame);
|
||||
|
||||
// Move frame around (needs to be done after frame is packed)
|
||||
if (config.rememberScreenBounds() && !safeMode)
|
||||
@@ -1033,12 +1036,12 @@ public class ClientUI
|
||||
|
||||
if (player != null && player.getName() != null)
|
||||
{
|
||||
frame.setTitle(RuneLiteProperties.getTitle() + " - " + player.getName());
|
||||
frame.setTitle(title + " - " + player.getName());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
frame.setTitle(RuneLiteProperties.getTitle());
|
||||
frame.setTitle(title);
|
||||
}
|
||||
|
||||
if (frame.isAlwaysOnTopSupported())
|
||||
|
||||
@@ -45,6 +45,7 @@ import java.util.EnumSet;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -53,7 +54,6 @@ import net.runelite.api.GameState;
|
||||
import net.runelite.api.WorldType;
|
||||
import net.runelite.client.Notifier;
|
||||
import static net.runelite.client.RuneLite.SCREENSHOT_DIR;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
@@ -72,14 +72,24 @@ public class ImageCapture
|
||||
private static final HttpUrl IMGUR_IMAGE_UPLOAD_URL = HttpUrl.parse("https://api.imgur.com/3/image");
|
||||
private static final MediaType JSON = MediaType.parse("application/json");
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
private final Client client;
|
||||
private final Notifier notifier;
|
||||
private final OkHttpClient okHttpClient;
|
||||
private final String imgurClientId;
|
||||
|
||||
@Inject
|
||||
private Notifier notifier;
|
||||
|
||||
@Inject
|
||||
private OkHttpClient okHttpClient;
|
||||
private ImageCapture(
|
||||
final Client client,
|
||||
final Notifier notifier,
|
||||
final OkHttpClient okHttpClient,
|
||||
@Named("runelite.imgur.client.id") final String imgurClientId
|
||||
)
|
||||
{
|
||||
this.client = client;
|
||||
this.notifier = notifier;
|
||||
this.okHttpClient = okHttpClient;
|
||||
this.imgurClientId = imgurClientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a screenshot of the client window to the screenshot folder as a PNG,
|
||||
@@ -198,7 +208,7 @@ public class ImageCapture
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(IMGUR_IMAGE_UPLOAD_URL)
|
||||
.addHeader("Authorization", "Client-ID " + RuneLiteProperties.getImgurClientId())
|
||||
.addHeader("Authorization", "Client-ID " + imgurClientId)
|
||||
.post(RequestBody.create(JSON, json))
|
||||
.build();
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
runelite.title=RuneLite
|
||||
runelite.version=${project.version}
|
||||
runescape.version=${rs.version}
|
||||
runelite.discord.appid=409416265891971072
|
||||
runelite.discord.invite=https://discord.gg/R4BQ8tU
|
||||
runelite.github.link=https://github.com/runelite
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MessageNode;
|
||||
@@ -67,6 +68,10 @@ public class ChatNotificationsPluginTest
|
||||
@Bind
|
||||
private Notifier notifier;
|
||||
|
||||
@Bind
|
||||
@Named("runelite.title")
|
||||
private String runeliteTitle = "RuneLite";
|
||||
|
||||
@Inject
|
||||
private ChatNotificationsPlugin chatNotificationsPlugin;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.discord.DiscordPresence;
|
||||
import net.runelite.client.discord.DiscordService;
|
||||
@@ -70,6 +71,14 @@ public class DiscordStateTest
|
||||
@Bind
|
||||
PartyService partyService;
|
||||
|
||||
@Bind
|
||||
@Named("runelite.title")
|
||||
private String runeliteTitle = "RuneLite";
|
||||
|
||||
@Bind
|
||||
@Named("runelite.version")
|
||||
private String runeliteVersion = "version";
|
||||
|
||||
@Before
|
||||
public void before()
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.DrawManager;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.ImageCapture;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -110,6 +111,10 @@ public class ScreenshotPluginTest
|
||||
@Bind
|
||||
private InfoBoxManager infoBoxManager;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
private ImageCapture imageCapture;
|
||||
|
||||
@Before
|
||||
public void before()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user