[Plugins] Implement proper execution

This commit is contained in:
Beef 2023-01-03 08:05:16 +00:00
parent 7465e42354
commit 5c4026685e
3 changed files with 81 additions and 9 deletions

View file

@ -2,8 +2,9 @@ import { ReactNative as RN, stylesheet } from "@metro/common";
import { Forms } from "@ui/components";
import { Plugin } from "@types";
import { getAssetIDByName } from "@/ui/assets";
import { startPlugin, stopPlugin } from "@/lib/plugins";
const { FormRow, FormText, FormSwitch } = Forms;
const { FormRow, FormSwitch } = Forms;
const styles = stylesheet.createThemedStyleSheet({
card: {
@ -35,8 +36,9 @@ export default function PluginCard({ plugin }: PluginCardProps) {
<FormSwitch
value={plugin.enabled}
onValueChange={(v: boolean) => {
alert(v);
if (v) startPlugin(plugin.id); else stopPlugin(plugin.id);
setEnabled(v);
plugin.enabled = enabled;
}}
/>
}

View file

@ -49,7 +49,7 @@ export default function Plugins() {
keyExtractor={item => item.id}
/>
<RN.View style={styles.disclaimer}>
<FormText style={styles.disclaimerText}>Plugins are currently non-functional, but most of the infrastructure and UI is in place.</FormText>
<FormText style={styles.disclaimerText}>Plugins are currently non-permanent whilst I find a storage solution.</FormText>
</RN.View>
</>
)