diff --git a/src/def.d.ts b/src/def.d.ts index 3960ed0..1d34105 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -1,6 +1,6 @@ import * as _spitroast from "spitroast"; import _React from "react"; -import _RN from "react-native"; +import _RN, { PlatformConstants } from "react-native"; import _AsyncStorage from "@react-native-async-storage/async-storage"; type MetroModules = { [id: number]: any }; @@ -64,6 +64,24 @@ interface Settings { developerSettings: boolean; } +interface RNConstants extends PlatformConstants { + // Android + Version: number; + Release: string; + Serial: string; + Fingerprint: string; + Model: string; + Brand: string; + Manufacturer: string; + ServerHost?: string; + + // iOS + forceTouchAvailable: boolean; + interfaceIdiom: string; + osVersion: string; + systemName: string; +} + type Indexable = { [index: string]: Type } interface VendettaObject { diff --git a/src/lib/debug.ts b/src/lib/debug.ts index 0caa9a7..4b70b37 100644 --- a/src/lib/debug.ts +++ b/src/lib/debug.ts @@ -1,3 +1,4 @@ +import { RNConstants } from "@types"; import { ReactNative as RN } from "@metro/common"; import { after } from "@lib/patcher"; import { getAssetIDByName } from "@ui/assets"; @@ -48,8 +49,7 @@ export const versionHash = "__vendettaVersion"; export function getDebugInfo() { const InfoDictionaryManager = RN.NativeModules.InfoDictionaryManager; const hermesProps = window.HermesInternal.getRuntimeProperties(); - // TODO: Type 'any' removes errors, but is it sensible? - const PlatformConstants = RN.Platform.constants as any; + const PlatformConstants = RN.Platform.constants as RNConstants; const rnVer = PlatformConstants.reactNativeVersion; const DCDDeviceManager = RN.NativeModules.DCDDeviceManager;