diff --git a/src/core/plugins/index.ts b/src/core/plugins/index.ts index f9b76a9..e1e4bd9 100644 --- a/src/core/plugins/index.ts +++ b/src/core/plugins/index.ts @@ -7,7 +7,7 @@ interface CorePlugin { // Called from @lib/plugins export const getCorePlugins = (): Record => ({ - "bunny.quickinstall": require("./vd-quick-install") + "bunny.quickinstall": require("./quickinstall") }); /** diff --git a/src/core/ui/settings/pages/Plugins/index.tsx b/src/core/ui/settings/pages/Plugins/index.tsx index e4a6fa5..fe5c8fc 100644 --- a/src/core/ui/settings/pages/Plugins/index.tsx +++ b/src/core/ui/settings/pages/Plugins/index.tsx @@ -4,7 +4,8 @@ import PluginCard from "@core/ui/settings/pages/Plugins/PluginCard"; import { VdPluginManager, VendettaPlugin } from "@core/vendetta/plugins"; import { settings } from "@lib/api/settings"; import { useProxy } from "@lib/api/storage"; -import { registeredPlugins } from "@lib/plugins"; +import { useProxy as useProxyNew } from "@lib/api/storage/new"; +import { getId, getPluginSettingsComponent, isPluginEnabled, pluginSettings, registeredPlugins, startPlugin, stopPlugin } from "@lib/plugins"; import { BunnyPluginManifest } from "@lib/plugins/types"; import { Author } from "@lib/utils/types"; import { SegmentedControl, SegmentedControlPages, useSegmentedControlState } from "@metro/common/components"; @@ -52,25 +53,28 @@ function resolveFromVdPlugin(vdPlugin: VendettaPlugin): PluginManifest { } function resolveFromBunnyPlugin(manifest: BunnyPluginManifest): PluginManifest { + return { id: manifest.id, name: manifest.name, description: manifest.description, authors: manifest.authors, isEnabled() { - return false; + return isPluginEnabled(getId(manifest)); }, usePluginState() { - + useProxyNew(pluginSettings); }, toggle(start: boolean) { - + start + ? startPlugin(getId(manifest)) + : stopPlugin(getId(manifest)); }, resolveSheetComponent() { return import("./sheets/PluginInfoActionSheet"); }, getPluginSettingsComponent() { - return null; + return getPluginSettingsComponent(getId(manifest)); }, }; } diff --git a/src/core/ui/settings/pages/Plugins/sheets/PluginInfoActionSheet.tsx b/src/core/ui/settings/pages/Plugins/sheets/PluginInfoActionSheet.tsx index 94f9961..bfdb88b 100644 --- a/src/core/ui/settings/pages/Plugins/sheets/PluginInfoActionSheet.tsx +++ b/src/core/ui/settings/pages/Plugins/sheets/PluginInfoActionSheet.tsx @@ -1,3 +1,35 @@ -export default function PluginInfoActionSheet() { - return <>; +import { findAssetId } from "@lib/api/assets"; +import { hideSheet } from "@lib/ui/sheets"; +import { ActionSheet, Button, Text } from "@metro/common/components"; +import { ScrollView, View } from "react-native"; + +import { PluginInfoActionSheetProps } from "./common"; + +export default function PluginInfoActionSheet({ plugin, navigation }: PluginInfoActionSheetProps) { + plugin.usePluginState(); + + return + + + + {plugin.name} + + + {plugin.getPluginSettingsComponent() &&