[Global] Refactors all around

This commit is contained in:
Beef 2023-01-10 23:30:46 +00:00
parent 01a05a8b9d
commit 93c4eef678
11 changed files with 127 additions and 35 deletions

View file

@ -1,3 +1,4 @@
import { ReactNative as RN } from "@metro/common";
import { after } from "@lib/patcher";
import { getAssetIDByName } from "@ui/assets";
import { showToast } from "@ui/toasts";
@ -41,3 +42,30 @@ export function patchLogHook() {
logger.log(args[0]);
});
}
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;
return {
vendetta: {
version: versionHash,
},
discord: {
version: InfoDictionaryManager.Version,
build: InfoDictionaryManager.Build,
},
react: {
version: React.version,
nativeVersion: `${rnVer.major || 0}.${rnVer.minor || 0}.${rnVer.patch || 0}`,
},
hermes: {
version: hermesProps["OSS Release Version"],
buildType: hermesProps["Build"],
bytecodeVersion: hermesProps["Bytecode Version"],
}
}
}