mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 12:23:39 +01:00
feat: display 3pp changelogs
This commit is contained in:
parent
bea7ab56b1
commit
d7c510647e
2 changed files with 33 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Dalamud.Plugin.Internal;
|
using Dalamud.Plugin.Internal;
|
||||||
|
using Dalamud.Utility;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.PluginInstaller;
|
namespace Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||||
|
|
@ -49,17 +50,29 @@ internal class DalamudChangelogManager
|
||||||
|
|
||||||
foreach (var plugin in this.manager.InstalledPlugins)
|
foreach (var plugin in this.manager.InstalledPlugins)
|
||||||
{
|
{
|
||||||
if (plugin.Manifest.IsThirdParty || !plugin.Manifest.IsDip17Plugin)
|
if (!plugin.Manifest.IsThirdParty)
|
||||||
continue;
|
{
|
||||||
|
if (!plugin.Manifest.IsDip17Plugin)
|
||||||
|
continue;
|
||||||
|
|
||||||
var pluginChangelogs = await client.GetFromJsonAsync<PluginHistory>(string.Format(
|
var pluginChangelogs = await client.GetFromJsonAsync<PluginHistory>(string.Format(
|
||||||
PluginChangelogUrl,
|
PluginChangelogUrl,
|
||||||
plugin.Manifest.InternalName,
|
plugin.Manifest.InternalName,
|
||||||
plugin.Manifest.Dip17Channel));
|
plugin.Manifest.Dip17Channel));
|
||||||
|
|
||||||
changelogs = changelogs.Concat(pluginChangelogs.Versions
|
changelogs = changelogs.Concat(pluginChangelogs.Versions
|
||||||
.Where(x => x.Dip17Track == plugin.Manifest.Dip17Channel)
|
.Where(x => x.Dip17Track == plugin.Manifest.Dip17Channel)
|
||||||
.Select(x => new PluginChangelogEntry(plugin, x)));
|
.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();
|
this.Changelogs = changelogs.OrderByDescending(x => x.Date).ToList();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,20 @@ internal class PluginChangelogEntry : IChangelogEntry
|
||||||
this.Date = history.PublishedAt;
|
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>
|
/// <summary>
|
||||||
/// Gets the respective plugin.
|
/// Gets the respective plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue