mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: show outdated plugins when searched for
This commit is contained in:
parent
543431c459
commit
645e9aede4
3 changed files with 32 additions and 12 deletions
|
|
@ -56,6 +56,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
private readonly Task<TextureWrap> emptyTextureTask;
|
private readonly Task<TextureWrap> emptyTextureTask;
|
||||||
private readonly Task<TextureWrap> disabledIconTask;
|
private readonly Task<TextureWrap> disabledIconTask;
|
||||||
|
private readonly Task<TextureWrap> outdatedInstallableIconTask;
|
||||||
private readonly Task<TextureWrap> defaultIconTask;
|
private readonly Task<TextureWrap> defaultIconTask;
|
||||||
private readonly Task<TextureWrap> troubleIconTask;
|
private readonly Task<TextureWrap> troubleIconTask;
|
||||||
private readonly Task<TextureWrap> updateIconTask;
|
private readonly Task<TextureWrap> updateIconTask;
|
||||||
|
|
@ -74,6 +75,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
this.emptyTextureTask = imwst.ContinueWith(task => task.Result.Manager.LoadImageRaw(new byte[64], 8, 8, 4)!);
|
this.emptyTextureTask = imwst.ContinueWith(task => task.Result.Manager.LoadImageRaw(new byte[64], 8, 8, 4)!);
|
||||||
this.defaultIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "defaultIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
this.defaultIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "defaultIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
||||||
this.disabledIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "disabledIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
this.disabledIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "disabledIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
||||||
|
this.outdatedInstallableIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "outdatedInstallableIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
||||||
this.troubleIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "troubleIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
this.troubleIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "troubleIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
||||||
this.updateIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "updateIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
this.updateIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "updateIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
||||||
this.installedIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "installedIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
this.installedIconTask = imwst.ContinueWith(task => TaskWrapIfNonNull(task.Result.Manager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "installedIcon.png"))) ?? this.emptyTextureTask).Unwrap();
|
||||||
|
|
@ -95,12 +97,19 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
: this.emptyTextureTask.GetAwaiter().GetResult();
|
: this.emptyTextureTask.GetAwaiter().GetResult();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the default plugin icon.
|
/// Gets the disabled plugin icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TextureWrap DisabledIcon => this.disabledIconTask.IsCompleted
|
public TextureWrap DisabledIcon => this.disabledIconTask.IsCompleted
|
||||||
? this.disabledIconTask.Result
|
? this.disabledIconTask.Result
|
||||||
: this.disabledIconTask.GetAwaiter().GetResult();
|
: this.disabledIconTask.GetAwaiter().GetResult();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the outdated installable plugin icon.
|
||||||
|
/// </summary>
|
||||||
|
public TextureWrap OutdatedInstallableIcon => this.outdatedInstallableIconTask.IsCompleted
|
||||||
|
? this.outdatedInstallableIconTask.Result
|
||||||
|
: this.outdatedInstallableIconTask.GetAwaiter().GetResult();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the default plugin icon.
|
/// Gets the default plugin icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1377,7 +1377,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
||||||
return ready;
|
return ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool DrawPluginCollapsingHeader(string label, LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty, bool trouble, bool updateAvailable, bool isNew, Action drawContextMenuAction, int index)
|
private bool DrawPluginCollapsingHeader(string label, LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty, bool trouble, bool updateAvailable, bool isNew, bool installableOutdated, Action drawContextMenuAction, int index)
|
||||||
{
|
{
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
|
|
@ -1428,14 +1428,14 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
||||||
iconTex = cachedIconTex;
|
iconTex = cachedIconTex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginDisabled)
|
if (pluginDisabled || installableOutdated)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.5f);
|
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Image(iconTex.ImGuiHandle, iconSize);
|
ImGui.Image(iconTex.ImGuiHandle, iconSize);
|
||||||
|
|
||||||
if (pluginDisabled)
|
if (pluginDisabled || installableOutdated)
|
||||||
{
|
{
|
||||||
ImGui.PopStyleVar();
|
ImGui.PopStyleVar();
|
||||||
}
|
}
|
||||||
|
|
@ -1450,6 +1450,8 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
||||||
ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize);
|
ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize);
|
||||||
else if (trouble && !pluginDisabled)
|
else if (trouble && !pluginDisabled)
|
||||||
ImGui.Image(this.imageCache.TroubleIcon.ImGuiHandle, iconSize);
|
ImGui.Image(this.imageCache.TroubleIcon.ImGuiHandle, iconSize);
|
||||||
|
else if (installableOutdated)
|
||||||
|
ImGui.Image(this.imageCache.OutdatedInstallableIcon.ImGuiHandle, iconSize);
|
||||||
else if (pluginDisabled)
|
else if (pluginDisabled)
|
||||||
ImGui.Image(this.imageCache.DisabledIcon.ImGuiHandle, iconSize);
|
ImGui.Image(this.imageCache.DisabledIcon.ImGuiHandle, iconSize);
|
||||||
else if (isLoaded && isThirdParty)
|
else if (isLoaded && isThirdParty)
|
||||||
|
|
@ -1488,7 +1490,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
||||||
ImGui.SetCursorPos(cursor);
|
ImGui.SetCursorPos(cursor);
|
||||||
|
|
||||||
// Outdated warning
|
// Outdated warning
|
||||||
if (plugin is { IsOutdated: true, IsBanned: false })
|
if (plugin is { IsOutdated: true, IsBanned: false } || installableOutdated)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
||||||
ImGui.TextWrapped(Locs.PluginBody_Outdated);
|
ImGui.TextWrapped(Locs.PluginBody_Outdated);
|
||||||
|
|
@ -1616,6 +1618,8 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
||||||
var useTesting = PluginManager.UseTesting(manifest);
|
var useTesting = PluginManager.UseTesting(manifest);
|
||||||
var wasSeen = this.WasPluginSeen(manifest.InternalName);
|
var wasSeen = this.WasPluginSeen(manifest.InternalName);
|
||||||
|
|
||||||
|
var isOutdated = manifest.DalamudApiLevel < PluginManager.DalamudApiLevel;
|
||||||
|
|
||||||
// Check for valid versions
|
// Check for valid versions
|
||||||
if ((useTesting && manifest.TestingAssemblyVersion == null) || manifest.AssemblyVersion == null)
|
if ((useTesting && manifest.TestingAssemblyVersion == null) || manifest.AssemblyVersion == null)
|
||||||
{
|
{
|
||||||
|
|
@ -1635,7 +1639,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
||||||
ImGui.PushID($"available{index}{manifest.InternalName}");
|
ImGui.PushID($"available{index}{manifest.InternalName}");
|
||||||
|
|
||||||
var isThirdParty = manifest.SourceRepo.IsThirdParty;
|
var isThirdParty = manifest.SourceRepo.IsThirdParty;
|
||||||
if (this.DrawPluginCollapsingHeader(label, null, manifest, isThirdParty, false, false, !wasSeen, () => this.DrawAvailablePluginContextMenu(manifest), index))
|
if (this.DrawPluginCollapsingHeader(label, null, manifest, isThirdParty, false, false, !wasSeen, isOutdated, () => this.DrawAvailablePluginContextMenu(manifest), index))
|
||||||
{
|
{
|
||||||
if (!wasSeen)
|
if (!wasSeen)
|
||||||
configuration.SeenPluginInternalName.Add(manifest.InternalName);
|
configuration.SeenPluginInternalName.Add(manifest.InternalName);
|
||||||
|
|
@ -1662,7 +1666,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
var disabled = this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress;
|
var disabled = this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress || isOutdated;
|
||||||
|
|
||||||
var versionString = useTesting
|
var versionString = useTesting
|
||||||
? $"{manifest.TestingAssemblyVersion}"
|
? $"{manifest.TestingAssemblyVersion}"
|
||||||
|
|
@ -1878,7 +1882,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
||||||
ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}");
|
ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}");
|
||||||
var hasChangelog = !plugin.Manifest.Changelog.IsNullOrEmpty();
|
var hasChangelog = !plugin.Manifest.Changelog.IsNullOrEmpty();
|
||||||
|
|
||||||
if (this.DrawPluginCollapsingHeader(label, plugin, plugin.Manifest, plugin.Manifest.IsThirdParty, trouble, availablePluginUpdate != default, false, () => this.DrawInstalledPluginContextMenu(plugin), index))
|
if (this.DrawPluginCollapsingHeader(label, plugin, plugin.Manifest, plugin.Manifest.IsThirdParty, trouble, availablePluginUpdate != default, false, false, () => this.DrawInstalledPluginContextMenu(plugin), index))
|
||||||
{
|
{
|
||||||
if (!this.WasPluginSeen(plugin.Manifest.InternalName))
|
if (!this.WasPluginSeen(plugin.Manifest.InternalName))
|
||||||
configuration.SeenPluginInternalName.Add(plugin.Manifest.InternalName);
|
configuration.SeenPluginInternalName.Add(plugin.Manifest.InternalName);
|
||||||
|
|
@ -2484,15 +2488,21 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
||||||
{
|
{
|
||||||
var searchString = this.searchText.ToLowerInvariant();
|
var searchString = this.searchText.ToLowerInvariant();
|
||||||
var hasSearchString = !string.IsNullOrWhiteSpace(searchString);
|
var hasSearchString = !string.IsNullOrWhiteSpace(searchString);
|
||||||
|
var oldApi = manifest.DalamudApiLevel < PluginManager.DalamudApiLevel;
|
||||||
|
var installed = this.IsManifestInstalled(manifest).IsInstalled;
|
||||||
|
|
||||||
|
if (oldApi && !hasSearchString && !installed)
|
||||||
|
return true;
|
||||||
|
|
||||||
return hasSearchString && !(
|
return hasSearchString && !(
|
||||||
manifest.Name.ToLowerInvariant().Contains(searchString) ||
|
manifest.Name.ToLowerInvariant().Contains(searchString) ||
|
||||||
|
manifest.InternalName.ToLowerInvariant().Contains(searchString) ||
|
||||||
(!manifest.Author.IsNullOrEmpty() && manifest.Author.Equals(this.searchText, StringComparison.InvariantCultureIgnoreCase)) ||
|
(!manifest.Author.IsNullOrEmpty() && manifest.Author.Equals(this.searchText, StringComparison.InvariantCultureIgnoreCase)) ||
|
||||||
(!manifest.Punchline.IsNullOrEmpty() && manifest.Punchline.ToLowerInvariant().Contains(searchString)) ||
|
(!manifest.Punchline.IsNullOrEmpty() && manifest.Punchline.ToLowerInvariant().Contains(searchString)) ||
|
||||||
(manifest.Tags != null && manifest.Tags.Contains(searchString, StringComparer.InvariantCultureIgnoreCase)));
|
(manifest.Tags != null && manifest.Tags.Contains(searchString, StringComparer.InvariantCultureIgnoreCase)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private (bool IsInstalled, LocalPlugin Plugin) IsManifestInstalled(RemotePluginManifest? manifest)
|
private (bool IsInstalled, LocalPlugin Plugin) IsManifestInstalled(PluginManifest? manifest)
|
||||||
{
|
{
|
||||||
if (manifest == null) return (false, default);
|
if (manifest == null) return (false, default);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1169,8 +1169,8 @@ internal partial class PluginManager : IDisposable, IServiceType
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// API level
|
// API level - we keep the API before this in the installer to show as "outdated"
|
||||||
if (manifest.DalamudApiLevel < DalamudApiLevel && !this.LoadAllApiLevels)
|
if (manifest.DalamudApiLevel < DalamudApiLevel - 1 && !this.LoadAllApiLevels)
|
||||||
{
|
{
|
||||||
Log.Verbose($"API Level: {manifest.InternalName} - {manifest.AssemblyVersion} - {manifest.TestingAssemblyVersion}");
|
Log.Verbose($"API Level: {manifest.InternalName} - {manifest.AssemblyVersion} - {manifest.TestingAssemblyVersion}");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1235,6 +1235,7 @@ internal partial class PluginManager : IDisposable, IServiceType
|
||||||
var updates = this.AvailablePlugins
|
var updates = this.AvailablePlugins
|
||||||
.Where(remoteManifest => plugin.Manifest.InternalName == remoteManifest.InternalName)
|
.Where(remoteManifest => plugin.Manifest.InternalName == remoteManifest.InternalName)
|
||||||
.Where(remoteManifest => plugin.Manifest.InstalledFromUrl == remoteManifest.SourceRepo.PluginMasterUrl || !remoteManifest.SourceRepo.IsThirdParty)
|
.Where(remoteManifest => plugin.Manifest.InstalledFromUrl == remoteManifest.SourceRepo.PluginMasterUrl || !remoteManifest.SourceRepo.IsThirdParty)
|
||||||
|
.Where(remoteManifest => remoteManifest.DalamudApiLevel == DalamudApiLevel)
|
||||||
.Select(remoteManifest =>
|
.Select(remoteManifest =>
|
||||||
{
|
{
|
||||||
var useTesting = UseTesting(remoteManifest);
|
var useTesting = UseTesting(remoteManifest);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue