import { Platform } from 'react-native'; import type { DeviceType, LocationProviderInfo, PowerState, AsyncHookResult, AvailableCapacityType, AppSetIdInfo, } from './types'; export type NotchDevice = { brand: string; model: string; [key: string]: string; }; interface NativeConstants { appName: string; appVersion: string; brand: string; buildNumber: string; bundleId: string; deviceId: string; deviceType: DeviceType; isTablet: boolean; isLowRamDevice: boolean; isDisplayZoomed: boolean; model: string; systemName: string; systemVersion: string; } interface HiddenNativeMethods { getPowerState: () => Promise; getPowerStateSync: () => PowerState; getSupported32BitAbis: () => Promise; getSupported32BitAbisSync: () => string[]; getSupported64BitAbis: () => Promise; getSupported64BitAbisSync: () => string[]; getSupportedAbis: () => Promise; getSupportedAbisSync: () => string[]; getSystemManufacturer: () => Promise; getSystemManufacturerSync: () => string; } interface ExposedNativeMethods { getAndroidId: () => Promise; getAndroidIdSync: () => string; getApiLevel: () => Promise; getApiLevelSync: () => number; getAvailableLocationProviders: () => Promise; getAvailableLocationProvidersSync: () => LocationProviderInfo; getBaseOs: () => Promise; getBaseOsSync: () => string; getBatteryLevel: () => Promise; getBatteryLevelSync: () => number; getBootloader: () => Promise; getBootloaderSync: () => string; getBuildId: () => Promise; getBuildIdSync: () => string; getCarrier: () => Promise; getCarrierSync: () => string; getCodename: () => Promise; getCodenameSync: () => string; getDevice: () => Promise; getDeviceName: () => Promise; getDeviceNameSync: () => string; getDeviceSync: () => string; getDeviceToken: () => Promise; getDisplay: () => Promise; getDisplaySync: () => string; getFingerprint: () => Promise; getFingerprintSync: () => string; getFirstInstallTime: () => Promise; getFirstInstallTimeSync: () => number; getFontScale: () => Promise; getFontScaleSync: () => number; getFreeDiskStorage: (storageType?: AvailableCapacityType) => Promise; getFreeDiskStorageOld: () => Promise; getFreeDiskStorageSync: (storageType?: AvailableCapacityType) => number; getFreeDiskStorageOldSync: () => number; getHardware: () => Promise; getHardwareSync: () => string; getHost: () => Promise; getHostSync: () => string; getHostNames: () => Promise; getHostNamesSync: () => string[]; getIncremental: () => Promise; getIncrementalSync: () => string; getInstallerPackageName: () => Promise; getInstallerPackageNameSync: () => string; getInstallReferrer: () => Promise; getInstallReferrerSync: () => string; getInstanceId: () => Promise; getInstanceIdSync: () => string; getIpAddress: () => Promise; getIpAddressSync: () => string; getLastUpdateTime: () => Promise; getLastUpdateTimeSync: () => number; getMacAddress: () => Promise; getMacAddressSync: () => string; getMaxMemory: () => Promise; getMaxMemorySync: () => number; getPreviewSdkInt: () => Promise; getPreviewSdkIntSync: () => number; getProduct: () => Promise; getProductSync: () => string; getSecurityPatch: () => Promise; getSecurityPatchSync: () => string; getSerialNumber: () => Promise; getSerialNumberSync: () => string; getStartupTime: () => Promise; getStartupTimeSync: () => number; getSystemAvailableFeatures: () => Promise; getSystemAvailableFeaturesSync: () => string[]; getTags: () => Promise; getTagsSync: () => string; getTotalDiskCapacity: () => Promise; getTotalDiskCapacityOld: () => Promise; getTotalDiskCapacitySync: () => number; getTotalDiskCapacityOldSync: () => number; getTotalMemory: () => Promise; getTotalMemorySync: () => number; getType: () => Promise; getTypeSync: () => string; getUniqueId: () => Promise; getUniqueIdSync: () => string; getUsedMemory: () => Promise; getUsedMemorySync: () => number; getUserAgent: () => Promise; getUserAgentSync: () => string; getBrightness: () => Promise; getBrightnessSync: () => number; hasGms: () => Promise; hasGmsSync: () => boolean; hasHms: () => Promise; hasHmsSync: () => boolean; hasSystemFeature: (feature: string) => Promise; hasSystemFeatureSync: (feature: string) => boolean; isAirplaneMode: () => Promise; isAirplaneModeSync: () => boolean; isBatteryCharging: () => Promise; isBatteryChargingSync: () => boolean; isCameraPresent: () => Promise; isCameraPresentSync: () => boolean; isEmulator: () => Promise; isEmulatorSync: () => boolean; isHeadphonesConnected: () => Promise; isHeadphonesConnectedSync: () => boolean; isWiredHeadphonesConnected: () => Promise; isWiredHeadphonesConnectedSync: () => boolean; isBluetoothHeadphonesConnected: () => Promise; isBluetoothHeadphonesConnectedSync: () => boolean; isLocationEnabled: () => Promise; isLocationEnabledSync: () => boolean; isPinOrFingerprintSet: () => Promise; isPinOrFingerprintSetSync: () => boolean; isMouseConnected: () => Promise; isMouseConnectedSync: () => boolean; isKeyboardConnected: () => Promise; isKeyboardConnectedSync: () => boolean; isTabletMode: () => Promise; syncUniqueId: () => Promise; getSupportedMediaTypeList: () => Promise; getSupportedMediaTypeListSync: () => string[]; getAppSetId: () => Promise; } export interface DeviceInfoNativeModule extends NativeConstants, HiddenNativeMethods, ExposedNativeMethods {} export interface DeviceInfoModule extends ExposedNativeMethods { getApplicationName: () => string; getBrand: () => string; getBuildNumber: () => string; getBundleId: () => string; getDeviceId: () => string; getDeviceType: () => string; getManufacturer: () => Promise; getManufacturerSync: () => string; getModel: () => string; getPowerState: () => Promise>; getPowerStateSync: () => Partial; getReadableVersion: () => string; getSystemName: () => string; getSystemVersion: () => string; getUniqueId: () => Promise; getUniqueIdSync: () => string; getVersion: () => string; hasNotch: () => boolean; hasDynamicIsland: () => boolean; hasSystemFeature: (feature: string) => Promise; hasSystemFeatureSync: (feature: string) => boolean; isLandscape: () => Promise; isLandscapeSync: () => boolean; isTablet: () => boolean; isLowRamDevice: () => boolean; isDisplayZoomed: () => boolean; supported32BitAbis: () => Promise; supported32BitAbisSync: () => string[]; supported64BitAbis: () => Promise; supported64BitAbisSync: () => string[]; supportedAbis: () => Promise; supportedAbisSync: () => string[]; /** * React hook that streams battery level updates emitted by the native module. * * @example * ```tsx * const level = useBatteryLevel(); * ``` */ useBatteryLevel: () => number | null; /** * React hook that notifies when the battery crosses the low-level threshold. * * @example * ```tsx * const level = useBatteryLevelIsLow(); * ``` */ useBatteryLevelIsLow: () => number | null; /** * React hook that resolves with the human-readable device name when it becomes available. * * @example * ```tsx * const { result: name } = useDeviceName(); * ``` */ useDeviceName: () => AsyncHookResult; /** * React hook that exposes the app's first install timestamp once it is retrieved. * * @example * ```tsx * const { result } = useFirstInstallTime(); * ``` */ useFirstInstallTime: () => AsyncHookResult; /** * React hook that checks for an Android system feature and keeps the result cached. * * @example * ```tsx * const { result } = useHasSystemFeature('android.hardware.location.gps'); * ``` */ useHasSystemFeature: (feature: string) => AsyncHookResult; /** * React hook that resolves as soon as the emulator detection result is known. * * @example * ```tsx * const { result: emulator } = useIsEmulator(); * ``` */ useIsEmulator: () => AsyncHookResult; /** * React hook that subscribes to power state changes and returns a partial {@link PowerState}. * * @example * ```tsx * const powerState = usePowerState(); * ``` */ usePowerState: () => Partial; /** * React hook that resolves to the device manufacturer string. * * @example * ```tsx * const { result: manufacturer } = useManufacturer(); * ``` */ useManufacturer: () => AsyncHookResult; /** * React hook that resolves to true whenever any headphones are connected. * * @example * ```tsx * const { result: connected } = useIsHeadphonesConnected(); * ``` */ useIsHeadphonesConnected: () => AsyncHookResult; /** * React hook that resolves to true whenever wired headphones are connected. * * @example * ```tsx * const { result } = useIsWiredHeadphonesConnected(); * ``` */ useIsWiredHeadphonesConnected: () => AsyncHookResult; /** * React hook that resolves to true whenever Bluetooth headphones are connected. * * @example * ```tsx * const { result } = useIsBluetoothHeadphonesConnected(); * ``` */ useIsBluetoothHeadphonesConnected: () => AsyncHookResult; /** * React hook that subscribes to screen brightness updates on iOS. * * @example * ```tsx * const brightness = useBrightness(); * ``` */ useBrightness: () => number | null; getAppSetId: () => Promise; } export type Getter = (...args: any[]) => T; export type PlatformArray = typeof Platform.OS[]; export interface GetSupportedPlatformInfoSyncParams { getter: Getter; supportedPlatforms: PlatformArray; defaultValue: T; memoKey?: string; } export interface GetSupportedPlatformInfoAsyncParams extends Omit, 'getter'> { getter: Getter>; } export interface GetFilterPlatformFunctionsParams extends GetSupportedPlatformInfoAsyncParams { syncGetter: Getter; } export interface GetSupportedPlatformInfoFunctionsParams extends GetSupportedPlatformInfoAsyncParams { syncGetter: Getter; }