From f9062b614ff025fef7ed68a0822dabe80708bdfe Mon Sep 17 00:00:00 2001 From: Anna Date: Sun, 29 Sep 2024 23:29:33 -0400 Subject: [PATCH] feat: add button to reset first-time setup --- Ui/Tabs/Settings.cs | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/Ui/Tabs/Settings.cs b/Ui/Tabs/Settings.cs index a71d017..9ea08a0 100644 --- a/Ui/Tabs/Settings.cs +++ b/Ui/Tabs/Settings.cs @@ -290,22 +290,31 @@ ref this.Plugin.Config.OneClickCollectionId } } - if (!this.Plugin.Server.Listening && ImGuiHelper.CentredWideButton("Try starting server")) { - ImGui.Separator(); + if (ImGui.TreeNodeEx("Miscellaneous")) { + using var treePop = new OnDispose(ImGui.TreePop); - try { - this.Plugin.Server.StartServer(); - } catch (HttpListenerException ex) { - ErrorHelper.Handle(ex, "Could not start server"); - this.Plugin.NotificationManager.AddNotification(new Notification { - Type = NotificationType.Error, - MinimizedText = "Could not start server", - Content = $"Could not start server. {Plugin.Name} will not be able to work with the website.", - InitialDuration = TimeSpan.FromSeconds(5), - }); + if (this.Plugin.Config.FirstTimeSetupComplete && ImGuiHelper.CentredWideButton("Reset first-time setup")) { + anyChanged = true; + this.Plugin.Config.FirstTimeSetupComplete = false; + this.Plugin.DoFirstTimeSetup(); + } + + if (!this.Plugin.Server.Listening && ImGuiHelper.CentredWideButton("Try starting server")) { + try { + this.Plugin.Server.StartServer(); + } catch (HttpListenerException ex) { + ErrorHelper.Handle(ex, "Could not start server"); + this.Plugin.NotificationManager.AddNotification(new Notification { + Type = NotificationType.Error, + MinimizedText = "Could not start server", + Content = $"Could not start server. {Plugin.Name} will not be able to work with the website.", + InitialDuration = TimeSpan.FromSeconds(5), + }); + } } } + ImGui.Separator(); var version = Plugin.Version ?? "???";