mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: warning modal for testing plugin downgrades
This commit is contained in:
parent
09c4828a9e
commit
86b381ea49
1 changed files with 50 additions and 0 deletions
|
|
@ -69,6 +69,9 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
private LocalPlugin? updateModalPlugin = null;
|
||||
private TaskCompletionSource<bool>? updateModalTaskCompletionSource;
|
||||
|
||||
private bool testingWarningModalDrawing = true;
|
||||
private bool testingWarningModalOnNextFrame = false;
|
||||
|
||||
private bool feedbackModalDrawing = true;
|
||||
private bool feedbackModalOnNextFrame = false;
|
||||
private bool feedbackModalOnNextFrameDontClear = false;
|
||||
|
|
@ -215,6 +218,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.DrawFooter();
|
||||
this.DrawErrorModal();
|
||||
this.DrawUpdateModal();
|
||||
this.DrawTestingWarningModal();
|
||||
this.DrawFeedbackModal();
|
||||
this.DrawProgressOverlay();
|
||||
}
|
||||
|
|
@ -634,6 +638,39 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawTestingWarningModal()
|
||||
{
|
||||
var modalTitle = Locs.TestingWarningModal_Title;
|
||||
|
||||
if (ImGui.BeginPopupModal(modalTitle, ref this.testingWarningModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar))
|
||||
{
|
||||
ImGui.Text(Locs.TestingWarningModal_DowngradeBody);
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
var buttonWidth = 120f;
|
||||
ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2);
|
||||
|
||||
if (ImGui.Button(Locs.ErrorModalButton_Ok, new Vector2(buttonWidth, 40)))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
if (this.testingWarningModalOnNextFrame)
|
||||
{
|
||||
// NOTE(goat): ImGui cannot open a modal if no window is focused, at the moment.
|
||||
// If people click out of the installer into the game while a plugin is installing, we won't be able to show a modal if we don't grab focus.
|
||||
ImGui.SetWindowFocus(this.WindowName);
|
||||
|
||||
ImGui.OpenPopup(modalTitle);
|
||||
this.testingWarningModalOnNextFrame = false;
|
||||
this.testingWarningModalDrawing = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawFeedbackModal()
|
||||
{
|
||||
var modalTitle = Locs.FeedbackModal_Title;
|
||||
|
|
@ -2063,6 +2100,11 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
if (optIn != null)
|
||||
{
|
||||
configuration.PluginTestingOptIns!.Remove(optIn);
|
||||
|
||||
if (plugin.Manifest.TestingAssemblyVersion > repoManifest?.AssemblyVersion)
|
||||
{
|
||||
this.testingWarningModalOnNextFrame = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3028,6 +3070,14 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
#endregion
|
||||
|
||||
#region Testing Warning Modal
|
||||
|
||||
public static string TestingWarningModal_Title => Loc.Localize("InstallerTestingWarning", "Warning###InstallerTestingWarning");
|
||||
|
||||
public static string TestingWarningModal_DowngradeBody => Loc.Localize("InstallerTestingWarningDowngradeBody", "Take care! If you opt out of testing for a plugin, you will remain on the testing version until it is deleted and reinstalled, or the non-testing version of the plugin is updated.\nKeep in mind that you may lose the settings for this plugin if you downgrade manually.");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Plugin Update chatbox
|
||||
|
||||
public static string PluginUpdateHeader_Chatbox => Loc.Localize("DalamudPluginUpdates", "Updates:");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue