From 83edcc583f6d831a7a2e7cfd31af92d66f2a39c7 Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Thu, 15 Jul 2021 03:08:02 +0200 Subject: [PATCH] feat: still show outdated plugins with a warning --- .../Internal/Windows/PluginInstallerWindow.cs | 20 +++++++++++++++++++ Dalamud/Plugin/Internal/PluginManager.cs | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs index faf8e022f..6780ade6b 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs @@ -614,6 +614,12 @@ namespace Dalamud.Interface.Internal.Windows } } + // Outdated API level + if (plugin.Manifest.DalamudApiLevel < PluginManager.DalamudApiLevel) + { + label += Locs.PluginTitleMod_OutdatedError; + } + if (ImGui.CollapsingHeader($"{label}###Header{index}{plugin.Manifest.InternalName}")) { var manifest = plugin.Manifest; @@ -644,6 +650,13 @@ namespace Dalamud.Interface.Internal.Windows ImGui.TextWrapped(manifest.Description); } + if (plugin.Manifest.DalamudApiLevel < PluginManager.DalamudApiLevel) + { + ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); + ImGui.TextWrapped(Locs.PluginBody_Outdated); + ImGui.PopStyleColor(); + } + // Available commands (if loaded) if (plugin.IsLoaded) { @@ -681,6 +694,9 @@ namespace Dalamud.Interface.Internal.Windows // Disable everything if the updater is running or another plugin is operating var disabled = this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress; + // Disable everything if the plugin is outdated + disabled = disabled || plugin.Manifest.DalamudApiLevel < PluginManager.DalamudApiLevel; + if (plugin.State == PluginState.InProgress) { ImGuiComponents.DisabledButton(Locs.PluginButton_Working); @@ -1062,6 +1078,8 @@ namespace Dalamud.Interface.Internal.Windows public static string PluginTitleMod_UnloadError => Loc.Localize("InstallerUnloadError", " (unload error)"); + public static string PluginTitleMod_OutdatedError => Loc.Localize("InstallerOutdatedError", " (outdated)"); + #endregion #region Plugin context menu @@ -1082,6 +1100,8 @@ namespace Dalamud.Interface.Internal.Windows public static string PluginBody_DeleteDevPlugin => Loc.Localize("InstallerDeleteDevPlugin ", " To delete this plugin, please remove it from the devPlugins folder."); + public static string PluginBody_Outdated => Loc.Localize("InstallerOutdatedPluginBody ", "This plugin is outdated and incompatible at the moment. Please wait for it to be updated by its author."); + #endregion #region Plugin buttons diff --git a/Dalamud/Plugin/Internal/PluginManager.cs b/Dalamud/Plugin/Internal/PluginManager.cs index 9cf488dc6..7a32e9eab 100644 --- a/Dalamud/Plugin/Internal/PluginManager.cs +++ b/Dalamud/Plugin/Internal/PluginManager.cs @@ -469,6 +469,10 @@ namespace Dalamud.Plugin.Internal { Log.Information(ex, $"Dev plugin failed to load, adding anyways: {dllFile.Name}"); } + else if (plugin.Manifest.DalamudApiLevel < DalamudApiLevel) + { + Log.Information(ex, $"Plugin was outdated, adding anyways: {dllFile.Name}"); + } else { PluginLocations.Remove(plugin.AssemblyName.FullName);