From 7c95d3a7294001ed932702bc40a51ca182d6d9da Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 11 Sep 2024 02:24:39 -0400 Subject: [PATCH] afterSave & Fix CustomSounds --- src/components/PluginSettings/PluginModal.tsx | 2 ++ src/utils/types.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/components/PluginSettings/PluginModal.tsx b/src/components/PluginSettings/PluginModal.tsx index 0771a82a..89c8f5fa 100644 --- a/src/components/PluginSettings/PluginModal.tsx +++ b/src/components/PluginSettings/PluginModal.tsx @@ -126,6 +126,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti } let restartNeeded = false; + if (plugin.name === "CustomSounds") restartNeeded = true; for (const [key, value] of Object.entries(tempSettings)) { const option = plugin.options[key]; pluginSettings[key] = value; @@ -133,6 +134,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti if (option?.restartNeeded) restartNeeded = true; } if (restartNeeded) onRestartNeeded(); + plugin.afterSave = true; onClose(); } diff --git a/src/utils/types.ts b/src/utils/types.ts index e5486e9a..da9d3999 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -117,6 +117,11 @@ export interface PluginDef { * If a string is returned, show the error to the user. */ beforeSave?(options: Record): Promisable; + /** + * Check that this returns true after allowing a save to complete. + * If a string is returned, show the error to the user. + */ + afterSave?: boolean; /** * Allows you to specify a custom Component that will be rendered in your * plugin's settings page