[Plugins] Delete plugin data on removal
This commit is contained in:
parent
c10355ef70
commit
c8f54c1b0c
2 changed files with 5 additions and 2 deletions
|
@ -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 { awaitSyncWrapper, createMMKVBackend, createStorage, wrapSync } from "@lib/storage";
|
||||||
import logger, { logModule } from "@lib/logger";
|
import logger, { logModule } from "@lib/logger";
|
||||||
import safeFetch from "@utils/safeFetch";
|
import safeFetch from "@utils/safeFetch";
|
||||||
|
|
||||||
|
const MMKVManager = window.nativeModuleProxy.MMKVManager as MMKVManager;
|
||||||
|
|
||||||
type EvaledPlugin = {
|
type EvaledPlugin = {
|
||||||
onLoad?(): void;
|
onLoad?(): void;
|
||||||
onUnload(): void;
|
onUnload(): void;
|
||||||
|
@ -114,6 +116,7 @@ export function removePlugin(id: string) {
|
||||||
if (!id.endsWith("/")) id += "/";
|
if (!id.endsWith("/")) id += "/";
|
||||||
const plugin = plugins[id];
|
const plugin = plugins[id];
|
||||||
if (plugin.enabled) stopPlugin(id);
|
if (plugin.enabled) stopPlugin(id);
|
||||||
|
MMKVManager.removeItem(id);
|
||||||
delete plugins[id];
|
delete plugins[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ export default function PluginCard({ plugin, index }: PluginCardProps) {
|
||||||
isDestructive: true,
|
isDestructive: true,
|
||||||
onPress: () => showConfirmationAlert({
|
onPress: () => showConfirmationAlert({
|
||||||
title: "Wait!",
|
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",
|
confirmText: "Delete",
|
||||||
cancelText: "Cancel",
|
cancelText: "Cancel",
|
||||||
confirmColor: ButtonColors.RED,
|
confirmColor: ButtonColors.RED,
|
||||||
|
|
Loading…
Reference in a new issue