fix(pi): only show testing context menu if testing is on

This commit is contained in:
goat 2022-11-06 15:28:22 +01:00
parent a31a17018f
commit 4675d77a2d
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -2128,32 +2128,35 @@ internal class PluginInstallerWindow : Window, IDisposable
if (ImGui.BeginPopupContextItem("InstalledItemContextMenu"))
{
var repoManifest = this.pluginListAvailable.FirstOrDefault(x => x.InternalName == plugin.Manifest.InternalName);
if (repoManifest?.IsTestingExclusive == true)
ImGui.BeginDisabled();
if (ImGui.MenuItem(Locs.PluginContext_TestingOptIn, string.Empty, optIn != null))
if (configuration.DoPluginTest)
{
if (optIn != null)
{
configuration.PluginTestingOptIns!.Remove(optIn);
var repoManifest = this.pluginListAvailable.FirstOrDefault(x => x.InternalName == plugin.Manifest.InternalName);
if (repoManifest?.IsTestingExclusive == true)
ImGui.BeginDisabled();
if (plugin.Manifest.TestingAssemblyVersion > repoManifest?.AssemblyVersion)
if (ImGui.MenuItem(Locs.PluginContext_TestingOptIn, string.Empty, optIn != null))
{
if (optIn != null)
{
this.testingWarningModalOnNextFrame = true;
configuration.PluginTestingOptIns!.Remove(optIn);
if (plugin.Manifest.TestingAssemblyVersion > repoManifest?.AssemblyVersion)
{
this.testingWarningModalOnNextFrame = true;
}
}
}
else
{
configuration.PluginTestingOptIns!.Add(new PluginTestingOptIn(plugin.Manifest.InternalName));
else
{
configuration.PluginTestingOptIns!.Add(new PluginTestingOptIn(plugin.Manifest.InternalName));
}
configuration.QueueSave();
}
configuration.QueueSave();
if (repoManifest?.IsTestingExclusive == true)
ImGui.EndDisabled();
}
if (repoManifest?.IsTestingExclusive == true)
ImGui.EndDisabled();
if (ImGui.MenuItem(Locs.PluginContext_DeletePluginConfigReload))
{
Log.Debug($"Deleting config for {plugin.Manifest.InternalName}");