diff --git a/plugins/all-in-one/settings.tsx b/plugins/all-in-one/settings.tsx
index 1e1d9cd..e088e0c 100644
--- a/plugins/all-in-one/settings.tsx
+++ b/plugins/all-in-one/settings.tsx
@@ -8,10 +8,11 @@ import { View } from "react-native";
import { alerts } from "@vendetta/ui";
const { ScrollView } = findByProps("ScrollView");
-const { TableRowGroup, TableSwitchRow, Stack } = findByProps(
+const { TableRowGroup, TableSwitchRow, Stack, TableRow } = findByProps(
"TableSwitchRow",
"TableRowGroup",
"Stack",
+ "TableRow",
);
// Initialize default settings if not exist
@@ -42,29 +43,43 @@ if (!storage.enabledCommands) {
};
}
-const askForRestart = (commandName: string, enabled: boolean) => {
- return alerts.showConfirmationAlert({
- title: "Restart Required",
- content: `${enabled ? "Enabling" : "Disabling"} the ${commandName} command requires a Discord restart to take effect. Would you like to restart now?`,
- confirmText: "Restart",
- cancelText: "Later",
- confirmColor: "brand",
- onConfirm: () => {
- storage.enabledCommands[commandName] = enabled;
- window.enmity.plugins.reload("vendetta");
- },
- onCancel: () => {
- storage.enabledCommands[commandName] = !enabled; // Revert change if user doesn't want to restart
- },
- });
+if (!storage.pendingRestart) {
+ storage.pendingRestart = false;
+}
+
+const Credits = {
+ PETPET: "wolfieeee",
+ FACTS: "jdev082",
+ LISTS: "Kitomanari",
+ KONOCHAN: ["btmc727", "Rico040"],
};
export default function Settings() {
useProxy(storage);
const [rerender, forceRerender] = React.useReducer((x) => x + 1, 0);
+ // Check for changes when component unmounts
+ React.useEffect(() => {
+ return () => {
+ if (storage.pendingRestart) {
+ alerts.showConfirmationAlert({
+ title: "Restart Required",
+ content:
+ "Command changes require Discord to restart. Would you like to restart now?",
+ confirmText: "Restart",
+ cancelText: "Later",
+ confirmColor: "brand",
+ onConfirm: () => {
+ window.enmity.plugins.reload("vendetta");
+ },
+ });
+ }
+ };
+ }, []);
+
const handleCommandToggle = (commandName: string, value: boolean) => {
- askForRestart(commandName, value);
+ storage.enabledCommands[commandName] = value;
+ storage.pendingRestart = true;
forceRerender();
};
@@ -94,6 +109,11 @@ export default function Settings() {
forceRerender();
}}
/>
+
- {/* List Commands Settings */}
+ {/* List Commands */}
+
+
+
-