[Settings > General] Expose information about the device
This commit is contained in:
parent
0ee50404a9
commit
8b480b92e2
2 changed files with 75 additions and 2 deletions
|
@ -48,7 +48,9 @@ export const versionHash = "__vendettaVersion";
|
||||||
export function getDebugInfo(string: boolean = false) {
|
export function getDebugInfo(string: boolean = false) {
|
||||||
const InfoDictionaryManager = RN.NativeModules.InfoDictionaryManager;
|
const InfoDictionaryManager = RN.NativeModules.InfoDictionaryManager;
|
||||||
const hermesProps = window.HermesInternal.getRuntimeProperties();
|
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 {
|
return {
|
||||||
vendetta: {
|
vendetta: {
|
||||||
|
@ -66,6 +68,41 @@ export function getDebugInfo(string: boolean = false) {
|
||||||
version: hermesProps["OSS Release Version"],
|
version: hermesProps["OSS Release Version"],
|
||||||
buildType: hermesProps["Build"],
|
buildType: hermesProps["Build"],
|
||||||
bytecodeVersion: hermesProps["Bytecode Version"],
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)!
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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 (
|
return (
|
||||||
<RN.ScrollView>
|
<RN.ScrollView>
|
||||||
<FormSection title="Links">
|
<FormSection title="Links">
|
||||||
|
@ -65,6 +93,14 @@ export default function General() {
|
||||||
</>
|
</>
|
||||||
))}
|
))}
|
||||||
</FormSection>
|
</FormSection>
|
||||||
|
<FormSection title="Platform Info">
|
||||||
|
{platformInfo.map((p) => (
|
||||||
|
<>
|
||||||
|
<Version label={p.label} version={p.version} icon={p.icon} />
|
||||||
|
<FormDivider />
|
||||||
|
</>
|
||||||
|
))}
|
||||||
|
</FormSection>
|
||||||
<FormSection title="Actions">
|
<FormSection title="Actions">
|
||||||
<FormRow
|
<FormRow
|
||||||
label="Reload Discord"
|
label="Reload Discord"
|
||||||
|
|
Loading…
Reference in a new issue