[UI] Preliminary UI, ported somewhat from pre-rewrite

This commit is contained in:
Beef 2022-10-18 23:59:45 +01:00
parent 110181b6fd
commit 10ccca3e40
6 changed files with 132 additions and 1 deletions

View file

@ -0,0 +1,48 @@
import { React, ReactNative as RN } from "@metro/common";
import { findByProps } from "@metro/filters";
import Version from "./Version";
const { FormRow, FormSection, FormText } = findByProps("FormSection");
const hermesProps = window.HermesInternal.getRuntimeProperties();
const rnVer = RN.Platform.constants.reactNativeVersion;
export default function Settings() {
const versions = [
{
label: "Discord",
version: RN.NativeModules.InfoDictionaryManager.Version,
},
{
label: "React",
version: React.version,
},
{
label: "React Native",
version: `${rnVer.major || 0}.${rnVer.minor || 0}.${rnVer.patch || 0}`,
},
{
label: "Hermes",
version: `${hermesProps["OSS Release Version"]} ${hermesProps["Build"]}`,
},
{
label: "Bytecode",
version: hermesProps["Bytecode Version"],
},
];
return (
<>
{/* Why is there still a divider? */}
<FormSection title="Actions" android_noDivider>
<FormRow
label="Reload Discord"
trailing={FormRow.Arrow}
onPress={() => RN.NativeModules.BundleUpdaterManager.reload()}
/>
</FormSection>
<FormSection title="Versions">
{versions.map((v) => <Version label={v.label} version={v.version} /> )}
</FormSection>
</>
)
}

View file

@ -0,0 +1,20 @@
import { React } from "@metro/common";
import { findByProps } from "@metro/filters";
const { FormRow, FormSection } = findByProps("FormSection");
interface SettingsSectionProps {
navigation: any;
}
export default function SettingsSection({ navigation }: SettingsSectionProps) {
return (
<FormSection key="Vendetta" title="Vendetta">
<FormRow
label="Settings"
trailing={FormRow.Arrow}
onPress={() => navigation.push("VendettaSettings")}
/>
</FormSection>
)
}

View file

@ -0,0 +1,18 @@
import { React } from "@metro/common";
import { findByProps } from "@metro/filters";
interface VersionProps {
label: string;
version: string
}
const { FormRow, FormText } = findByProps("FormSection");
export default function Version({ label, version }: VersionProps) {
return (
<FormRow
label={label}
trailing={() => <FormText>{version}</FormText>}
/>
)
}