diff --git a/Dalamud/Interface/Internal/Windows/PluginImageCache.cs b/Dalamud/Interface/Internal/Windows/PluginImageCache.cs index 43661c9ab..a16314598 100644 --- a/Dalamud/Interface/Internal/Windows/PluginImageCache.cs +++ b/Dalamud/Interface/Internal/Windows/PluginImageCache.cs @@ -56,6 +56,7 @@ namespace Dalamud.Interface.Internal.Windows private readonly Task emptyTextureTask; private readonly Task disabledIconTask; + private readonly Task outdatedInstallableIconTask; private readonly Task defaultIconTask; private readonly Task troubleIconTask; private readonly Task 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.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.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.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(); @@ -95,12 +97,19 @@ namespace Dalamud.Interface.Internal.Windows : this.emptyTextureTask.GetAwaiter().GetResult(); /// - /// Gets the default plugin icon. + /// Gets the disabled plugin icon. /// public TextureWrap DisabledIcon => this.disabledIconTask.IsCompleted ? this.disabledIconTask.Result : this.disabledIconTask.GetAwaiter().GetResult(); + /// + /// Gets the outdated installable plugin icon. + /// + public TextureWrap OutdatedInstallableIcon => this.outdatedInstallableIconTask.IsCompleted + ? this.outdatedInstallableIconTask.Result + : this.outdatedInstallableIconTask.GetAwaiter().GetResult(); + /// /// Gets the default plugin icon. /// diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 3decf7558..4948ecbff 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -1377,7 +1377,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller 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(); @@ -1428,14 +1428,14 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller iconTex = cachedIconTex; } - if (pluginDisabled) + if (pluginDisabled || installableOutdated) { - ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.5f); + ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.4f); } ImGui.Image(iconTex.ImGuiHandle, iconSize); - if (pluginDisabled) + if (pluginDisabled || installableOutdated) { ImGui.PopStyleVar(); } @@ -1450,6 +1450,8 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize); else if (trouble && !pluginDisabled) ImGui.Image(this.imageCache.TroubleIcon.ImGuiHandle, iconSize); + else if (installableOutdated) + ImGui.Image(this.imageCache.OutdatedInstallableIcon.ImGuiHandle, iconSize); else if (pluginDisabled) ImGui.Image(this.imageCache.DisabledIcon.ImGuiHandle, iconSize); else if (isLoaded && isThirdParty) @@ -1488,7 +1490,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller ImGui.SetCursorPos(cursor); // Outdated warning - if (plugin is { IsOutdated: true, IsBanned: false }) + if (plugin is { IsOutdated: true, IsBanned: false } || installableOutdated) { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); ImGui.TextWrapped(Locs.PluginBody_Outdated); @@ -1616,6 +1618,8 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller var useTesting = PluginManager.UseTesting(manifest); var wasSeen = this.WasPluginSeen(manifest.InternalName); + var isOutdated = manifest.DalamudApiLevel < PluginManager.DalamudApiLevel; + // Check for valid versions if ((useTesting && manifest.TestingAssemblyVersion == null) || manifest.AssemblyVersion == null) { @@ -1635,7 +1639,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller ImGui.PushID($"available{index}{manifest.InternalName}"); 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) configuration.SeenPluginInternalName.Add(manifest.InternalName); @@ -1662,7 +1666,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller ImGuiHelpers.ScaledDummy(5); // 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 ? $"{manifest.TestingAssemblyVersion}" @@ -1878,7 +1882,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}"); 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)) configuration.SeenPluginInternalName.Add(plugin.Manifest.InternalName); @@ -2484,15 +2488,21 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller { var searchString = this.searchText.ToLowerInvariant(); 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 && !( manifest.Name.ToLowerInvariant().Contains(searchString) || + manifest.InternalName.ToLowerInvariant().Contains(searchString) || (!manifest.Author.IsNullOrEmpty() && manifest.Author.Equals(this.searchText, StringComparison.InvariantCultureIgnoreCase)) || (!manifest.Punchline.IsNullOrEmpty() && manifest.Punchline.ToLowerInvariant().Contains(searchString)) || (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); diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index d432c69d6..1257335ff 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -1169,8 +1169,8 @@ internal partial class PluginManager : IDisposable, IServiceType return false; } - // API level - if (manifest.DalamudApiLevel < DalamudApiLevel && !this.LoadAllApiLevels) + // API level - we keep the API before this in the installer to show as "outdated" + if (manifest.DalamudApiLevel < DalamudApiLevel - 1 && !this.LoadAllApiLevels) { Log.Verbose($"API Level: {manifest.InternalName} - {manifest.AssemblyVersion} - {manifest.TestingAssemblyVersion}"); return false; @@ -1235,6 +1235,7 @@ internal partial class PluginManager : IDisposable, IServiceType var updates = this.AvailablePlugins .Where(remoteManifest => plugin.Manifest.InternalName == remoteManifest.InternalName) .Where(remoteManifest => plugin.Manifest.InstalledFromUrl == remoteManifest.SourceRepo.PluginMasterUrl || !remoteManifest.SourceRepo.IsThirdParty) + .Where(remoteManifest => remoteManifest.DalamudApiLevel == DalamudApiLevel) .Select(remoteManifest => { var useTesting = UseTesting(remoteManifest);