decord/alpha/source/utils/native/DeviceUtils.tsx

144 lines
4.4 KiB
TypeScript
Raw Permalink Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 5068
// Function ID: 5069
// Name: DeviceUtils
2026-10-13 12:43:34 +00:00
// Dependencies: [1362, 1382, 510, 2]
2026-08-08 06:10:11 +00:00
// Exports: getDevice, getDeviceBrand, getDeviceInfo, getDeviceManufacturer, getDeviceMediaPerformanceClass, getDeviceModel, getDeviceProduct, getIsRunningOnSimulator, getMaxCpuFreq, getRamSize, getSmallestScreenWidthDp, getSocName, getSystemVersion, getSystemVersionMajor, getSystemVersionMinor, getTimeZone, isGestureNavigationEnabled, isIpadOS, isOrientationLockSupported
2026-07-20 16:05:17 +00:00
2026-10-10 08:08:14 +00:00
// Module 5068 (DeviceUtils)
2026-10-09 10:00:15 +00:00
import PlatformUtils from "PlatformUtils" /* 1382 */;
2026-10-13 12:43:34 +00:00
import react_native from "react-native" /* 1362 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const constants = react_native.getConstants();
let closure_4 = null;
2026-07-23 10:11:24 +00:00
const mediaPerformanceClass = "mediaPerformanceClass";
let result = size.fileFinishedImporting("utils/native/DeviceUtils.tsx");
2026-07-20 16:05:17 +00:00
export const isIpadOS = function isIpadOS() {
return "iPad" === closure_3.deviceModel;
2026-07-20 16:05:17 +00:00
};
export const isGestureNavigationEnabled = function isGestureNavigationEnabled() {
return closure_3.isGestureNavigationEnabled;
};
export const getSystemVersion = function getSystemVersion() {
return closure_3.systemVersion;
2026-07-20 16:05:17 +00:00
};
export const getSystemVersionMajor = function getSystemVersionMajor() {
2026-10-03 08:58:59 +00:00
const str = closure_3.systemVersion;
const match = str.match(/\d+/);
2026-07-20 16:05:17 +00:00
if (null == match) {
return 0;
} else {
const _Number = Number;
const parsed = Number.parseInt(match[0], 10);
const _Number2 = Number;
2026-07-29 08:29:29 +00:00
let num2 = 0;
2026-07-20 16:05:17 +00:00
if (!Number.isNaN(parsed)) {
2026-07-29 08:29:29 +00:00
num2 = parsed;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return num2;
2026-07-20 16:05:17 +00:00
}
};
export const getSystemVersionMinor = function getSystemVersionMinor() {
2026-10-03 08:58:59 +00:00
const str = closure_3.systemVersion;
const match = str.match(/\d+/g);
2026-07-20 16:05:17 +00:00
if (null != match) {
if (match.length >= 2) {
const _Number = Number;
const parsed = Number.parseInt(match[1], 10);
const _Number2 = Number;
2026-07-29 08:29:29 +00:00
let num3 = 0;
2026-07-20 16:05:17 +00:00
if (!Number.isNaN(parsed)) {
2026-07-29 08:29:29 +00:00
num3 = parsed;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return num3;
2026-07-20 16:05:17 +00:00
}
}
return 0;
};
export const getDevice = function getDevice() {
return closure_3.device;
};
2026-07-20 16:05:17 +00:00
export const getDeviceInfo = function getDeviceInfo() {
2026-10-03 08:58:59 +00:00
let text;
const device = closure_3.device;
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-29 08:29:29 +00:00
if (obj.isAndroid()) {
2026-10-03 08:58:59 +00:00
text = `${device + " (" + tmp.deviceModel})`;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
text = device;
2026-07-20 16:05:17 +00:00
}
return text;
};
export const getDeviceMediaPerformanceClass = function getDeviceMediaPerformanceClass() {
2026-10-03 08:58:59 +00:00
let mediaPerformanceClass2;
2026-07-29 08:29:29 +00:00
let tmp3 = null;
2026-10-03 08:58:59 +00:00
const obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
if (obj.isAndroid()) {
2026-07-29 08:29:29 +00:00
let tmp5 = null == mediaPerformanceClass2;
if (tmp5) {
const Storage = tmp(510).Storage;
2026-10-03 08:58:59 +00:00
const value = Storage.get(mediaPerformanceClass);
2026-07-23 10:11:24 +00:00
mediaPerformanceClass2 = value;
2026-07-29 08:29:29 +00:00
tmp5 = null == value;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp5) {
2026-10-03 08:58:59 +00:00
const obj2 = react_native;
mediaPerformanceClass2 = obj2.getMediaPerformanceClass();
const Storage2 = tmp(510).Storage;
2026-07-23 10:11:24 +00:00
const result = Storage2.set(mediaPerformanceClass, mediaPerformanceClass2);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp3 = mediaPerformanceClass2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp3;
2026-07-20 16:05:17 +00:00
};
export const getDeviceModel = function getDeviceModel() {
return closure_3.deviceModel;
2026-07-20 16:05:17 +00:00
};
export const getDeviceBrand = function getDeviceBrand() {
return closure_3.deviceBrand;
2026-07-20 16:05:17 +00:00
};
export const getDeviceProduct = function getDeviceProduct() {
return closure_3.deviceProduct;
2026-07-20 16:05:17 +00:00
};
export const getDeviceManufacturer = function getDeviceManufacturer() {
return closure_3.deviceManufacturer;
2026-07-20 16:05:17 +00:00
};
export const getSmallestScreenWidthDp = function getSmallestScreenWidthDp() {
return closure_3.smallestScreenWidth;
2026-07-20 16:05:17 +00:00
};
2026-08-08 06:10:11 +00:00
export const isOrientationLockSupported = function isOrientationLockSupported() {
let flag = closure_3.isOrientationLockSupported;
2026-08-08 06:10:11 +00:00
if (flag == null) {
flag = true;
}
return flag;
};
2026-07-20 16:05:17 +00:00
export const getSocName = function getSocName() {
return closure_3.socName;
2026-07-20 16:05:17 +00:00
};
export const getRamSize = function getRamSize() {
const ramSize = closure_3.ramSize;
2026-07-20 16:05:17 +00:00
let parsed;
if ("" !== ramSize) {
const _parseFloat = parseFloat;
parsed = parseFloat(ramSize);
}
return parsed;
};
export const getMaxCpuFreq = function getMaxCpuFreq() {
const maxCpuFreq = closure_3.maxCpuFreq;
2026-07-20 16:05:17 +00:00
let parsed;
if ("" !== maxCpuFreq) {
const _parseFloat = parseFloat;
parsed = parseFloat(maxCpuFreq);
}
return parsed;
};
export const getTimeZone = function getTimeZone() {
return closure_3.timeZone;
2026-07-20 16:05:17 +00:00
};
export const getIsRunningOnSimulator = function getIsRunningOnSimulator() {
return closure_3.isRunningOnSimulator;
2026-07-20 16:05:17 +00:00
};