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

View file

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