diff --git a/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java b/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java index 37b690c9..d1532fee 100644 --- a/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java +++ b/app-core/src/main/java/com/mercury/platform/core/MercuryConstants.java @@ -1,7 +1,7 @@ package com.mercury.platform.core; public class MercuryConstants { - public static final String APP_VERSION = "1.2.2"; + public static final String APP_VERSION = "1.2.3"; public static final String SERVER_HOST = "exslims.ddns.net"; public static final int PORT = 5555; } diff --git a/app-core/src/main/java/com/mercury/platform/shared/HistoryManager.java b/app-core/src/main/java/com/mercury/platform/shared/HistoryManager.java index 6d1dceec..af83eb04 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/HistoryManager.java +++ b/app-core/src/main/java/com/mercury/platform/shared/HistoryManager.java @@ -37,6 +37,11 @@ public void load() { } } catch (Exception e) { logger.error("Error during loading history file: ", e); + try { + configFile.delete(); + } catch (Exception ex) { + logger.error("Cannot delete file: " + configFile.getPath() + " please remove it manually and restart MercuryTrade", ex); + } } } else { createEmptyFile(); @@ -70,6 +75,14 @@ public void add(NotificationDescriptor notificationDescriptor) { } catch (Exception e) { logger.error("Error during adding message to history file: ", e); + File configFile = new File(HISTORY_FILE); + try { + if (configFile.exists()) { + configFile.delete(); + } + } catch (Exception ex) { + logger.error("Cannot delete file: " + configFile.getPath() + " please remove it manually and restart MercuryTrade", ex); + } } } diff --git a/app-core/src/main/java/com/mercury/platform/shared/store/MercuryStoreCore.java b/app-core/src/main/java/com/mercury/platform/shared/store/MercuryStoreCore.java index 628d0c75..6f737697 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/store/MercuryStoreCore.java +++ b/app-core/src/main/java/com/mercury/platform/shared/store/MercuryStoreCore.java @@ -13,6 +13,8 @@ import com.mercury.platform.shared.entity.message.PlainMessageDescriptor; import rx.subjects.PublishSubject; +import java.awt.*; + public class MercuryStoreCore { public static final PublishSubject soundSubject = PublishSubject.create(); @@ -66,4 +68,5 @@ public class MercuryStoreCore { public static final PublishSubject expiredNotificationSubject = PublishSubject.create(); public static final PublishSubject vulkanSupportSubject = PublishSubject.create(); + public static final PublishSubject checkForUpdatesSubject = PublishSubject.create(); } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/NotificationPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/NotificationPanel.java index b6b14291..bf28cfeb 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/NotificationPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/notification/NotificationPanel.java @@ -104,7 +104,7 @@ protected void paintComponent(Graphics g) { this.paintAlphaValue = 1.0f; } } - this.repaint(); + //this.repaint(); } protected JPanel getTimePanel() { diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/HelpPanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/HelpPanel.java index 95543c2a..43376746 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/HelpPanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/HelpPanel.java @@ -36,7 +36,7 @@ public void onViewInit() { public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { FramesManager.INSTANCE.hideFrame(SettingsFrame.class); - FramesManager.INSTANCE.preShowFrame(NotesFrame.class); + FramesManager.INSTANCE.showFrame(NotesFrame.class); } } }); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/dialog/AlertDialog.java b/app-ui/src/main/java/com/mercury/platform/ui/dialog/AlertDialog.java index 5e36af63..c3cfebe9 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/dialog/AlertDialog.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/dialog/AlertDialog.java @@ -9,6 +9,8 @@ public class AlertDialog extends BaseDialog { + private boolean onlyOk = false; + public AlertDialog(DialogCallback callback, String text, Component relative) { super(callback, relative, text); } @@ -26,23 +28,35 @@ protected void createView() { JPanel miscPanel = this.componentsFactory.getJPanel(new FlowLayout(FlowLayout.CENTER)); miscPanel.setBackground(AppThemeColor.SLIDE_BG); miscPanel.setBorder(BorderFactory.createEmptyBorder(0, 50, 0, 50)); - JButton okButton = this.componentsFactory.getBorderedButton("Yes", 16); - okButton.setPreferredSize(new Dimension(120, 26)); - okButton.addActionListener(action -> { - this.callback.onAction(true); - this.setVisible(false); - this.dispose(); - }); - JButton cancelButton = this.componentsFactory.getBorderedButton("No", 16); - cancelButton.addActionListener(action -> { - this.callback.onAction(false); - this.setVisible(false); - this.dispose(); - }); - cancelButton.setPreferredSize(new Dimension(120, 26)); - - miscPanel.add(okButton); - miscPanel.add(cancelButton); + + if (!onlyOk) { + JButton okButton = this.componentsFactory.getBorderedButton("Yes", 16); + okButton.setPreferredSize(new Dimension(120, 26)); + okButton.addActionListener(action -> { + this.callback.onAction(true); + this.setVisible(false); + this.dispose(); + }); + JButton cancelButton = this.componentsFactory.getBorderedButton("No", 16); + cancelButton.addActionListener(action -> { + this.callback.onAction(false); + this.setVisible(false); + this.dispose(); + }); + cancelButton.setPreferredSize(new Dimension(120, 26)); + + miscPanel.add(okButton); + miscPanel.add(cancelButton); + } else { + JButton okButton = this.componentsFactory.getBorderedButton("OK", 16); + okButton.setPreferredSize(new Dimension(120, 26)); + okButton.addActionListener(action -> { + this.setVisible(false); + this.dispose(); + }); + miscPanel.add(okButton); + } + root.add(miscPanel, BorderLayout.PAGE_END); this.setResizable(false); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/dialog/OkDialog.java b/app-ui/src/main/java/com/mercury/platform/ui/dialog/OkDialog.java new file mode 100644 index 00000000..9100565c --- /dev/null +++ b/app-ui/src/main/java/com/mercury/platform/ui/dialog/OkDialog.java @@ -0,0 +1,48 @@ +package com.mercury.platform.ui.dialog; + +import com.mercury.platform.ui.components.fields.font.FontStyle; +import com.mercury.platform.ui.components.fields.font.TextAlignment; +import com.mercury.platform.ui.misc.AppThemeColor; + +import javax.swing.*; +import java.awt.*; + +public class OkDialog extends BaseDialog { + + public OkDialog(DialogCallback callback, String text, Component relative) { + super(callback, relative, text); + } + + protected void createView() { + this.setLayout(new BorderLayout()); + this.getRootPane().setBackground(AppThemeColor.FRAME_RGB); + JPanel root = this.componentsFactory.getJPanel(new BorderLayout()); + root.setBackground(AppThemeColor.SLIDE_BG); + root.setBorder(BorderFactory.createLineBorder(AppThemeColor.MSG_HEADER_BORDER)); + JLabel header = this.componentsFactory.getTextLabel(FontStyle.BOLD, AppThemeColor.TEXT_NICKNAME, TextAlignment.CENTER, 18f, this.payload); + header.setBackground(AppThemeColor.FRAME_RGB); + root.add(header, BorderLayout.CENTER); + + JPanel miscPanel = this.componentsFactory.getJPanel(new FlowLayout(FlowLayout.CENTER)); + miscPanel.setBackground(AppThemeColor.SLIDE_BG); + miscPanel.setBorder(BorderFactory.createEmptyBorder(0, 50, 0, 50)); + + + JButton okButton = this.componentsFactory.getBorderedButton("OK", 16); + okButton.setPreferredSize(new Dimension(120, 26)); + okButton.addActionListener(action -> { + if (this.callback != null) { + this.callback.onAction(true); + } + this.setVisible(false); + this.dispose(); + }); + miscPanel.add(okButton); + + + root.add(miscPanel, BorderLayout.PAGE_END); + + this.setResizable(false); + this.add(root, BorderLayout.CENTER); + } +} diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/ItemsGridFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/ItemsGridFrame.java index 485bab80..4a089480 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/ItemsGridFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/ItemsGridFrame.java @@ -21,6 +21,9 @@ import java.util.List; import java.util.Map; +import static java.awt.event.ItemEvent.DESELECTED; +import static java.awt.event.ItemEvent.SELECTED; + public class ItemsGridFrame extends AbstractMovableComponentFrame { private ItemsGridPanel itemsGridPanel; private HorizontalScrollContainer tabsContainer; @@ -97,39 +100,63 @@ protected JPanel getPanelForPINSettings() { JPanel topPanel = componentsFactory.getTransparentPanel(new BorderLayout()); topPanel.setBackground(AppThemeColor.FRAME); JPanel headerPanel = componentsFactory.getTransparentPanel(new BorderLayout()); - JPanel defaultGridPanel = componentsFactory.getTransparentPanel(new GridLayout(12, 12)); - defaultGridPanel.setBorder(null); - for (int x = 0; x < 12; x++) { - for (int y = 0; y < 12; y++) { - defaultGridPanel.add(getCellPlaceholder()); - } - } - defaultGridPanel.setBackground(AppThemeColor.FRAME_ALPHA); - JPanel quadGridPanel = componentsFactory.getTransparentPanel(new GridLayout(24, 24)); - quadGridPanel.setBorder(null); - for (int x = 0; x < 24; x++) { - for (int y = 0; y < 24; y++) { - quadGridPanel.add(getCellPlaceholder()); - } - } - quadGridPanel.setBackground(AppThemeColor.FRAME_ALPHA); + JPanel defaultGridPanel = createGridPanel(12,12); + JPanel quadGridPanel = createGridPanel(24,24); + +// JPanel folderDefaultGridPanel = createGridPanel(12,12); +// JPanel folderQuadGridPanel = createGridPanel(24,24); +// +// JPanel separator = componentsFactory.getSeparator(); + JPanel labelPanel = componentsFactory.getTransparentPanel(new BorderLayout()); - JComboBox tabType = componentsFactory.getComboBox(new String[]{"1x1", "4x4"}); + JComboBox tabType = componentsFactory.getComboBox(new String[]{"1x1", "4x4"});//, "Folder 1x1", "Folder 4x4"}); tabType.addItemListener(e -> { - if (e.getStateChange() == ItemEvent.SELECTED) { - String item = (String) e.getItem(); - - if (item.equals("4x4")) { - panel.remove(defaultGridPanel); - panel.add(quadGridPanel, BorderLayout.CENTER); - } else { - panel.remove(quadGridPanel); - panel.add(defaultGridPanel, BorderLayout.CENTER); - } - this.pack(); - this.repaint(); - this.revalidate(); + String item; + switch (e.getStateChange()) { + case DESELECTED: + item = (String) e.getItem(); + + switch (item) { + case "1x1": + panel.remove(defaultGridPanel); + break; + case "4x4": + panel.remove(quadGridPanel); + break; +// case "Folder 1x1": +// topPanel.remove(separator); +// panel.remove(folderDefaultGridPanel); +// break; +// case "Folder 4x4": +// topPanel.remove(separator); +// panel.remove(folderQuadGridPanel); +// break; + } + break; + case SELECTED: + item = (String) e.getItem(); + + switch (item) { + case "1x1": + panel.add(defaultGridPanel, BorderLayout.CENTER); + break; + case "4x4": + panel.add(quadGridPanel, BorderLayout.CENTER); + break; +// case "Folder 1x1": +// topPanel.add(separator, BorderLayout.PAGE_END); +// panel.add(folderDefaultGridPanel, BorderLayout.CENTER); +// break; +// case "Folder 4x4": +// topPanel.add(separator, BorderLayout.PAGE_END); +// panel.add(folderQuadGridPanel, BorderLayout.CENTER); +// break; + } + this.pack(); + this.repaint(); + this.revalidate(); + break; } }); tabType.setPreferredSize(new Dimension((int) (componentsFactory.getScale() * 70), tabType.getHeight())); @@ -144,18 +171,18 @@ protected JPanel getPanelForPINSettings() { JButton disableButton = componentsFactory.getBorderedButton(title); disableButton.setPreferredSize(new Dimension((int) (90 * componentsFactory.getScale()), (int) (24 * componentsFactory.getScale()))); componentsFactory.setUpToggleCallbacks(disableButton, - () -> { - disableButton.setText("Enable"); - titleLabel.setForeground(AppThemeColor.TEXT_DISABLE); - applicationConfig.get().setItemsGridEnable(false); - repaint(); - }, - () -> { - disableButton.setText("Disable"); - titleLabel.setForeground(AppThemeColor.TEXT_NICKNAME); - applicationConfig.get().setItemsGridEnable(true); - repaint(); - }, this.applicationConfig.get().isItemsGridEnable()); + () -> { + disableButton.setText("Enable"); + titleLabel.setForeground(AppThemeColor.TEXT_DISABLE); + applicationConfig.get().setItemsGridEnable(false); + repaint(); + }, + () -> { + disableButton.setText("Disable"); + titleLabel.setForeground(AppThemeColor.TEXT_NICKNAME); + applicationConfig.get().setItemsGridEnable(true); + repaint(); + }, this.applicationConfig.get().isItemsGridEnable()); JButton hideButton = componentsFactory.getBorderedButton("Save"); hideButton.setPreferredSize(new Dimension((int) (90 * componentsFactory.getScale()), (int) (24 * componentsFactory.getScale()))); hideButton.addMouseListener(new MouseAdapter() { @@ -230,6 +257,18 @@ public void mouseWheelMoved(MouseWheelEvent e) { return panel; } + private JPanel createGridPanel(int rows, int cols) { + JPanel gridPanel = componentsFactory.getTransparentPanel(new GridLayout(rows, cols)); + gridPanel.setBorder(null); + for (int x = 0; x < rows; x++) { + for (int y = 0; y < cols; y++) { + gridPanel.add(getCellPlaceholder()); + } + } + gridPanel.setBackground(AppThemeColor.FRAME_ALPHA); + return gridPanel; + } + private JPanel getCellPlaceholder() { JPanel cell = new JPanel(); cell.setOpaque(true); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/NotificationFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/NotificationFrame.java index f4cea857..d7386e66 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/NotificationFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/movable/NotificationFrame.java @@ -118,7 +118,9 @@ public void subscribe() { } if (this.preProcessor.isAllowed(notification)) { MercuryStoreCore.soundSubject.onNext(SoundType.MESSAGE); - PushBulletManager.INSTANCE.sendPush(notification.getSourceString(), notification.getWhisperNickname()); + if (NotificationType.INC_ITEM_MESSAGE.equals(notification.getType()) || NotificationType.INC_CURRENCY_MESSAGE.equals(notification.getType())) { + PushBulletManager.INSTANCE.sendPush(notification.getSourceString(), notification.getWhisperNickname()); + } this.addNotification(notificationPanel); } }); @@ -129,7 +131,7 @@ public void subscribe() { .setData(message) .setComponentsFactory(this.componentsFactory) .build(); - PushBulletManager.INSTANCE.sendPush(message.getMessage().replaceAll("\\<[^>]*>",""), message.getNickName()); + PushBulletManager.INSTANCE.sendPush(message.getMessage().replaceAll("\\<[^>]*>", ""), message.getNickName()); this.addNotification(notificationPanel); }); }); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/GithubReleaseResponse.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/GithubReleaseResponse.java new file mode 100644 index 00000000..b91c5dd1 --- /dev/null +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/GithubReleaseResponse.java @@ -0,0 +1,14 @@ +package com.mercury.platform.ui.frame.titled; + +public class GithubReleaseResponse { + private String tag_name; + + public String getTag_name() { + return tag_name; + } + + public void setTag_name(String tag_name) { + this.tag_name = tag_name; + } +} + diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java index f745cb6f..9d0bfd86 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/NotesFrame.java @@ -28,8 +28,8 @@ public NotesFrame(List notes, NotesType type) { super(); this.currentNotes = notes; this.type = type; - this.processEResize = false; - this.processSEResize = false; + this.processEResize = true; + this.processSEResize = true; this.progressBarFrame = new ProgressBarFrame(); this.progressBarFrame.init(); if (type.equals(NotesType.INFO)) { @@ -72,7 +72,7 @@ private JPanel getNavBar() { JButton gitHub = componentsFactory.getBorderedButton("GitHub"); gitHub.addActionListener(action -> { try { - Desktop.getDesktop().browse(new URI("https://github.com/Morph21/MercuryTrade-Community-Fork/releases")); + Desktop.getDesktop().browse(new URI("https://github.com/Morph21/MercuryTrade-Community-Fork/releases/latest")); } catch (Exception e1) { e1.printStackTrace(); } @@ -208,7 +208,13 @@ private void renderCurrentNote() { textArea.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); JPanel imgPanel = componentsFactory.getTransparentPanel(new FlowLayout(FlowLayout.CENTER)); JPanel textPanel = componentsFactory.getTransparentPanel(new BorderLayout()); - textPanel.add(textArea, BorderLayout.CENTER); + + JPanel panel = componentsFactory.getTransparentPanel(); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.add(textArea); + + + textPanel.add(panel, BorderLayout.CENTER); imgPanel.add(image); innerContent.add(imgPanel); innerContent.add(textPanel); diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/SettingsFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/SettingsFrame.java index 8ddd7f8c..2d87404c 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/SettingsFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/SettingsFrame.java @@ -1,23 +1,31 @@ package com.mercury.platform.ui.frame.titled; +import com.google.gson.Gson; +import com.google.gson.JsonParser; +import com.mercury.platform.core.MercuryConstants; import com.mercury.platform.core.update.core.holder.ApplicationHolder; import com.mercury.platform.shared.UpdateManager; import com.mercury.platform.shared.config.descriptor.FrameDescriptor; import com.mercury.platform.shared.config.descriptor.adr.AdrComponentType; import com.mercury.platform.shared.config.descriptor.adr.AdrDurationComponentDescriptor; import com.mercury.platform.shared.config.descriptor.adr.AdrProgressBarDescriptor; +import com.mercury.platform.shared.config.json.JSONHelper; import com.mercury.platform.shared.store.MercuryStoreCore; import com.mercury.platform.ui.adr.components.panel.ui.MercuryTracker; import com.mercury.platform.ui.components.fields.font.FontStyle; import com.mercury.platform.ui.components.panel.settings.MenuPanel; import com.mercury.platform.ui.components.panel.settings.page.GlobalHotkeyGroup; +import com.mercury.platform.ui.dialog.AlertDialog; +import com.mercury.platform.ui.dialog.OkDialog; import com.mercury.platform.ui.manager.FramesManager; import com.mercury.platform.ui.misc.AppThemeColor; import com.mercury.platform.ui.misc.MercuryStoreUI; import com.mercury.platform.ui.misc.note.Note; import com.mercury.platform.ui.misc.note.NotesLoader; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.SystemUtils; +import org.apache.http.HttpConnection; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -25,12 +33,19 @@ import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; public class SettingsFrame extends AbstractTitledComponentFrame { private final static Logger logger = LogManager.getLogger(SettingsFrame.class.getSimpleName()); private JPanel currentPanel; private JPanel root; + private Gson gson = new Gson(); public SettingsFrame() { super(); @@ -158,15 +173,24 @@ private JPanel getOperationsButtons() { JButton openTutorial = this.getOperationButton("Open tutorial", "app/tutorial.png"); openTutorial.addActionListener(action -> { FramesManager.INSTANCE.hideFrame(SettingsFrame.class); - FramesManager.INSTANCE.preShowFrame(NotesFrame.class); + FramesManager.INSTANCE.showFrame(NotesFrame.class); }); JButton checkUpdates = this.getOperationButton("Check for updates", "app/check-update.png"); + checkUpdates.addActionListener(action -> { - try { - Desktop.getDesktop().browse(new URI("https://github.com/Morph21/MercuryTrade-Community-Fork/releases")); - } catch (Exception e) { - logger.error("Opening browser failed", e); - } + checkUpdates.setText("Hamsters are running"); + checkUpdates.setEnabled(false); + repaint(); + SwingWorker worker = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + SettingsFrame.this.checkForUpdates(); + checkUpdates.setText("Check for updates"); + checkUpdates.setEnabled(true); + return null; + } + }; + worker.execute(); }); JButton openTests = this.getOperationButton("Open tests", "app/open-tests.png"); openTests.addActionListener(action -> { @@ -233,4 +257,65 @@ public void hideComponent() { super.hideComponent(); MercuryStoreCore.showingDelaySubject.onNext(true); } + + public void checkForUpdates() { + GithubReleaseResponse response = getNewestVersion(); + + if (response == null) { + AlertDialog dialog = new AlertDialog(callback -> { + if (callback) { + try { + Desktop.getDesktop().browse(new URI("https://github.com/Morph21/MercuryTrade-Community-Fork/releases/latest")); + } catch (Exception e) { + logger.error(e); + } + } + }, "There was a problem with checking newest version, do you want to manually check it?", SettingsFrame.this); + dialog.setTitle("Check for updates"); + dialog.setVisible(true); + } else if (StringUtils.isNotEmpty(response.getTag_name()) && response.getTag_name().equals(MercuryConstants.APP_VERSION)) { + OkDialog dialog = new OkDialog(null, "You have the newest version", SettingsFrame.this); + dialog.setTitle("Check for updates"); + dialog.setVisible(true); + } else { + AlertDialog dialog = new AlertDialog(callback -> { + if (callback) { + try { + Desktop.getDesktop().browse(new URI("https://github.com/Morph21/MercuryTrade-Community-Fork/releases/latest")); + } catch (Exception e) { + logger.error(e); + } + } + }, "There is a newer version, do you want to go to github?", SettingsFrame.this); + dialog.setTitle("Check for updates"); + dialog.setVisible(true); + } + } + + private GithubReleaseResponse getNewestVersion() { + try { + URL url = new URL("https://api.github.com/repos/Morph21/MercuryTrade-Community-Fork/releases/latest"); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestMethod("GET"); + int code = con.getResponseCode(); + if (code == 200) { + BufferedReader in = new BufferedReader( + new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuilder content = new StringBuilder(); + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + in.close(); + con.disconnect(); + return gson.fromJson(content.toString(), GithubReleaseResponse.class); + } else { + return null; + } + } catch (Exception e) { + logger.error(e); + return null; + } + } + } diff --git a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/TestCasesFrame.java b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/TestCasesFrame.java index aad45298..928a2333 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/TestCasesFrame.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/frame/titled/TestCasesFrame.java @@ -57,16 +57,16 @@ private JPanel getTestCasesPanel() { testPanel.add(textLabel, titleColumn); titleColumn.gridy++; - JButton button0 = componentsFactory.getBorderedButton("Click"); - button0.addActionListener(action -> { - clickThroughWindow(); - }); - ; - testPanel.add(button0, buttonColumn); - buttonColumn.gridy++; - JLabel textLabel0 = componentsFactory.getTextLabel("Transparent clickthrough window test"); - testPanel.add(textLabel0, titleColumn); - titleColumn.gridy++; +// JButton button0 = componentsFactory.getBorderedButton("Click"); +// button0.addActionListener(action -> { +// clickThroughWindow(); +// }); +// ; +// testPanel.add(button0, buttonColumn); +// buttonColumn.gridy++; +// JLabel textLabel0 = componentsFactory.getTextLabel("Transparent clickthrough window test"); +// testPanel.add(textLabel0, titleColumn); +// titleColumn.gridy++; JButton button1 = componentsFactory.getBorderedButton("Click"); button1.addActionListener(action -> { diff --git a/app-ui/src/main/resources/notes/first/first-start.json b/app-ui/src/main/resources/notes/first/first-start.json index 19984ad3..e29fd4c5 100644 --- a/app-ui/src/main/resources/notes/first/first-start.json +++ b/app-ui/src/main/resources/notes/first/first-start.json @@ -39,7 +39,7 @@ "title" : "Main feature: History", "text" : "Each notification you receive is stored by MercuryTrade in a separate file. \n\nYou won't be losing potential trades due to client crashes or relogs anymore!", "image" : "notes/first/3.png", - "layout" : "HORIZONTAL" + "layout" : "VERTICAL" }, { "title" : "Major feature: Chat Scanner", diff --git a/app-ui/src/main/resources/notes/patch/patch-notes-new.json b/app-ui/src/main/resources/notes/patch/patch-notes-new.json index 46f05e92..763bb42f 100644 --- a/app-ui/src/main/resources/notes/patch/patch-notes-new.json +++ b/app-ui/src/main/resources/notes/patch/patch-notes-new.json @@ -1,4 +1,26 @@ [ + { + "version": "1.2.3", + "minorChanges": [ + { + "changed": "Check for updates, will now show if you have newest version without going to github. (You still need to download it manually)" + } + ], + "fix": [ + { + "changed": "Removed sending pushbullet notification on outgoing notifications" + }, + { + "changed": "Fixed high cpu usage" + }, + { + "changed": "Fixed tutorial window not resizable" + }, + { + "changed": "Fixed history file parsing" + } + ] + }, { "version": "1.2.2", "fix": [ diff --git a/pom.xml b/pom.xml index 962d2899..313e53eb 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ pom - 1.2.2 + 1.2.3 2.0.2 4.4.0 diff --git a/release_files/release_config.xml b/release_files/release_config.xml index 530a06c2..351af842 100644 --- a/release_files/release_config.xml +++ b/release_files/release_config.xml @@ -30,12 +30,12 @@ -XX:+UseG1GC - 1.2.2.0 - 1.2.2 + 1.2.3.0 + 1.2.3 MercuryTrade Morph21 - 1.2.2.0 - 1.2.2 + 1.2.3.0 + 1.2.3 MercuryTrade Morph MercuryTrade