[Global] Loader config and identity (#17)
* [TS] Add definition for DCDFileManager * [Storage] Introduce backends * [Settings] Add loader config * [TS] Update storage definitions * [TS] Update loader config and identity types * [Loader] Expose loader config and identity * [UI] Actually update UI for the new loader config fields
This commit is contained in:
parent
cfccd5f5b2
commit
1840577fb5
7 changed files with 154 additions and 19 deletions
|
@ -1,17 +1,28 @@
|
|||
import { ReactNative as RN, NavigationNative } from "@metro/common";
|
||||
import { Forms } from "@ui/components";
|
||||
import { ReactNative as RN, NavigationNative, stylesheet, constants } from "@metro/common";
|
||||
import { Forms, General } from "@ui/components";
|
||||
import { getAssetIDByName } from "@ui/assets";
|
||||
import { showToast } from "@ui/toasts";
|
||||
import { connectToDebugger } from "@lib/debug";
|
||||
import { useProxy } from "@lib/storage";
|
||||
import settings from "@lib/settings";
|
||||
import settings, { loaderConfig } from "@lib/settings";
|
||||
import logger from "@lib/logger";
|
||||
|
||||
const { FormSection, FormRow, FormInput, FormDivider } = Forms;
|
||||
const { FormSection, FormRow, FormSwitchRow, FormInput, FormDivider } = Forms;
|
||||
const { Text } = General;
|
||||
|
||||
const styles = stylesheet.createThemedStyleSheet({
|
||||
code: {
|
||||
fontFamily: constants.Fonts.CODE_SEMIBOLD,
|
||||
includeFontPadding: false,
|
||||
fontSize: 12,
|
||||
}
|
||||
});
|
||||
|
||||
export default function Developer() {
|
||||
const navigation = NavigationNative.useNavigation();
|
||||
|
||||
useProxy(settings);
|
||||
useProxy(loaderConfig);
|
||||
|
||||
return (
|
||||
<RN.ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 38 }}>
|
||||
|
@ -46,6 +57,32 @@ export default function Developer() {
|
|||
}}
|
||||
/>}
|
||||
</FormSection>
|
||||
{window.__vendetta_loader?.features.loaderConfig && <FormSection title="Loader config">
|
||||
<FormSwitchRow
|
||||
label="Load from custom url"
|
||||
subLabel={"Load Vendetta from a custom endpoint."}
|
||||
leading={<FormRow.Icon source={getAssetIDByName("copy")} />}
|
||||
value={loaderConfig.customLoadUrl.enabled}
|
||||
onValueChange={(v: boolean) => {
|
||||
loaderConfig.customLoadUrl.enabled = v;
|
||||
}}
|
||||
/>
|
||||
{loaderConfig.customLoadUrl.enabled && <FormInput
|
||||
value={loaderConfig.customLoadUrl.url}
|
||||
onChange={(v: string) => loaderConfig.customLoadUrl.url = v}
|
||||
placeholder="http://localhost:4040/vendetta.js"
|
||||
title="VENDETTA URL"
|
||||
/>}
|
||||
{window.__vendetta_loader.features.devtools && <FormSwitchRow
|
||||
label="Load React DevTools"
|
||||
subLabel={`Version: ${window.__vendetta_loader.features.devtools.version}`}
|
||||
leading={<FormRow.Icon source={getAssetIDByName("ic_badge_staff")} />}
|
||||
value={loaderConfig.loadReactDevTools}
|
||||
onValueChange={(v: boolean) => {
|
||||
loaderConfig.loadReactDevTools = v;
|
||||
}}
|
||||
/>}
|
||||
</FormSection>}
|
||||
<FormSection title="Other">
|
||||
<FormRow
|
||||
label="Asset Browser"
|
||||
|
@ -56,4 +93,4 @@ export default function Developer() {
|
|||
</FormSection>
|
||||
</RN.ScrollView>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue