feat(PluginInstallerWindow): support Changelog manifest property

This commit is contained in:
goat 2021-09-28 00:23:37 +02:00
parent ef16e346c6
commit 53e38668bc
No known key found for this signature in database
GPG key ID: F18F057873895461
3 changed files with 34 additions and 0 deletions

View file

@ -45,6 +45,9 @@ namespace Dalamud.Interface.Internal.Windows
private static readonly ModuleLog Log = new("PLUGINW");
private readonly Vector4 changelogBgColor = new(0.114f, 0.584f, 0.192f, 0.678f);
private readonly Vector4 changelogTextColor = new(0.812f, 1.000f, 0.816f, 1.000f);
private readonly TextureWrap defaultIcon;
private readonly TextureWrap troubleIcon;
private readonly TextureWrap updateIcon;
@ -1226,6 +1229,7 @@ namespace Dalamud.Interface.Internal.Windows
}
// Freshly updated
var thisWasUpdated = false;
if (this.updatedPlugins != null && !plugin.IsDev)
{
var update = this.updatedPlugins.FirstOrDefault(update => update.InternalName == plugin.Manifest.InternalName);
@ -1233,6 +1237,7 @@ namespace Dalamud.Interface.Internal.Windows
{
if (update.WasUpdated)
{
thisWasUpdated = true;
label += Locs.PluginTitleMod_Updated;
}
else
@ -1362,6 +1367,28 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Unindent();
}
if (thisWasUpdated && !plugin.Manifest.Changelog.IsNullOrEmpty())
{
ImGuiHelpers.ScaledDummy(5);
ImGui.PushStyleColor(ImGuiCol.ChildBg, this.changelogBgColor);
ImGui.PushStyleColor(ImGuiCol.Text, this.changelogTextColor);
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(7, 5));
if (ImGui.BeginChild("##changelog", new Vector2(-1, 100), true, ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.NoNavInputs | ImGuiWindowFlags.AlwaysAutoResize))
{
ImGui.Text("Changelog:");
ImGuiHelpers.ScaledDummy(2);
ImGui.TextWrapped(plugin.Manifest.Changelog);
}
ImGui.EndChild();
ImGui.PopStyleVar();
ImGui.PopStyleColor(2);
}
ImGui.PopID();
}

View file

@ -35,6 +35,12 @@ namespace Dalamud.Plugin.Internal.Types
[JsonProperty]
public string? Description { get; init; }
/// <summary>
/// Gets a changelog.
/// </summary>
[JsonProperty]
public string? Changelog { get; init; }
/// <summary>
/// Gets a list of tags defined on the plugin.
/// </summary>

View file

@ -21,6 +21,7 @@ namespace Dalamud.Support
/// <param name="plugin">The plugin to send feedback about.</param>
/// <param name="content">The content of the feedback.</param>
/// <param name="reporter">The reporter name.</param>
/// <param name="includeException">Whether or not the most recent exception to occur should be included in the report.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
public static async Task SendFeedback(PluginManifest plugin, string content, string reporter, bool includeException)
{