Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional warning to plugin config reset modal #2005

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ internal class PluginInstallerWindow : Window, IDisposable

private bool deletePluginConfigWarningModalDrawing = true;
private bool deletePluginConfigWarningModalOnNextFrame = false;
private bool deletePluginConfigWarningModalExplainTesting = false;
private string deletePluginConfigWarningModalPluginName = string.Empty;
private TaskCompletionSource<bool>? deletePluginConfigWarningModalTaskCompletionSource;

Expand Down Expand Up @@ -732,7 +733,7 @@ private void DrawHeader()
}
}
}

private void DrawFooter()
{
var configuration = Service<DalamudConfiguration>.Get();
Expand Down Expand Up @@ -972,10 +973,11 @@ private void DrawTestingWarningModal()
}
}

private Task<bool> ShowDeletePluginConfigWarningModal(string pluginName)
private Task<bool> ShowDeletePluginConfigWarningModal(string pluginName, bool explainTesting = false)
{
this.deletePluginConfigWarningModalOnNextFrame = true;
this.deletePluginConfigWarningModalPluginName = pluginName;
this.deletePluginConfigWarningModalExplainTesting = explainTesting;
this.deletePluginConfigWarningModalTaskCompletionSource = new TaskCompletionSource<bool>();
return this.deletePluginConfigWarningModalTaskCompletionSource.Task;
}
Expand All @@ -986,6 +988,13 @@ private void DrawDeletePluginConfigWarningModal()

if (ImGui.BeginPopupModal(modalTitle, ref this.deletePluginConfigWarningModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar))
{
if (this.deletePluginConfigWarningModalExplainTesting)
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange);
ImGui.Text(Locs.DeletePluginConfigWarningModal_ExplainTesting());
ImGui.PopStyleColor();
}

ImGui.Text(Locs.DeletePluginConfigWarningModal_Body(this.deletePluginConfigWarningModalPluginName));
ImGui.Spacing();

Expand Down Expand Up @@ -2898,7 +2907,7 @@ private void DrawInstalledPluginContextMenu(LocalPlugin plugin, PluginTestingOpt

if (ImGui.MenuItem(Locs.PluginContext_DeletePluginConfigReload))
{
this.ShowDeletePluginConfigWarningModal(plugin.Manifest.Name).ContinueWith(t =>
this.ShowDeletePluginConfigWarningModal(plugin.Manifest.Name, optIn != null).ContinueWith(t =>
{
var shouldDelete = t.Result;

Expand Down Expand Up @@ -4263,7 +4272,9 @@ public static string Notifications_UpdatesInstalled(List<PluginUpdateStatus> upd

public static string DeletePluginConfigWarningModal_Title => Loc.Localize("InstallerDeletePluginConfigWarning", "Warning###InstallerDeletePluginConfigWarning");

public static string DeletePluginConfigWarningModal_Body(string pluginName) => Loc.Localize("InstallerDeletePluginConfigWarningBody", "Are you sure you want to delete all data and configuration for {0}?").Format(pluginName);
public static string DeletePluginConfigWarningModal_ExplainTesting() => Loc.Localize("InstallerDeletePluginConfigWarningExplainTesting", "Do not select this option if you are only trying to disable testing!");

public static string DeletePluginConfigWarningModal_Body(string pluginName) => Loc.Localize("InstallerDeletePluginConfigWarningBody", "Are you sure you want to delete all data and configuration for {0}?\nYou will lose all of your settings for this plugin.").Format(pluginName);

public static string DeletePluginConfirmWarningModal_Yes => Loc.Localize("InstallerDeletePluginConfigWarningYes", "Yes");

Expand Down