From 79db0c779d6942c6bdc6823a5faef57b5307f7b3 Mon Sep 17 00:00:00 2001
From: AAGaming <aa@mail.catvibers.me>
Date: Wed, 24 Aug 2022 23:51:20 -0400
Subject: Settings API for loader, preview branch select

---
 .../components/settings/pages/general/RemoteDebugging.tsx   | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

(limited to 'frontend/src/components/settings/pages/general/RemoteDebugging.tsx')

diff --git a/frontend/src/components/settings/pages/general/RemoteDebugging.tsx b/frontend/src/components/settings/pages/general/RemoteDebugging.tsx
index 3fea0513..36badf45 100644
--- a/frontend/src/components/settings/pages/general/RemoteDebugging.tsx
+++ b/frontend/src/components/settings/pages/general/RemoteDebugging.tsx
@@ -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');
-- 
cgit v1.2.3

