[Settings > General] Expose information about the device

This commit is contained in:
Jack Matthews 2023-01-10 23:28:54 -05:00 committed by Beef
parent 0ee50404a9
commit 8b480b92e2
2 changed files with 75 additions and 2 deletions

View file

@ -48,7 +48,9 @@ export const versionHash = "__vendettaVersion";
export function getDebugInfo(string: boolean = false) {
const InfoDictionaryManager = RN.NativeModules.InfoDictionaryManager;
const hermesProps = window.HermesInternal.getRuntimeProperties();
const rnVer = RN.Platform.constants.reactNativeVersion;
const PlatformConstants = RN.Platform.constants;
const rnVer = PlatformConstants.reactNativeVersion;
const DCDDeviceManager = RN.NativeModules.DCDDeviceManager;
return {
vendetta: {
@ -66,6 +68,41 @@ export function getDebugInfo(string: boolean = false) {
version: hermesProps["OSS Release Version"],
buildType: hermesProps["Build"],
bytecodeVersion: hermesProps["Bytecode Version"],
},
...RN.Platform.select(
{
android: {
os: {
name: "Android",
version: PlatformConstants.Release,
sdk: PlatformConstants.Version
},
},
ios: {
os: {
name: PlatformConstants.systemName,
version: PlatformConstants.osVersion
},
}
}
)!,
...RN.Platform.select(
{
android: {
device: {
manufacturer: PlatformConstants.Manufacturer,
brand: PlatformConstants.Brand,
model: PlatformConstants.Model
}
},
ios: {
device: {
manufacturer: DCDDeviceManager.deviceManufacturer,
brand: DCDDeviceManager.deviceBrand,
model: DCDDeviceManager.device
}
}
}
)!
}
}

View file

@ -40,6 +40,34 @@ export default function General() {
},
];
const platformInfo = [
{
label: "Operating System",
version: `${debugInfo.os.name} ${debugInfo.os.version}`,
icon: "ic_cog_24px"
},
...(debugInfo.os.sdk ? [{
label: "Software Development Kit",
version: debugInfo.os.sdk,
icon: "ic_cog_24px"
}] : []),
{
label: "Manufacturer",
version: debugInfo.device.manufacturer,
icon: "ic_hammer_and_chisel_24px"
},
{
label: "Brand",
version: debugInfo.device.brand,
icon: "ic_megaphone_16px"
},
{
label: "Model",
version: debugInfo.device.model,
icon: "ic_phonelink_24px"
}
];
return (
<RN.ScrollView>
<FormSection title="Links">
@ -65,6 +93,14 @@ export default function General() {
</>
))}
</FormSection>
<FormSection title="Platform Info">
{platformInfo.map((p) => (
<>
<Version label={p.label} version={p.version} icon={p.icon} />
<FormDivider />
</>
))}
</FormSection>
<FormSection title="Actions">
<FormRow
label="Reload Discord"