Display banned plugins for updating

This commit is contained in:
Raymond 2021-09-21 10:15:51 -04:00
parent f1e5a21494
commit f98193a06d
2 changed files with 31 additions and 2 deletions

View file

@ -868,6 +868,7 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.SameLine();
var cursor = ImGui.GetCursorPos();
// Name
ImGui.Text(label);
@ -1130,6 +1131,13 @@ namespace Dalamud.Interface.Internal.Windows
trouble = true;
}
// Banned
if (plugin.IsBanned)
{
label += Locs.PluginTitleMod_BannedError;
trouble = true;
}
ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}");
if (this.DrawPluginCollapsingHeader(label, plugin.Manifest, trouble, availablePluginUpdate != default, false, () => this.DrawInstalledPluginContextMenu(plugin), index))
@ -1181,6 +1189,13 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.PopStyleColor();
}
if (plugin.IsBanned)
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
ImGui.TextWrapped(Locs.PluginBody_Banned);
ImGui.PopStyleColor();
}
// Available commands (if loaded)
if (plugin.IsLoaded)
{
@ -1264,7 +1279,7 @@ namespace Dalamud.Interface.Internal.Windows
var disabled = this.updateStatus == OperationStatus.InProgress || this.installStatus == OperationStatus.InProgress;
// Disable everything if the plugin is outdated
disabled = disabled || (plugin.IsOutdated && !configuration.LoadAllApiLevels);
disabled = disabled || (plugin.IsOutdated && !configuration.LoadAllApiLevels) || plugin.IsBanned;
if (plugin.State == PluginState.InProgress)
{
@ -1460,7 +1475,7 @@ namespace Dalamud.Interface.Internal.Windows
private void DrawDeletePluginButton(LocalPlugin plugin)
{
var unloaded = plugin.State == PluginState.Unloaded;
var showButton = unloaded && (plugin.IsDev || plugin.IsOutdated);
var showButton = unloaded && (plugin.IsDev || plugin.IsOutdated || plugin.IsBanned);
if (!showButton)
return;
@ -1926,6 +1941,8 @@ namespace Dalamud.Interface.Internal.Windows
public static string PluginTitleMod_OutdatedError => Loc.Localize("InstallerOutdatedError", " (outdated)");
public static string PluginTitleMod_BannedError => Loc.Localize("InstallerOutdatedError", " (banned)");
public static string PluginTitleMod_New => Loc.Localize("InstallerNewPlugin ", " New!");
#endregion
@ -1960,6 +1977,8 @@ namespace Dalamud.Interface.Internal.Windows
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.");
public static string PluginBody_Banned => Loc.Localize("InstallerBannedPluginBody ", "This plugin version is banned and not available at the moment. Please wait for it to be updated by its author.");
#endregion
#region Plugin buttons

View file

@ -129,6 +129,9 @@ namespace Dalamud.Plugin.Internal
this.testingFile.Delete();
}
var pluginManager = Service<PluginManager>.Get();
this.IsBanned = pluginManager.IsManifestBanned(this.Manifest);
this.SaveManifest();
}
@ -183,6 +186,11 @@ namespace Dalamud.Plugin.Internal
/// </summary>
public bool IsTesting => this.Manifest.IsTestingExclusive || this.Manifest.Testing;
/// <summary>
/// Gets a value indicating whether this plugin has been banned.
/// </summary>
public bool IsBanned { get; }
/// <summary>
/// Gets a value indicating whether this plugin is dev plugin.
/// </summary>
@ -262,7 +270,9 @@ namespace Dalamud.Plugin.Internal
{
var manifestFile = LocalPluginManifest.GetManifestFile(this.DllFile);
if (manifestFile.Exists)
{
this.Manifest = LocalPluginManifest.Load(manifestFile);
}
}
}