From 8446cb3c1f63895fc7a25dc3cfada78a9239d2b3 Mon Sep 17 00:00:00 2001 From: Infi Date: Tue, 9 Apr 2024 16:37:58 +0200 Subject: [PATCH] + Switch to dalamud method for opening URLs + Fix popout min size --- ChatTwo/ChatTwo.csproj | 2 +- ChatTwo/Message.cs | 4 +--- ChatTwo/PayloadHandler.cs | 5 ++--- ChatTwo/Ui/Popout.cs | 8 ++------ 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ChatTwo/ChatTwo.csproj b/ChatTwo/ChatTwo.csproj index 275f83e..28c7abf 100755 --- a/ChatTwo/ChatTwo.csproj +++ b/ChatTwo/ChatTwo.csproj @@ -1,7 +1,7 @@ - 1.20.0 + 1.20.1 net8.0-windows enable enable diff --git a/ChatTwo/Message.cs b/ChatTwo/Message.cs index f0cc9fc..5a40276 100755 --- a/ChatTwo/Message.cs +++ b/ChatTwo/Message.cs @@ -157,7 +157,7 @@ internal class Message { /// It matches URLs with www. or https:// prefix, and also matches URLs /// without a prefix on specific TLDs. /// - private static Regex URLRegex = new Regex( + private static Regex URLRegex = new( @"((https?:\/\/|www\.)[a-z0-9-]+(\.[a-z0-9-]+)*|([a-z0-9-]+(\.[a-z0-9-]+)*\.(com|net|org|co|io|app)))(:[\d]{1,5})?(\/[^\s]+)?", RegexOptions.Compiled | RegexOptions.IgnoreCase ); @@ -218,9 +218,7 @@ internal class Message { // Add the text after the last URL. if (remainderIndex < text.Content.Length) - { AddChunkWithMessage(text.NewWithStyle(chunk.Source, null, text.Content[remainderIndex..])); - } } return newChunks; diff --git a/ChatTwo/PayloadHandler.cs b/ChatTwo/PayloadHandler.cs index 4452d09..b286f76 100755 --- a/ChatTwo/PayloadHandler.cs +++ b/ChatTwo/PayloadHandler.cs @@ -21,7 +21,6 @@ using Lumina.Excel.GeneratedSheets; using Action = System.Action; using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload; using ChatTwoPartyFinderPayload = ChatTwo.Util.PartyFinderPayload; -using System.Diagnostics; namespace ChatTwo; @@ -681,8 +680,8 @@ public sealed class PayloadHandler { new Thread(() => { try { - Plugin.Log.Info($"Opening URI {uri} in default browser"); - Process.Start(new ProcessStartInfo(uri.ToString()) { UseShellExecute = true }); + Plugin.Log.Debug($"Opening URI {uri} in default browser"); + Dalamud.Utility.Util.OpenLink(uri.ToString()); } catch (Exception ex) { diff --git a/ChatTwo/Ui/Popout.cs b/ChatTwo/Ui/Popout.cs index 5aa0636..a3ff375 100644 --- a/ChatTwo/Ui/Popout.cs +++ b/ChatTwo/Ui/Popout.cs @@ -16,12 +16,8 @@ internal class Popout : Window Tab = tab; Idx = idx; + Size = new Vector2(350, 350); SizeCondition = ImGuiCond.FirstUseEver; - SizeConstraints = new WindowSizeConstraints - { - MinimumSize = new Vector2(350, 350), - MaximumSize = new Vector2(float.MaxValue, float.MaxValue) - }; } public override void PreDraw() @@ -64,4 +60,4 @@ internal class Popout : Window Tab.PopOut = false; ChatLogWindow.Plugin.SaveConfig(); } -} \ No newline at end of file +}