From d7c510647e2c3fa0f76a22181da789ae552cc6ed Mon Sep 17 00:00:00 2001 From: Aireil <33433913+Aireil@users.noreply.github.com> Date: Sat, 18 Mar 2023 16:14:28 +0100 Subject: [PATCH 1/4] feat: display 3pp changelogs --- .../DalamudChangelogManager.cs | 25 ++++++++++++++----- .../PluginInstaller/PluginChangelogEntry.cs | 14 +++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/DalamudChangelogManager.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/DalamudChangelogManager.cs index 622ad912b..b932c7d32 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/DalamudChangelogManager.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/DalamudChangelogManager.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Dalamud.Plugin.Internal; +using Dalamud.Utility; using Serilog; namespace Dalamud.Interface.Internal.Windows.PluginInstaller; @@ -49,17 +50,29 @@ internal class DalamudChangelogManager foreach (var plugin in this.manager.InstalledPlugins) { - if (plugin.Manifest.IsThirdParty || !plugin.Manifest.IsDip17Plugin) - continue; + if (!plugin.Manifest.IsThirdParty) + { + if (!plugin.Manifest.IsDip17Plugin) + continue; - var pluginChangelogs = await client.GetFromJsonAsync(string.Format( + var pluginChangelogs = await client.GetFromJsonAsync(string.Format( PluginChangelogUrl, plugin.Manifest.InternalName, plugin.Manifest.Dip17Channel)); - changelogs = changelogs.Concat(pluginChangelogs.Versions - .Where(x => x.Dip17Track == plugin.Manifest.Dip17Channel) - .Select(x => new PluginChangelogEntry(plugin, x))); + changelogs = changelogs.Concat(pluginChangelogs.Versions + .Where(x => x.Dip17Track == plugin.Manifest.Dip17Channel) + .Select(x => new PluginChangelogEntry(plugin, x))); + } + else + { + if (plugin.Manifest.Changelog.IsNullOrWhitespace()) + continue; + + changelogs = changelogs.Append(new PluginChangelogEntry(plugin)); + } + + } this.Changelogs = changelogs.OrderByDescending(x => x.Date).ToList(); diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginChangelogEntry.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginChangelogEntry.cs index 495d59d64..247e2d353 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginChangelogEntry.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginChangelogEntry.cs @@ -25,6 +25,20 @@ internal class PluginChangelogEntry : IChangelogEntry this.Date = history.PublishedAt; } + /// + /// Initializes a new instance of the class. + /// + /// The plugin manifest. + public PluginChangelogEntry(LocalPlugin plugin) + { + this.Plugin = plugin; + + this.Version = plugin.Manifest.EffectiveVersion.ToString(); + this.Text = plugin.Manifest.Changelog ?? Loc.Localize("ChangelogNoText", "No changelog for this version."); + this.Author = plugin.Manifest.Author; + this.Date = DateTimeOffset.FromUnixTimeSeconds(this.Plugin.Manifest.LastUpdate).DateTime; + } + /// /// Gets the respective plugin. /// From 1d7580122cb4219065f3dafd31147cad49ce3c5d Mon Sep 17 00:00:00 2001 From: Aireil <33433913+Aireil@users.noreply.github.com> Date: Sat, 18 Mar 2023 16:15:10 +0100 Subject: [PATCH 2/4] feat: make search work in changelog tab --- .../Internal/Windows/PluginInstaller/PluginInstallerWindow.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 99559372f..017b020fb 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -909,7 +909,8 @@ internal class PluginInstallerWindow : Window, IDisposable changelogs = this.dalamudChangelogManager.Changelogs.OfType(); } - var sortedChangelogs = changelogs?.OrderByDescending(x => x.Date).ToList(); + var sortedChangelogs = changelogs?.Where(x => this.searchText.IsNullOrWhitespace() || x.Title.ToLowerInvariant().Contains(this.searchText.ToLowerInvariant())) + .OrderByDescending(x => x.Date).ToList(); if (sortedChangelogs == null || !sortedChangelogs.Any()) { From 14d5d28cde70828d23fcc4e4444f17f7013adaae Mon Sep 17 00:00:00 2001 From: Aireil <33433913+Aireil@users.noreply.github.com> Date: Sat, 18 Mar 2023 16:15:31 +0100 Subject: [PATCH 3/4] feat: add author name in changelog tab --- .../Windows/PluginInstaller/PluginInstallerWindow.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 017b020fb..c7847f58e 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -1748,6 +1748,11 @@ internal class PluginInstallerWindow : Window, IDisposable ImGui.SameLine(); ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{log.Version}"); + if (log.Author != null) + { + ImGui.SameLine(); + ImGui.TextColored(ImGuiColors.DalamudGrey3, Locs.PluginBody_AuthorWithoutDownloadCount(log.Author)); + } cursor.Y += ImGui.GetTextLineHeightWithSpacing(); ImGui.SetCursorPos(cursor); From 38a6630715dce10a228b3f28c61973c352020e9b Mon Sep 17 00:00:00 2001 From: Aireil <33433913+Aireil@users.noreply.github.com> Date: Sat, 18 Mar 2023 16:36:14 +0100 Subject: [PATCH 4/4] style: fix spacing --- .../Windows/PluginInstaller/DalamudChangelogManager.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/DalamudChangelogManager.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/DalamudChangelogManager.cs index b932c7d32..646285561 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/DalamudChangelogManager.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/DalamudChangelogManager.cs @@ -56,9 +56,9 @@ internal class DalamudChangelogManager continue; var pluginChangelogs = await client.GetFromJsonAsync(string.Format( - PluginChangelogUrl, - plugin.Manifest.InternalName, - plugin.Manifest.Dip17Channel)); + PluginChangelogUrl, + plugin.Manifest.InternalName, + plugin.Manifest.Dip17Channel)); changelogs = changelogs.Concat(pluginChangelogs.Versions .Where(x => x.Dip17Track == plugin.Manifest.Dip17Channel) @@ -71,8 +71,6 @@ internal class DalamudChangelogManager changelogs = changelogs.Append(new PluginChangelogEntry(plugin)); } - - } this.Changelogs = changelogs.OrderByDescending(x => x.Date).ToList();