mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
pi: properly support changelogs for testing plugins
This commit is contained in:
parent
b40ffc24c1
commit
285d3bed42
2 changed files with 43 additions and 25 deletions
|
|
@ -1128,34 +1128,33 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
this.DrawChangelog(logEntry);
|
this.DrawChangelog(logEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private record PluginInstallerAvailablePluginProxy(RemotePluginManifest? RemoteManifest, LocalPlugin? LocalPlugin);
|
|
||||||
|
|
||||||
#pragma warning disable SA1201
|
#pragma warning disable SA1201
|
||||||
private void DrawAvailablePluginList()
|
private record PluginInstallerAvailablePluginProxy(RemotePluginManifest? RemoteManifest, LocalPlugin? LocalPlugin);
|
||||||
#pragma warning restore SA1201
|
|
||||||
|
private IEnumerable<PluginInstallerAvailablePluginProxy> GatherProxies()
|
||||||
{
|
{
|
||||||
|
var proxies = new List<PluginInstallerAvailablePluginProxy>();
|
||||||
|
|
||||||
var availableManifests = this.pluginListAvailable;
|
var availableManifests = this.pluginListAvailable;
|
||||||
var installedPlugins = this.pluginListInstalled.ToList(); // Copy intended
|
var installedPlugins = this.pluginListInstalled.ToList(); // Copy intended
|
||||||
|
|
||||||
if (availableManifests.Count == 0)
|
if (availableManifests.Count == 0)
|
||||||
{
|
{
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoCompatible);
|
ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoCompatible);
|
||||||
return;
|
return proxies;
|
||||||
}
|
}
|
||||||
|
|
||||||
var filteredAvailableManifests = availableManifests
|
var filteredAvailableManifests = availableManifests
|
||||||
.Where(rm => !this.IsManifestFiltered(rm))
|
.Where(rm => !this.IsManifestFiltered(rm))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (filteredAvailableManifests.Count == 0)
|
if (filteredAvailableManifests.Count == 0)
|
||||||
{
|
{
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching);
|
ImGui.TextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching);
|
||||||
return;
|
return proxies;
|
||||||
}
|
}
|
||||||
|
|
||||||
var proxies = new List<PluginInstallerAvailablePluginProxy>();
|
|
||||||
|
|
||||||
// Go through all AVAILABLE manifests, associate them with a NON-DEV local plugin, if one is available, and remove it from the pile
|
// Go through all AVAILABLE manifests, associate them with a NON-DEV local plugin, if one is available, and remove it from the pile
|
||||||
foreach (var availableManifest in this.categoryManager.GetCurrentCategoryContent(filteredAvailableManifests).Cast<RemotePluginManifest>())
|
foreach (var availableManifest in this.categoryManager.GetCurrentCategoryContent(filteredAvailableManifests).Cast<RemotePluginManifest>())
|
||||||
{
|
{
|
||||||
|
|
@ -1168,7 +1167,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
if (plugin != null)
|
if (plugin != null)
|
||||||
{
|
{
|
||||||
installedPlugins.Remove(plugin);
|
installedPlugins.Remove(plugin);
|
||||||
proxies.Add(new PluginInstallerAvailablePluginProxy(null, plugin));
|
proxies.Add(new PluginInstallerAvailablePluginProxy(availableManifest, plugin));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1187,8 +1186,14 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
proxies.Add(new PluginInstallerAvailablePluginProxy(null, installedPlugin));
|
proxies.Add(new PluginInstallerAvailablePluginProxy(null, installedPlugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return proxies;
|
||||||
|
}
|
||||||
|
#pragma warning restore SA1201
|
||||||
|
|
||||||
|
private void DrawAvailablePluginList()
|
||||||
|
{
|
||||||
var i = 0;
|
var i = 0;
|
||||||
foreach (var proxy in proxies)
|
foreach (var proxy in this.GatherProxies())
|
||||||
{
|
{
|
||||||
IPluginManifest applicableManifest = proxy.LocalPlugin != null ? proxy.LocalPlugin.Manifest : proxy.RemoteManifest;
|
IPluginManifest applicableManifest = proxy.LocalPlugin != null ? proxy.LocalPlugin.Manifest : proxy.RemoteManifest;
|
||||||
|
|
||||||
|
|
@ -1199,7 +1204,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
|
|
||||||
if (proxy.LocalPlugin != null)
|
if (proxy.LocalPlugin != null)
|
||||||
{
|
{
|
||||||
this.DrawInstalledPlugin(proxy.LocalPlugin, i++, true);
|
this.DrawInstalledPlugin(proxy.LocalPlugin, i++, proxy.RemoteManifest, true);
|
||||||
}
|
}
|
||||||
else if (proxy.RemoteManifest != null)
|
else if (proxy.RemoteManifest != null)
|
||||||
{
|
{
|
||||||
|
|
@ -1237,7 +1242,12 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
if (filterTesting && !manager.HasTestingOptIn(plugin.Manifest))
|
if (filterTesting && !manager.HasTestingOptIn(plugin.Manifest))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
this.DrawInstalledPlugin(plugin, i++);
|
// Find the applicable remote manifest
|
||||||
|
var remoteManifest = this.pluginListAvailable
|
||||||
|
.FirstOrDefault(rm => rm.InternalName == plugin.Manifest.InternalName &&
|
||||||
|
rm.RepoUrl == plugin.Manifest.RepoUrl);
|
||||||
|
|
||||||
|
this.DrawInstalledPlugin(plugin, i++, remoteManifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1266,7 +1276,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
var i = 0;
|
var i = 0;
|
||||||
foreach (var plugin in filteredList)
|
foreach (var plugin in filteredList)
|
||||||
{
|
{
|
||||||
this.DrawInstalledPlugin(plugin, i++);
|
this.DrawInstalledPlugin(plugin, i++, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2251,7 +2261,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawInstalledPlugin(LocalPlugin plugin, int index, bool showInstalled = false)
|
private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginManifest? remoteManifest, bool showInstalled = false)
|
||||||
{
|
{
|
||||||
var configuration = Service<DalamudConfiguration>.Get();
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
var commandManager = Service<CommandManager>.Get();
|
var commandManager = Service<CommandManager>.Get();
|
||||||
|
|
@ -2376,7 +2386,9 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}");
|
ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}");
|
||||||
var hasChangelog = !plugin.Manifest.Changelog.IsNullOrEmpty();
|
|
||||||
|
var applicableChangelog = plugin.IsTesting ? remoteManifest?.Changelog : remoteManifest?.TestingChangelog;
|
||||||
|
var hasChangelog = !applicableChangelog.IsNullOrWhitespace();
|
||||||
var didDrawChangelogInsideCollapsible = false;
|
var didDrawChangelogInsideCollapsible = false;
|
||||||
|
|
||||||
if (this.DrawPluginCollapsingHeader(label, plugin, plugin.Manifest, plugin.IsThirdParty, trouble, availablePluginUpdate != default, false, false, plugin.IsOrphaned, () => this.DrawInstalledPluginContextMenu(plugin, testingOptIn), index))
|
if (this.DrawPluginCollapsingHeader(label, plugin, plugin.Manifest, plugin.IsThirdParty, trouble, availablePluginUpdate != default, false, false, plugin.IsOrphaned, () => this.DrawInstalledPluginContextMenu(plugin, testingOptIn), index))
|
||||||
|
|
@ -2489,12 +2501,12 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
|
|
||||||
ImGui.Unindent();
|
ImGui.Unindent();
|
||||||
|
|
||||||
if (hasChangelog)
|
if (!applicableChangelog.IsNullOrWhitespace())
|
||||||
{
|
{
|
||||||
if (ImGui.TreeNode(Locs.PluginBody_CurrentChangeLog(plugin.EffectiveVersion)))
|
if (ImGui.TreeNode(Locs.PluginBody_CurrentChangeLog(plugin.EffectiveVersion)))
|
||||||
{
|
{
|
||||||
didDrawChangelogInsideCollapsible = true;
|
didDrawChangelogInsideCollapsible = true;
|
||||||
this.DrawInstalledPluginChangelog(plugin.Manifest);
|
this.DrawInstalledPluginChangelog(applicableChangelog);
|
||||||
ImGui.TreePop();
|
ImGui.TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2502,9 +2514,10 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
if (availablePluginUpdate != default && !availablePluginUpdate.UpdateManifest.Changelog.IsNullOrWhitespace())
|
if (availablePluginUpdate != default && !availablePluginUpdate.UpdateManifest.Changelog.IsNullOrWhitespace())
|
||||||
{
|
{
|
||||||
var availablePluginUpdateVersion = availablePluginUpdate.UseTesting ? availablePluginUpdate.UpdateManifest.TestingAssemblyVersion : availablePluginUpdate.UpdateManifest.AssemblyVersion;
|
var availablePluginUpdateVersion = availablePluginUpdate.UseTesting ? availablePluginUpdate.UpdateManifest.TestingAssemblyVersion : availablePluginUpdate.UpdateManifest.AssemblyVersion;
|
||||||
if (ImGui.TreeNode(Locs.PluginBody_UpdateChangeLog(availablePluginUpdateVersion)))
|
var availableChangelog = availablePluginUpdate.UseTesting ? availablePluginUpdate.UpdateManifest.TestingChangelog : availablePluginUpdate.UpdateManifest.Changelog;
|
||||||
|
if (!availableChangelog.IsNullOrWhitespace() && ImGui.TreeNode(Locs.PluginBody_UpdateChangeLog(availablePluginUpdateVersion)))
|
||||||
{
|
{
|
||||||
this.DrawInstalledPluginChangelog(availablePluginUpdate.UpdateManifest);
|
this.DrawInstalledPluginChangelog(availableChangelog);
|
||||||
ImGui.TreePop();
|
ImGui.TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2512,13 +2525,13 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
|
|
||||||
if (thisWasUpdated && hasChangelog && !didDrawChangelogInsideCollapsible)
|
if (thisWasUpdated && hasChangelog && !didDrawChangelogInsideCollapsible)
|
||||||
{
|
{
|
||||||
this.DrawInstalledPluginChangelog(plugin.Manifest);
|
this.DrawInstalledPluginChangelog(applicableChangelog);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopID();
|
ImGui.PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawInstalledPluginChangelog(IPluginManifest manifest)
|
private void DrawInstalledPluginChangelog(string changelog)
|
||||||
{
|
{
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
|
|
@ -2531,7 +2544,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
{
|
{
|
||||||
ImGui.Text("Changelog:");
|
ImGui.Text("Changelog:");
|
||||||
ImGuiHelpers.ScaledDummy(2);
|
ImGuiHelpers.ScaledDummy(2);
|
||||||
ImGuiHelpers.SafeTextWrapped(manifest.Changelog!);
|
ImGuiHelpers.SafeTextWrapped(changelog!);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChild();
|
ImGui.EndChild();
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@ internal record RemotePluginManifest : PluginManifest
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public PluginRepository SourceRepo { get; set; } = null!;
|
public PluginRepository SourceRepo { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the changelog to be shown when obtaining the testing version of the plugin.
|
||||||
|
/// </summary>
|
||||||
|
public string? TestingChangelog { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this plugin is eligible for testing.
|
/// Gets a value indicating whether this plugin is eligible for testing.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue