[Storage] Rework everything (#10)
* [storage] rework everything * [storage] expose createProxy * [storage] add useProxy hook * [storage] fix settings.ts * [Storage] Implement wrapSync, fix UI * [storage] fix storage * [plugins] re-add plugin loading * [storage] fix fix storage * [storage] make wrapSync more magical * [storage] save deletes * [ui] hack around plugin removal... again * [plugins] make plugin storage work * [storage] expose api --------- Co-authored-by: Beef <beefers@riseup.net>
This commit is contained in:
parent
7282d45d39
commit
4c9fe8fcaf
11 changed files with 201 additions and 87 deletions
|
@ -1,8 +1,9 @@
|
|||
import { ReactNative as RN, navigation } from "@metro/common";
|
||||
import { Forms } from "@ui/components";
|
||||
import { getAssetIDByName } from "@ui/assets";
|
||||
import { showToast } from "@/ui/toasts";
|
||||
import { showToast } from "@ui/toasts";
|
||||
import { connectToDebugger } from "@lib/debug";
|
||||
import { useProxy } from "@lib/storage";
|
||||
import settings from "@lib/settings";
|
||||
import logger from "@lib/logger";
|
||||
import Subpage from "@ui/settings/components/Subpage";
|
||||
|
@ -11,33 +12,32 @@ import AssetBrowser from "@ui/settings/pages/AssetBrowser";
|
|||
const { FormSection, FormRow, FormInput, FormDivider } = Forms;
|
||||
|
||||
export default function Developer() {
|
||||
const [debuggerUrl, setDebuggerUrl] = React.useState(settings.debuggerUrl || "");
|
||||
useProxy(settings);
|
||||
|
||||
return (
|
||||
<RN.View style={{ flex: 1 }}>
|
||||
<FormSection title="Debug">
|
||||
<FormInput
|
||||
value={debuggerUrl}
|
||||
value={settings.debuggerUrl}
|
||||
onChange={(v: string) => {
|
||||
settings.debuggerUrl = v;
|
||||
setDebuggerUrl(v);
|
||||
}}
|
||||
title="DEBUGGER URL"
|
||||
/>
|
||||
<FormDivider />
|
||||
<FormRow
|
||||
label="Connect to debug websocket"
|
||||
leading={() => <FormRow.Icon source={getAssetIDByName("copy")} />}
|
||||
onPress={() => connectToDebugger(debuggerUrl)}
|
||||
leading={<FormRow.Icon source={getAssetIDByName("copy")} />}
|
||||
onPress={() => connectToDebugger(settings.debuggerUrl)}
|
||||
/>
|
||||
<FormDivider />
|
||||
{window.__vendetta_rdc && <FormRow
|
||||
label="Connect to React DevTools"
|
||||
leading={() => <FormRow.Icon source={getAssetIDByName("ic_badge_staff")} />}
|
||||
leading={<FormRow.Icon source={getAssetIDByName("ic_badge_staff")} />}
|
||||
onPress={() => {
|
||||
try {
|
||||
window.__vendetta_rdc?.connectToDevTools({
|
||||
host: debuggerUrl.split(":")[0],
|
||||
host: settings.debuggerUrl.split(":")?.[0],
|
||||
resolveRNStyle: RN.StyleSheet.flatten,
|
||||
});
|
||||
} catch(e) {
|
||||
|
@ -50,7 +50,7 @@ export default function Developer() {
|
|||
<FormSection title="Other">
|
||||
<FormRow
|
||||
label="Asset Browser"
|
||||
leading={() => <FormRow.Icon source={getAssetIDByName("ic_media_upload")} />}
|
||||
leading={<FormRow.Icon source={getAssetIDByName("ic_media_upload")} />}
|
||||
trailing={FormRow.Arrow}
|
||||
onPress={() => navigation.push(Subpage, {
|
||||
name: "Asset Browser",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue