Settings API for loader, preview branch select

This commit is contained in:
AAGaming
2022-08-24 23:51:20 -04:00
parent fe2b6b0283
commit 79db0c779d
8 changed files with 127 additions and 17 deletions
@@ -1,15 +1,10 @@
import { Field, Toggle } from 'decky-frontend-lib';
import { useEffect, useState } from 'react';
import { FaBug } from 'react-icons/fa';
import { useSetting } from '../../../../utils/hooks/useSetting';
export default function RemoteDebuggingSettings() {
const [allowRemoteDebugging, setAllowRemoteDebugging] = useState<boolean>(false);
useEffect(() => {
(async () => {
const res = (await window.DeckyPluginLoader.callServerMethod('remote_debugging_allowed')) as { result: boolean };
setAllowRemoteDebugging(res.result);
})();
}, []);
const [allowRemoteDebugging, setAllowRemoteDebugging] = useSetting<boolean>('cef_forward', false);
return (
<Field
@@ -22,7 +17,7 @@ export default function RemoteDebuggingSettings() {
icon={<FaBug style={{ display: 'block' }} />}
>
<Toggle
value={allowRemoteDebugging}
value={allowRemoteDebugging || false}
onChange={(toggleValue) => {
setAllowRemoteDebugging(toggleValue);
if (toggleValue) window.DeckyPluginLoader.callServerMethod('allow_remote_debugging');