mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-02 14:04:36 +01:00
Merge pull request #1161 from Aireil/changelog_improvements
This commit is contained in:
commit
a7a7b0a55a
3 changed files with 41 additions and 10 deletions
|
|
@ -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,27 @@ 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<PluginHistory>(string.Format(
|
||||
PluginChangelogUrl,
|
||||
plugin.Manifest.InternalName,
|
||||
plugin.Manifest.Dip17Channel));
|
||||
var pluginChangelogs = await client.GetFromJsonAsync<PluginHistory>(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();
|
||||
|
|
|
|||
|
|
@ -25,6 +25,20 @@ internal class PluginChangelogEntry : IChangelogEntry
|
|||
this.Date = history.PublishedAt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginChangelogEntry"/> class.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin manifest.</param>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the respective plugin.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -909,7 +909,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
changelogs = this.dalamudChangelogManager.Changelogs.OfType<PluginChangelogEntry>();
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
|
|
@ -1747,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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue