[plugins] Fix clearing data
This commit is contained in:
parent
1d2577edb2
commit
31facf072c
2 changed files with 3 additions and 3 deletions
|
|
@ -1,8 +1,7 @@
|
|||
import { formatString, Strings } from "@core/i18n";
|
||||
import Card, { CardWrapper } from "@core/ui/components/Card";
|
||||
import { getAssetIDByName } from "@lib/api/assets";
|
||||
import { MMKVManager } from "@lib/api/native/modules";
|
||||
import { useProxy } from "@lib/api/storage";
|
||||
import { purgeStorage, useProxy } from "@lib/api/storage";
|
||||
import { BunnyPlugin, fetchPlugin, getSettings, removePlugin, startPlugin, stopPlugin } from "@lib/managers/plugins";
|
||||
import { ButtonColors } from "@lib/utils/types";
|
||||
import { clipboard, NavigationNative } from "@metro/common";
|
||||
|
|
@ -102,7 +101,7 @@ export default function PluginCard({ item: plugin, index }: CardWrapper<BunnyPlu
|
|||
onConfirm: () => {
|
||||
stopThenStart(plugin, () => {
|
||||
try {
|
||||
MMKVManager.removeItem(plugin.id);
|
||||
purgeStorage(plugin.id);
|
||||
showToast(formatString("CLEAR_DATA_SUCCESSFUL", { name: plugin.manifest.name }), getAssetIDByName("trash"));
|
||||
} catch {
|
||||
showToast(formatString("CLEAR_DATA_FAILED", { name: plugin.manifest.name }), getAssetIDByName("Small"));
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ export const createFileBackend = (file: string, defaultData = {}, migratePromise
|
|||
get: async () => {
|
||||
await migratePromise;
|
||||
const path = `${FileManager.getConstants().DocumentsDirPath}/${file}`;
|
||||
|
||||
if (await FileManager.fileExists(path)) {
|
||||
const content = await FileManager.readFile(path, "utf8");
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue