Misc Fixes
This commit is contained in:
parent
9d59730381
commit
3df2582053
2 changed files with 4 additions and 9 deletions
|
|
@ -69,7 +69,7 @@ export async function toggleEnabled(name: string) {
|
|||
if (failures.length) {
|
||||
console.error(`Failed to start dependencies for ${plugin.name}: ${failures.join(", ")}`);
|
||||
showNotice("Failed to start dependencies: " + failures.join(", "), "Close", () => null);
|
||||
return;
|
||||
return false;
|
||||
} else if (restartNeeded) {
|
||||
settings.enabled = true;
|
||||
onRestartNeeded();
|
||||
|
|
@ -84,7 +84,7 @@ export async function toggleEnabled(name: string) {
|
|||
|
||||
if (wasEnabled && !plugin.started) {
|
||||
settings.enabled = !wasEnabled;
|
||||
return false;
|
||||
return await beforeReturn(settings, wasEnabled);
|
||||
}
|
||||
|
||||
const result = wasEnabled ? Vencord.Plugins.stopPlugin(plugin) : Vencord.Plugins.startPlugin(plugin);
|
||||
|
|
@ -94,7 +94,7 @@ export async function toggleEnabled(name: string) {
|
|||
const msg = `Error while ${wasEnabled ? "stopping" : "starting"} plugin ${plugin.name}`;
|
||||
console.error(msg);
|
||||
showErrorToast(msg);
|
||||
return await beforeReturn(settings, wasEnabled);
|
||||
return false;
|
||||
}
|
||||
|
||||
settings.enabled = !wasEnabled;
|
||||
|
|
|
|||
|
|
@ -336,12 +336,7 @@ export default definePlugin({
|
|||
onClick={async () => {
|
||||
try {
|
||||
const success = await toggleEnabled(matchedPlugin);
|
||||
if (success) {
|
||||
showToast(
|
||||
`${isEnabled ? "Disabled" : "Enabled"} ${matchedPlugin}`,
|
||||
Toasts.Type.SUCCESS
|
||||
);
|
||||
}
|
||||
if (success) showToast(`${isEnabled ? "Disabled" : "Enabled"} ${matchedPlugin}`, Toasts.Type.SUCCESS);
|
||||
} catch (e) {
|
||||
new Logger(this.name).error("Error while toggling:", e);
|
||||
showToast(`Failed to toggle ${matchedPlugin}`, Toasts.Type.FAILURE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue