From c8f54c1b0c0fa30104a5cf44390c9418646c814f Mon Sep 17 00:00:00 2001 From: Beef Date: Tue, 4 Apr 2023 19:56:34 +0100 Subject: [PATCH] [Plugins] Delete plugin data on removal --- src/lib/plugins.ts | 5 ++++- src/ui/settings/components/PluginCard.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/plugins.ts b/src/lib/plugins.ts index 200701e..0ca7210 100644 --- a/src/lib/plugins.ts +++ b/src/lib/plugins.ts @@ -1,8 +1,10 @@ -import { Indexable, PluginManifest, Plugin } from "@types"; +import { Indexable, PluginManifest, Plugin, MMKVManager } from "@types"; import { awaitSyncWrapper, createMMKVBackend, createStorage, wrapSync } from "@lib/storage"; import logger, { logModule } from "@lib/logger"; import safeFetch from "@utils/safeFetch"; +const MMKVManager = window.nativeModuleProxy.MMKVManager as MMKVManager; + type EvaledPlugin = { onLoad?(): void; onUnload(): void; @@ -114,6 +116,7 @@ export function removePlugin(id: string) { if (!id.endsWith("/")) id += "/"; const plugin = plugins[id]; if (plugin.enabled) stopPlugin(id); + MMKVManager.removeItem(id); delete plugins[id]; } diff --git a/src/ui/settings/components/PluginCard.tsx b/src/ui/settings/components/PluginCard.tsx index 5137cf9..6e19c85 100644 --- a/src/ui/settings/components/PluginCard.tsx +++ b/src/ui/settings/components/PluginCard.tsx @@ -59,7 +59,7 @@ export default function PluginCard({ plugin, index }: PluginCardProps) { isDestructive: true, onPress: () => showConfirmationAlert({ title: "Wait!", - content: `Are you sure you wish to delete ${plugin.manifest.name}?`, + content: `Are you sure you wish to delete ${plugin.manifest.name}? This will remove all of the plugin's data.`, confirmText: "Delete", cancelText: "Cancel", confirmColor: ButtonColors.RED,