From ba3147c907551005dd4df76587f657c223514224 Mon Sep 17 00:00:00 2001 From: Morph21 <38075691+Morph21@users.noreply.github.com> Date: Sat, 21 Dec 2024 14:17:53 +0100 Subject: [PATCH] Release 1.4.1 --- .../com/mercury/platform/core/ChatHelper.java | 34 +++++-------------- .../platform/core/MercuryConstants.java | 2 +- .../platform/shared/MainWindowHWNDFetch.java | 7 ++++ .../descriptor/ApplicationDescriptor.java | 1 + .../PoeTradeItemParserChina.java | 2 +- .../PoeTradeItemParserFrench.java | 2 +- .../PoeTradeItemParserJapanese.java | 2 +- .../com/mercury/platform/TranslationKey.java | 4 ++- app-shared/src/main/resources/lang/en.lang | 4 ++- app-shared/src/main/resources/lang/pl.lang | 6 +++- app-shared/src/main/resources/lang/ru.lang | 6 +++- .../page/GeneralSettingsPagePanel.java | 7 ++++ .../notes/patch/patch-notes-new.json | 16 +++++++++ .../java/com/mercury/platform/AppMain.java | 1 - release_files/release_config.xml | 8 ++--- 15 files changed, 64 insertions(+), 38 deletions(-) diff --git a/app-core/src/main/java/com/mercury/platform/core/ChatHelper.java b/app-core/src/main/java/com/mercury/platform/core/ChatHelper.java index 627be428..38bcb4dd 100644 --- a/app-core/src/main/java/com/mercury/platform/core/ChatHelper.java +++ b/app-core/src/main/java/com/mercury/platform/core/ChatHelper.java @@ -6,18 +6,13 @@ import com.mercury.platform.shared.config.descriptor.TaskBarDescriptor; import com.mercury.platform.shared.entity.message.MercuryError; import com.mercury.platform.shared.store.MercuryStoreCore; -import com.sun.jna.Native; import com.sun.jna.Pointer; -import com.sun.jna.platform.DesktopWindow; -import com.sun.jna.platform.WindowUtils; import com.sun.jna.platform.win32.User32; import com.sun.jna.platform.win32.WinDef; -import com.sun.jna.platform.win32.WinUser; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.SystemUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; - import javax.swing.*; import java.awt.*; import java.awt.datatransfer.Clipboard; @@ -26,6 +21,7 @@ import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.KeyEvent; import java.io.IOException; +import java.time.Instant; public class ChatHelper implements AsSubscriber { @@ -217,28 +213,16 @@ private void findInStashTab(String toBeFound) { final int SWP_SHOWWINDOW = 0x0040; private void gameToFront() { - if (SystemUtils.IS_OS_WINDOWS) { - for (DesktopWindow window : MainWindowHWNDFetch.INSTANCE.getMainWindowList()) { - char[] className = new char[512]; - User32.INSTANCE.GetClassName(window.getHWND(), className, 512); - - User32.INSTANCE.ShowWindow(window.getHWND(), 5); - - boolean isAtFront = User32.INSTANCE.SetForegroundWindow(window.getHWND()); - int counter = 0; - while (!isAtFront && counter < 10) { - isAtFront = User32.INSTANCE.SetForegroundWindow(window.getHWND()); - try { - Thread.sleep(10); - } catch (InterruptedException e) { - e.printStackTrace(); - } - counter++; - } + if (Configuration.get().applicationConfiguration().get().isDisableGameToFront()) { + return; + } - User32.INSTANCE.SetFocus(window.getHWND()); - } + if (SystemUtils.IS_OS_WINDOWS) { + WinDef.HWND hwnd = MainWindowHWNDFetch.INSTANCE.findWindow(); + User32.INSTANCE.ShowWindow(hwnd, 5); + User32.INSTANCE.SetForegroundWindow(hwnd); + User32.INSTANCE.SetFocus(hwnd); } } 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 8119c4f4..828565d2 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.4.0"; + public static final String APP_VERSION = "1.4.1"; public static final String SERVER_HOST = "exslims.ddns.net"; public static final int PORT = 5555; } \ No newline at end of file diff --git a/app-core/src/main/java/com/mercury/platform/shared/MainWindowHWNDFetch.java b/app-core/src/main/java/com/mercury/platform/shared/MainWindowHWNDFetch.java index c109f186..013123e6 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/MainWindowHWNDFetch.java +++ b/app-core/src/main/java/com/mercury/platform/shared/MainWindowHWNDFetch.java @@ -5,6 +5,7 @@ import com.sun.jna.platform.DesktopWindow; import com.sun.jna.platform.WindowUtils; import com.sun.jna.platform.win32.User32; +import com.sun.jna.platform.win32.WinDef; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -39,8 +40,14 @@ public List getMainWindowList() { return windowList; } + public WinDef.HWND findWindow() { + WinDef.HWND hwnd = User32.INSTANCE.FindWindow("POEWindowClass", null); + return hwnd; + } + public boolean isPoe(DesktopWindow desktopWindow) { // if (this.isPoe2()) { + // return desktopWindow.getTitle().contains("PathOfExile"); // } else { char[] className = new char[512]; diff --git a/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/ApplicationDescriptor.java b/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/ApplicationDescriptor.java index 68034d8d..d9b32163 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/ApplicationDescriptor.java +++ b/app-core/src/main/java/com/mercury/platform/shared/config/descriptor/ApplicationDescriptor.java @@ -20,4 +20,5 @@ public class ApplicationDescriptor implements Serializable { private boolean hideTaskbarUntilHover; private boolean poe2; private Languages languages = Languages.en; + private boolean disableGameToFront; } diff --git a/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserChina.java b/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserChina.java index d2869d5c..0ca9f602 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserChina.java +++ b/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserChina.java @@ -10,7 +10,7 @@ class PoeTradeItemParserChina extends BaseRegexParser { // Tested for message 神圣怨恨初火: 你好,我想購買 Ghoul Hide, Advanced Marabout Garb 標價 1 exalted 在 Standard (倉庫頁 "asdac"; 位置: 左 5, 上 10) // coming from https://www.pathofexile.com/trade2/search/poe2/Standard 12.12.2024 - private static final String poeTradePattern = "^(.+): 你好,我想購買 (.+) 標價 (\\d+ exalted) 在 (.+) \\(倉庫頁 \"(.+)\"; 位置: 左 (\\d+), 上 (\\d+)\\)$"; + private static final String poeTradePattern = "^(.+): 你好,我想購買 (.+) 標價 (\\d+ exalted) 在 (.+) \\(倉庫頁 \"(.*)\"; 位置: 左 (\\d+), 上 (\\d+)\\)$"; public PoeTradeItemParserChina() { super(poeTradePattern); diff --git a/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserFrench.java b/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserFrench.java index a45a0134..5396e326 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserFrench.java +++ b/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserFrench.java @@ -10,7 +10,7 @@ class PoeTradeItemParserFrench extends BaseRegexParser { // Tested for message Sillmar: Bonjour, je souhaiterais t'acheter Call of the Brotherhood, Topaz Ring pour 15 exalted dans la ligue Standard (onglet de réserve "A vendre" ; 6e en partant de la gauche, 1e en partant du haut) // coming from https://www.pathofexile.com/trade2/search/poe2/Standard 18.12.2024 - private static final String poeTradePattern = "^(.+): Bonjour, je souhaiterais t'acheter (.+) pour (.+) dans la ligue (.+) \\(onglet de réserve \"(.+)\" ; (\\d+)e en partant de la gauche, (\\d+)e en partant du haut\\)$"; + private static final String poeTradePattern = "^(.+): Bonjour, je souhaiterais t'acheter (.+) pour (.+) dans la ligue (.+) \\(onglet de réserve \"(.*)\" ; (\\d+)e en partant de la gauche, (\\d+)e en partant du haut\\)$"; public PoeTradeItemParserFrench() { super(poeTradePattern); diff --git a/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserJapanese.java b/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserJapanese.java index a676e1f8..33bcf30e 100644 --- a/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserJapanese.java +++ b/app-core/src/main/java/com/mercury/platform/shared/messageparser/PoeTradeItemParserJapanese.java @@ -10,7 +10,7 @@ class PoeTradeItemParserJapanese extends BaseRegexParser { // Tested for message ナーフ神ジョナサン: こんにちは、Standard リーグで 3 exalted で売っている、あなたの Havoc Band, Emerald Ring を購入したいです (スタッシュタブ "~b/o 3 exalted"; 位置: 左から 6, 上から 7) // coming from https://www.pathofexile.com/trade2/search/poe2/Standard 12.12.2024 - private static final String poeTradePattern = "^(.+): こんにちは、(.+) リーグで (.+) (.+) で売っている、あなたの (.+) を購入したいです \\(スタッシュタブ \"(.+)\"; 位置: 左から (\\d+), 上から (\\d+)\\)$"; + private static final String poeTradePattern = "^(.+): こんにちは、(.+) リーグで (.+) (.+) で売っている、あなたの (.+) を購入したいです \\(スタッシュタブ \"(.*)\"; 位置: 左から (\\d+), 上から (\\d+)\\)$"; public PoeTradeItemParserJapanese() { super(poeTradePattern); diff --git a/app-shared/src/main/java/com/mercury/platform/TranslationKey.java b/app-shared/src/main/java/com/mercury/platform/TranslationKey.java index 391935a3..f5a18398 100644 --- a/app-shared/src/main/java/com/mercury/platform/TranslationKey.java +++ b/app-shared/src/main/java/com/mercury/platform/TranslationKey.java @@ -237,7 +237,9 @@ public enum TranslationKey { choose_language("Choose language"), language_change_requires_application_restart("Language change requires application restart."), hide_notifications("Hide notifications until next incoming or manually shown"), - show_notifications("Show notifications") + show_notifications("Show notifications"), + disable_game_to_front("Disable game to front"), + disable_game_to_front_tt("Don't check this checkbox until you know what you are doing.
It will disable force putting game to front
which can sometimes make buttons on notification to invite/kick etc not working") ; private String defaultValue; diff --git a/app-shared/src/main/resources/lang/en.lang b/app-shared/src/main/resources/lang/en.lang index 7ec57f0b..6d364d65 100644 --- a/app-shared/src/main/resources/lang/en.lang +++ b/app-shared/src/main/resources/lang/en.lang @@ -234,4 +234,6 @@ polish = polish choose_language = Choose language language_change_requires_application_restart = Language change requires application restart. hide_notifications = Hide notifications until next incoming or manually shown -show_notifications = Show notifications \ No newline at end of file +show_notifications = Show notifications +disable_game_to_front = Disable game to front +disable_game_to_front_tt = Don't check this checkbox until you know what you are doing.
It will disable force putting game to front
which can sometimes make buttons on notification to invite/kick etc not working \ No newline at end of file diff --git a/app-shared/src/main/resources/lang/pl.lang b/app-shared/src/main/resources/lang/pl.lang index 4217f8cc..dfc6b15d 100644 --- a/app-shared/src/main/resources/lang/pl.lang +++ b/app-shared/src/main/resources/lang/pl.lang @@ -471,4 +471,8 @@ language_change_requires_application_restart = Zmiana języka wymaga restartu ap // Hide notifications until next incoming or manually shown hide_notifications = Ukryj powiadomienia do następnej wiadomości // Show notifications -show_notifications = Pokaż powiadomienia \ No newline at end of file +show_notifications = Pokaż powiadomienia +// Disable game to front +disable_game_to_front = Wyłącz przenoszenie gry na wierzch +// Don't check this checkbox until you know what you are doing.
It will disable force putting game to front which can sometimes make buttons on notification to invite/kick etc not working +disable_game_to_front_tt = Nie zaznaczaj tego pola, dopóki nie wiesz, co robisz.
Spowoduje to wyłączenie wymuszania przeniesienia gry na wierzch,
co czasami może spowodować, że przyciski na powiadomieniu do zapraszania/wyrzucania itp. mogą przestać działać \ No newline at end of file diff --git a/app-shared/src/main/resources/lang/ru.lang b/app-shared/src/main/resources/lang/ru.lang index 5a6457a3..154d2131 100644 --- a/app-shared/src/main/resources/lang/ru.lang +++ b/app-shared/src/main/resources/lang/ru.lang @@ -471,4 +471,8 @@ language_change_requires_application_restart = Изменение языка т // Hide notifications until next incoming or manually shown hide_notifications = Скрыть уведомления до следующего сообщения // Show notifications -show_notifications = Показать уведомления \ No newline at end of file +show_notifications = Показать уведомления +// Disable game to front +disable_game_to_front = Отключить вывод игры на передний план +// Don't check this checkbox until you know what you are doing.
It will disable force putting game to front which can sometimes make buttons on notification to invite/kick etc not working +disable_game_to_front_tt = Не отмечайте этот флажок, пока не узнаете, что делаете.
Это отключит принудительное перемещение игры на передний план, что иногда может привести к тому,
что кнопки на оповещении для приглашения/выгоняют и т.д. могут не работать \ No newline at end of file diff --git a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/GeneralSettingsPagePanel.java b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/GeneralSettingsPagePanel.java index 86b595b8..89d24e3d 100644 --- a/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/GeneralSettingsPagePanel.java +++ b/app-ui/src/main/java/com/mercury/platform/ui/components/panel/settings/page/GeneralSettingsPagePanel.java @@ -63,6 +63,11 @@ public void onViewInit() { this.applicationSnapshot.setHideTaskbarUntilHover(hideTaskbarUntilHover.isSelected()); }); + JCheckBox disableGameToFront = this.componentsFactory.getCheckBox(this.applicationSnapshot.isDisableGameToFront(), TranslationKey.disable_game_to_front_tt.value()); + disableGameToFront.addActionListener(action -> { + this.applicationSnapshot.setDisableGameToFront(disableGameToFront.isSelected()); + }); + // JCheckBox poe2Support = this.componentsFactory.getCheckBox(this.applicationSnapshot.isPoe2(), TranslationKey.poe2_support_tt.value()); // poe2Support.addActionListener(action -> { // this.applicationSnapshot.setPoe2(poe2Support.isSelected()); @@ -165,6 +170,8 @@ public void keyTyped(KeyEvent e) { root.add(hideTaskbarUntilHover); // root.add(this.componentsFactory.getTextLabel(TranslationKey.poe_2_support.value(), FontStyle.REGULAR, 16)); // root.add(poe2Support); + root.add(this.componentsFactory.getTextLabel(TranslationKey.disable_game_to_front.value(), FontStyle.REGULAR, 16)); + root.add(disableGameToFront); root.add(this.componentsFactory.getTextLabel(TranslationKey.component_fade_out_time.value(": "), FontStyle.REGULAR, 16)); root.add(fadeTimeSlider); root.add(this.componentsFactory.getTextLabel(TranslationKey.min_opacity.value(": "), FontStyle.REGULAR, 16)); 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 9e3cc13b..88b81633 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,20 @@ [ + { + "version": "1.4.1", + "minorChanges": [ + { + "changed": "Added checkbox to disable bringing game to top on action always (feature for advanced users - keep in mind that it can sometimes result in message/invite/kick not being sent or invite)" + } + ], + "fix": [ + { + "changed": "Reduced delay between pressing button on notification (kick/leave/trade etc) and actual action firing to invite, message someone" + }, + { + "changed": "Fixed parsing messages with empty stash tab names" + } + ] + }, { "version": "1.4.0", "fix": [ diff --git a/app/src/main/java/com/mercury/platform/AppMain.java b/app/src/main/java/com/mercury/platform/AppMain.java index f0cc3b65..7de8e5ea 100644 --- a/app/src/main/java/com/mercury/platform/AppMain.java +++ b/app/src/main/java/com/mercury/platform/AppMain.java @@ -15,7 +15,6 @@ import org.apache.commons.lang3.SystemUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.core.util.JsonUtils; import javax.swing.*; import java.io.File; diff --git a/release_files/release_config.xml b/release_files/release_config.xml index a9fc727f..c2fc30f5 100644 --- a/release_files/release_config.xml +++ b/release_files/release_config.xml @@ -31,12 +31,12 @@ -Dfile.encoding=UTF-8 - 1.4.0.0 - 1.4.0 + 1.4.1.0 + 1.4.1 MercuryTrade Morph21 - 1.4.0.0 - 1.4.0 + 1.4.1.0 + 1.4.1 MercuryTrade Morph MercuryTrade