1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.syncUniqueId = syncUniqueId;
|
7 | exports.getMacAddress = getMacAddress;
|
8 | exports.getMacAddressSync = getMacAddressSync;
|
9 | exports.getReadableVersion = getReadableVersion;
|
10 | exports.hasNotch = hasNotch;
|
11 | exports.hasDynamicIsland = hasDynamicIsland;
|
12 | exports.getTotalDiskCapacityOld = getTotalDiskCapacityOld;
|
13 | exports.getTotalDiskCapacityOldSync = getTotalDiskCapacityOldSync;
|
14 | exports.getFreeDiskStorageOld = getFreeDiskStorageOld;
|
15 | exports.getFreeDiskStorageOldSync = getFreeDiskStorageOldSync;
|
16 | exports.isLandscape = isLandscape;
|
17 | exports.isLandscapeSync = isLandscapeSync;
|
18 | exports.hasSystemFeature = hasSystemFeature;
|
19 | exports.hasSystemFeatureSync = hasSystemFeatureSync;
|
20 | exports.isLowBatteryLevel = isLowBatteryLevel;
|
21 | exports.getDeviceToken = getDeviceToken;
|
22 | exports.useBatteryLevel = useBatteryLevel;
|
23 | exports.useBatteryLevelIsLow = useBatteryLevelIsLow;
|
24 | exports.usePowerState = usePowerState;
|
25 | exports.useIsHeadphonesConnected = useIsHeadphonesConnected;
|
26 | exports.useFirstInstallTime = useFirstInstallTime;
|
27 | exports.useDeviceName = useDeviceName;
|
28 | exports.useHasSystemFeature = useHasSystemFeature;
|
29 | exports.useIsEmulator = useIsEmulator;
|
30 | exports.useManufacturer = useManufacturer;
|
31 | exports.useBrightness = useBrightness;
|
32 | exports.isAirplaneModeSync = exports.isAirplaneMode = exports.isBatteryChargingSync = exports.isBatteryCharging = exports.getPowerStateSync = exports.getPowerState = exports.getBatteryLevelSync = exports.getBatteryLevel = exports.getFreeDiskStorageSync = exports.getFreeDiskStorage = exports.getTotalDiskCapacitySync = exports.getTotalDiskCapacity = exports.getMaxMemorySync = exports.getMaxMemory = exports.getTotalMemorySync = exports.getTotalMemory = exports.getCarrierSync = exports.getCarrier = exports.getPhoneNumberSync = exports.getPhoneNumber = exports.getLastUpdateTimeSync = exports.getLastUpdateTime = exports.getInstallReferrerSync = exports.getInstallReferrer = exports.getFirstInstallTimeSync = exports.getFirstInstallTime = exports.hasHmsSync = exports.hasHms = exports.hasGmsSync = exports.hasGms = exports.isPinOrFingerprintSetSync = exports.isPinOrFingerprintSet = exports.isTablet = exports.isEmulatorSync = exports.isEmulator = exports.getIncrementalSync = exports.getIncremental = exports.getCodenameSync = exports.getCodename = exports.getSecurityPatchSync = exports.getSecurityPatch = exports.getPreviewSdkIntSync = exports.getPreviewSdkInt = exports.getBaseOsSync = exports.getBaseOs = exports.getTypeSync = exports.getType = exports.getTagsSync = exports.getTags = exports.getProductSync = exports.getProduct = exports.getHostSync = exports.getHost = exports.getHardwareSync = exports.getHardware = exports.getFingerprintSync = exports.getFingerprint = exports.getDisplaySync = exports.getDisplay = exports.getDeviceSync = exports.getDevice = exports.getBootloaderSync = exports.getBootloader = exports.getFontScaleSync = exports.getFontScale = exports.getUserAgentSync = exports.getUserAgent = exports.getUsedMemorySync = exports.getUsedMemory = exports.getDeviceNameSync = exports.getDeviceName = exports.getVersion = exports.getBuildNumber = exports.getApplicationName = exports.getInstallerPackageNameSync = exports.getInstallerPackageName = exports.getBundleId = exports.getApiLevelSync = exports.getApiLevel = exports.getBuildIdSync = exports.getBuildId = exports.getSystemVersion = exports.getSystemName = exports.getBrand = exports.getModel = exports.getManufacturerSync = exports.getManufacturer = exports.getDeviceId = exports.isCameraPresentSync = exports.isCameraPresent = exports.getIpAddressSync = exports.getIpAddress = exports.getAndroidIdSync = exports.getAndroidId = exports.getSerialNumberSync = exports.getSerialNumber = exports.getInstanceIdSync = exports.getInstanceId = exports.getUniqueIdSync = exports.getUniqueId = void 0;
|
33 | exports.default = exports.getBrightnessSync = exports.getBrightness = exports.getAvailableLocationProvidersSync = exports.getAvailableLocationProviders = exports.isTabletMode = exports.isKeyboardConnectedSync = exports.isKeyboardConnected = exports.isMouseConnectedSync = exports.isMouseConnected = exports.isHeadphonesConnectedSync = exports.isHeadphonesConnected = exports.isLocationEnabledSync = exports.isLocationEnabled = exports.getSystemAvailableFeaturesSync = exports.getSystemAvailableFeatures = exports.supported64BitAbisSync = exports.supported64BitAbis = exports.supported32BitAbisSync = exports.supported32BitAbis = exports.supportedAbisSync = exports.supportedAbis = exports.getDeviceTypeSync = exports.getDeviceType = void 0;
|
34 |
|
35 | var _react = require("react");
|
36 |
|
37 | var _reactNative = require("react-native");
|
38 |
|
39 | var _asyncHookWrappers = require("./internal/asyncHookWrappers");
|
40 |
|
41 | var _devicesWithDynamicIsland = _interopRequireDefault(require("./internal/devicesWithDynamicIsland"));
|
42 |
|
43 | var _devicesWithNotch = _interopRequireDefault(require("./internal/devicesWithNotch"));
|
44 |
|
45 | var _nativeInterface = _interopRequireDefault(require("./internal/nativeInterface"));
|
46 |
|
47 | var _supportedPlatformInfo = require("./internal/supported-platform-info");
|
48 |
|
49 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
50 |
|
51 | const [getUniqueId, getUniqueIdSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
52 | memoKey: 'uniqueId',
|
53 | supportedPlatforms: ['android', 'ios', 'windows'],
|
54 | getter: () => _nativeInterface.default.getUniqueId(),
|
55 | syncGetter: () => _nativeInterface.default.getUniqueIdSync(),
|
56 | defaultValue: 'unknown'
|
57 | });
|
58 | exports.getUniqueIdSync = getUniqueIdSync;
|
59 | exports.getUniqueId = getUniqueId;
|
60 | let uniqueId;
|
61 |
|
62 | async function syncUniqueId() {
|
63 | if (_reactNative.Platform.OS === 'ios') {
|
64 | uniqueId = await _nativeInterface.default.syncUniqueId();
|
65 | } else {
|
66 | uniqueId = await getUniqueId();
|
67 | }
|
68 |
|
69 | return uniqueId;
|
70 | }
|
71 |
|
72 | const [getInstanceId, getInstanceIdSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
73 | memoKey: 'instanceId',
|
74 | supportedPlatforms: ['android'],
|
75 | getter: () => _nativeInterface.default.getInstanceId(),
|
76 | syncGetter: () => _nativeInterface.default.getInstanceIdSync(),
|
77 | defaultValue: 'unknown'
|
78 | });
|
79 | exports.getInstanceIdSync = getInstanceIdSync;
|
80 | exports.getInstanceId = getInstanceId;
|
81 | const [getSerialNumber, getSerialNumberSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
82 | memoKey: 'serialNumber',
|
83 | supportedPlatforms: ['android', 'windows'],
|
84 | getter: () => _nativeInterface.default.getSerialNumber(),
|
85 | syncGetter: () => _nativeInterface.default.getSerialNumberSync(),
|
86 | defaultValue: 'unknown'
|
87 | });
|
88 | exports.getSerialNumberSync = getSerialNumberSync;
|
89 | exports.getSerialNumber = getSerialNumber;
|
90 | const [getAndroidId, getAndroidIdSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
91 | memoKey: 'androidId',
|
92 | supportedPlatforms: ['android'],
|
93 | getter: () => _nativeInterface.default.getAndroidId(),
|
94 | syncGetter: () => _nativeInterface.default.getAndroidIdSync(),
|
95 | defaultValue: 'unknown'
|
96 | });
|
97 | exports.getAndroidIdSync = getAndroidIdSync;
|
98 | exports.getAndroidId = getAndroidId;
|
99 | const [getIpAddress, getIpAddressSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
100 | supportedPlatforms: ['android', 'ios', 'windows'],
|
101 | getter: () => _nativeInterface.default.getIpAddress(),
|
102 | syncGetter: () => _nativeInterface.default.getIpAddressSync(),
|
103 | defaultValue: 'unknown'
|
104 | });
|
105 | exports.getIpAddressSync = getIpAddressSync;
|
106 | exports.getIpAddress = getIpAddress;
|
107 | const [isCameraPresent, isCameraPresentSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
108 | supportedPlatforms: ['android', 'windows', 'web'],
|
109 | getter: () => _nativeInterface.default.isCameraPresent(),
|
110 | syncGetter: () => _nativeInterface.default.isCameraPresentSync(),
|
111 | defaultValue: false
|
112 | });
|
113 | exports.isCameraPresentSync = isCameraPresentSync;
|
114 | exports.isCameraPresent = isCameraPresent;
|
115 |
|
116 | async function getMacAddress() {
|
117 | if (_reactNative.Platform.OS === 'android') {
|
118 | return _nativeInterface.default.getMacAddress();
|
119 | } else if (_reactNative.Platform.OS === 'ios') {
|
120 | return '02:00:00:00:00:00';
|
121 | }
|
122 |
|
123 | return 'unknown';
|
124 | }
|
125 |
|
126 | function getMacAddressSync() {
|
127 | if (_reactNative.Platform.OS === 'android') {
|
128 | return _nativeInterface.default.getMacAddressSync();
|
129 | } else if (_reactNative.Platform.OS === 'ios') {
|
130 | return '02:00:00:00:00:00';
|
131 | }
|
132 |
|
133 | return 'unknown';
|
134 | }
|
135 |
|
136 | const getDeviceId = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
137 | defaultValue: 'unknown',
|
138 | memoKey: 'deviceId',
|
139 | getter: () => _nativeInterface.default.deviceId,
|
140 | supportedPlatforms: ['android', 'ios', 'windows']
|
141 | });
|
142 |
|
143 | exports.getDeviceId = getDeviceId;
|
144 | const [getManufacturer, getManufacturerSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
145 | memoKey: 'manufacturer',
|
146 | supportedPlatforms: ['android', 'ios', 'windows'],
|
147 | getter: () => _reactNative.Platform.OS == 'ios' ? Promise.resolve('Apple') : _nativeInterface.default.getSystemManufacturer(),
|
148 | syncGetter: () => _reactNative.Platform.OS == 'ios' ? 'Apple' : _nativeInterface.default.getSystemManufacturerSync(),
|
149 | defaultValue: 'unknown'
|
150 | });
|
151 | exports.getManufacturerSync = getManufacturerSync;
|
152 | exports.getManufacturer = getManufacturer;
|
153 |
|
154 | const getModel = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
155 | memoKey: 'model',
|
156 | defaultValue: 'unknown',
|
157 | supportedPlatforms: ['ios', 'android', 'windows'],
|
158 | getter: () => _nativeInterface.default.model
|
159 | });
|
160 |
|
161 | exports.getModel = getModel;
|
162 |
|
163 | const getBrand = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
164 | memoKey: 'brand',
|
165 | supportedPlatforms: ['android', 'ios', 'windows'],
|
166 | defaultValue: 'unknown',
|
167 | getter: () => _nativeInterface.default.brand
|
168 | });
|
169 |
|
170 | exports.getBrand = getBrand;
|
171 |
|
172 | const getSystemName = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
173 | defaultValue: 'unknown',
|
174 | supportedPlatforms: ['ios', 'android', 'windows'],
|
175 | memoKey: 'systemName',
|
176 | getter: () => _reactNative.Platform.select({
|
177 | ios: _nativeInterface.default.systemName,
|
178 | android: 'Android',
|
179 | windows: 'Windows',
|
180 | default: 'unknown'
|
181 | })
|
182 | });
|
183 |
|
184 | exports.getSystemName = getSystemName;
|
185 |
|
186 | const getSystemVersion = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
187 | defaultValue: 'unknown',
|
188 | getter: () => _nativeInterface.default.systemVersion,
|
189 | supportedPlatforms: ['android', 'ios', 'windows'],
|
190 | memoKey: 'systemVersion'
|
191 | });
|
192 |
|
193 | exports.getSystemVersion = getSystemVersion;
|
194 | const [getBuildId, getBuildIdSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
195 | memoKey: 'buildId',
|
196 | supportedPlatforms: ['android', 'ios', 'windows'],
|
197 | getter: () => _nativeInterface.default.getBuildId(),
|
198 | syncGetter: () => _nativeInterface.default.getBuildIdSync(),
|
199 | defaultValue: 'unknown'
|
200 | });
|
201 | exports.getBuildIdSync = getBuildIdSync;
|
202 | exports.getBuildId = getBuildId;
|
203 | const [getApiLevel, getApiLevelSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
204 | memoKey: 'apiLevel',
|
205 | supportedPlatforms: ['android'],
|
206 | getter: () => _nativeInterface.default.getApiLevel(),
|
207 | syncGetter: () => _nativeInterface.default.getApiLevelSync(),
|
208 | defaultValue: -1
|
209 | });
|
210 | exports.getApiLevelSync = getApiLevelSync;
|
211 | exports.getApiLevel = getApiLevel;
|
212 |
|
213 | const getBundleId = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
214 | memoKey: 'bundleId',
|
215 | supportedPlatforms: ['android', 'ios', 'windows'],
|
216 | defaultValue: 'unknown',
|
217 | getter: () => _nativeInterface.default.bundleId
|
218 | });
|
219 |
|
220 | exports.getBundleId = getBundleId;
|
221 | const [getInstallerPackageName, getInstallerPackageNameSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
222 | memoKey: 'installerPackageName',
|
223 | supportedPlatforms: ['android', 'windows', 'ios'],
|
224 | getter: () => _nativeInterface.default.getInstallerPackageName(),
|
225 | syncGetter: () => _nativeInterface.default.getInstallerPackageNameSync(),
|
226 | defaultValue: 'unknown'
|
227 | });
|
228 | exports.getInstallerPackageNameSync = getInstallerPackageNameSync;
|
229 | exports.getInstallerPackageName = getInstallerPackageName;
|
230 |
|
231 | const getApplicationName = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
232 | memoKey: 'appName',
|
233 | defaultValue: 'unknown',
|
234 | getter: () => _nativeInterface.default.appName,
|
235 | supportedPlatforms: ['android', 'ios', 'windows']
|
236 | });
|
237 |
|
238 | exports.getApplicationName = getApplicationName;
|
239 |
|
240 | const getBuildNumber = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
241 | memoKey: 'buildNumber',
|
242 | supportedPlatforms: ['android', 'ios', 'windows'],
|
243 | getter: () => _nativeInterface.default.buildNumber,
|
244 | defaultValue: 'unknown'
|
245 | });
|
246 |
|
247 | exports.getBuildNumber = getBuildNumber;
|
248 |
|
249 | const getVersion = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
250 | memoKey: 'version',
|
251 | defaultValue: 'unknown',
|
252 | supportedPlatforms: ['android', 'ios', 'windows'],
|
253 | getter: () => _nativeInterface.default.appVersion
|
254 | });
|
255 |
|
256 | exports.getVersion = getVersion;
|
257 |
|
258 | function getReadableVersion() {
|
259 | return getVersion() + '.' + getBuildNumber();
|
260 | }
|
261 |
|
262 | const [getDeviceName, getDeviceNameSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
263 | supportedPlatforms: ['android', 'ios', 'windows'],
|
264 | getter: () => _nativeInterface.default.getDeviceName(),
|
265 | syncGetter: () => _nativeInterface.default.getDeviceNameSync(),
|
266 | defaultValue: 'unknown'
|
267 | });
|
268 | exports.getDeviceNameSync = getDeviceNameSync;
|
269 | exports.getDeviceName = getDeviceName;
|
270 | const [getUsedMemory, getUsedMemorySync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
271 | supportedPlatforms: ['android', 'ios', 'windows', 'web'],
|
272 | getter: () => _nativeInterface.default.getUsedMemory(),
|
273 | syncGetter: () => _nativeInterface.default.getUsedMemorySync(),
|
274 | defaultValue: -1
|
275 | });
|
276 | exports.getUsedMemorySync = getUsedMemorySync;
|
277 | exports.getUsedMemory = getUsedMemory;
|
278 |
|
279 | const getUserAgent = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoAsync)({
|
280 | memoKey: 'userAgent',
|
281 | defaultValue: 'unknown',
|
282 | supportedPlatforms: ['android', 'ios', 'web'],
|
283 | getter: () => _nativeInterface.default.getUserAgent()
|
284 | });
|
285 |
|
286 | exports.getUserAgent = getUserAgent;
|
287 |
|
288 | const getUserAgentSync = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
289 | memoKey: 'userAgent',
|
290 | defaultValue: 'unknown',
|
291 | supportedPlatforms: ['android', 'web'],
|
292 | getter: () => _nativeInterface.default.getUserAgentSync()
|
293 | });
|
294 |
|
295 | exports.getUserAgentSync = getUserAgentSync;
|
296 | const [getFontScale, getFontScaleSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
297 | supportedPlatforms: ['android', 'ios', 'windows'],
|
298 | getter: () => _nativeInterface.default.getFontScale(),
|
299 | syncGetter: () => _nativeInterface.default.getFontScaleSync(),
|
300 | defaultValue: -1
|
301 | });
|
302 | exports.getFontScaleSync = getFontScaleSync;
|
303 | exports.getFontScale = getFontScale;
|
304 | const [getBootloader, getBootloaderSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
305 | memoKey: 'bootloader',
|
306 | supportedPlatforms: ['android'],
|
307 | getter: () => _nativeInterface.default.getBootloader(),
|
308 | syncGetter: () => _nativeInterface.default.getBootloaderSync(),
|
309 | defaultValue: 'unknown'
|
310 | });
|
311 | exports.getBootloaderSync = getBootloaderSync;
|
312 | exports.getBootloader = getBootloader;
|
313 | const [getDevice, getDeviceSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
314 | getter: () => _nativeInterface.default.getDevice(),
|
315 | syncGetter: () => _nativeInterface.default.getDeviceSync(),
|
316 | defaultValue: 'unknown',
|
317 | memoKey: 'device',
|
318 | supportedPlatforms: ['android']
|
319 | });
|
320 | exports.getDeviceSync = getDeviceSync;
|
321 | exports.getDevice = getDevice;
|
322 | const [getDisplay, getDisplaySync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
323 | memoKey: 'display',
|
324 | supportedPlatforms: ['android'],
|
325 | getter: () => _nativeInterface.default.getDisplay(),
|
326 | syncGetter: () => _nativeInterface.default.getDisplaySync(),
|
327 | defaultValue: 'unknown'
|
328 | });
|
329 | exports.getDisplaySync = getDisplaySync;
|
330 | exports.getDisplay = getDisplay;
|
331 | const [getFingerprint, getFingerprintSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
332 | memoKey: 'fingerprint',
|
333 | supportedPlatforms: ['android'],
|
334 | getter: () => _nativeInterface.default.getFingerprint(),
|
335 | syncGetter: () => _nativeInterface.default.getFingerprintSync(),
|
336 | defaultValue: 'unknown'
|
337 | });
|
338 | exports.getFingerprintSync = getFingerprintSync;
|
339 | exports.getFingerprint = getFingerprint;
|
340 | const [getHardware, getHardwareSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
341 | memoKey: 'hardware',
|
342 | supportedPlatforms: ['android'],
|
343 | getter: () => _nativeInterface.default.getHardware(),
|
344 | syncGetter: () => _nativeInterface.default.getHardwareSync(),
|
345 | defaultValue: 'unknown'
|
346 | });
|
347 | exports.getHardwareSync = getHardwareSync;
|
348 | exports.getHardware = getHardware;
|
349 | const [getHost, getHostSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
350 | memoKey: 'host',
|
351 | supportedPlatforms: ['android'],
|
352 | getter: () => _nativeInterface.default.getHost(),
|
353 | syncGetter: () => _nativeInterface.default.getHostSync(),
|
354 | defaultValue: 'unknown'
|
355 | });
|
356 | exports.getHostSync = getHostSync;
|
357 | exports.getHost = getHost;
|
358 | const [getProduct, getProductSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
359 | memoKey: 'product',
|
360 | supportedPlatforms: ['android'],
|
361 | getter: () => _nativeInterface.default.getProduct(),
|
362 | syncGetter: () => _nativeInterface.default.getProductSync(),
|
363 | defaultValue: 'unknown'
|
364 | });
|
365 | exports.getProductSync = getProductSync;
|
366 | exports.getProduct = getProduct;
|
367 | const [getTags, getTagsSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
368 | memoKey: 'tags',
|
369 | supportedPlatforms: ['android'],
|
370 | getter: () => _nativeInterface.default.getTags(),
|
371 | syncGetter: () => _nativeInterface.default.getTagsSync(),
|
372 | defaultValue: 'unknown'
|
373 | });
|
374 | exports.getTagsSync = getTagsSync;
|
375 | exports.getTags = getTags;
|
376 | const [getType, getTypeSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
377 | memoKey: 'type',
|
378 | supportedPlatforms: ['android'],
|
379 | getter: () => _nativeInterface.default.getType(),
|
380 | syncGetter: () => _nativeInterface.default.getTypeSync(),
|
381 | defaultValue: 'unknown'
|
382 | });
|
383 | exports.getTypeSync = getTypeSync;
|
384 | exports.getType = getType;
|
385 | const [getBaseOs, getBaseOsSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
386 | memoKey: 'baseOs',
|
387 | supportedPlatforms: ['android', 'web', 'windows'],
|
388 | getter: () => _nativeInterface.default.getBaseOs(),
|
389 | syncGetter: () => _nativeInterface.default.getBaseOsSync(),
|
390 | defaultValue: 'unknown'
|
391 | });
|
392 | exports.getBaseOsSync = getBaseOsSync;
|
393 | exports.getBaseOs = getBaseOs;
|
394 | const [getPreviewSdkInt, getPreviewSdkIntSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
395 | memoKey: 'previewSdkInt',
|
396 | supportedPlatforms: ['android'],
|
397 | getter: () => _nativeInterface.default.getPreviewSdkInt(),
|
398 | syncGetter: () => _nativeInterface.default.getPreviewSdkIntSync(),
|
399 | defaultValue: -1
|
400 | });
|
401 | exports.getPreviewSdkIntSync = getPreviewSdkIntSync;
|
402 | exports.getPreviewSdkInt = getPreviewSdkInt;
|
403 | const [getSecurityPatch, getSecurityPatchSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
404 | memoKey: 'securityPatch',
|
405 | supportedPlatforms: ['android'],
|
406 | getter: () => _nativeInterface.default.getSecurityPatch(),
|
407 | syncGetter: () => _nativeInterface.default.getSecurityPatchSync(),
|
408 | defaultValue: 'unknown'
|
409 | });
|
410 | exports.getSecurityPatchSync = getSecurityPatchSync;
|
411 | exports.getSecurityPatch = getSecurityPatch;
|
412 | const [getCodename, getCodenameSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
413 | memoKey: 'codeName',
|
414 | supportedPlatforms: ['android'],
|
415 | getter: () => _nativeInterface.default.getCodename(),
|
416 | syncGetter: () => _nativeInterface.default.getCodenameSync(),
|
417 | defaultValue: 'unknown'
|
418 | });
|
419 | exports.getCodenameSync = getCodenameSync;
|
420 | exports.getCodename = getCodename;
|
421 | const [getIncremental, getIncrementalSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
422 | memoKey: 'incremental',
|
423 | supportedPlatforms: ['android'],
|
424 | getter: () => _nativeInterface.default.getIncremental(),
|
425 | syncGetter: () => _nativeInterface.default.getIncrementalSync(),
|
426 | defaultValue: 'unknown'
|
427 | });
|
428 | exports.getIncrementalSync = getIncrementalSync;
|
429 | exports.getIncremental = getIncremental;
|
430 | const [isEmulator, isEmulatorSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
431 | memoKey: 'emulator',
|
432 | supportedPlatforms: ['android', 'ios', 'windows'],
|
433 | getter: () => _nativeInterface.default.isEmulator(),
|
434 | syncGetter: () => _nativeInterface.default.isEmulatorSync(),
|
435 | defaultValue: false
|
436 | });
|
437 | exports.isEmulatorSync = isEmulatorSync;
|
438 | exports.isEmulator = isEmulator;
|
439 |
|
440 | const isTablet = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
441 | defaultValue: false,
|
442 | supportedPlatforms: ['android', 'ios', 'windows'],
|
443 | memoKey: 'tablet',
|
444 | getter: () => _nativeInterface.default.isTablet
|
445 | });
|
446 |
|
447 | exports.isTablet = isTablet;
|
448 | const [isPinOrFingerprintSet, isPinOrFingerprintSetSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
449 | supportedPlatforms: ['android', 'ios', 'windows'],
|
450 | getter: () => _nativeInterface.default.isPinOrFingerprintSet(),
|
451 | syncGetter: () => _nativeInterface.default.isPinOrFingerprintSetSync(),
|
452 | defaultValue: false
|
453 | });
|
454 | exports.isPinOrFingerprintSetSync = isPinOrFingerprintSetSync;
|
455 | exports.isPinOrFingerprintSet = isPinOrFingerprintSet;
|
456 | let notch;
|
457 |
|
458 | function hasNotch() {
|
459 | if (notch === undefined) {
|
460 | let _brand = getBrand();
|
461 |
|
462 | let _model = getModel();
|
463 |
|
464 | notch = _devicesWithNotch.default.findIndex(item => item.brand.toLowerCase() === _brand.toLowerCase() && item.model.toLowerCase() === _model.toLowerCase()) !== -1;
|
465 | }
|
466 |
|
467 | return notch;
|
468 | }
|
469 |
|
470 | let dynamicIsland;
|
471 |
|
472 | function hasDynamicIsland() {
|
473 | if (dynamicIsland === undefined) {
|
474 | let _brand = getBrand();
|
475 |
|
476 | let _model = getModel();
|
477 |
|
478 | dynamicIsland = _devicesWithDynamicIsland.default.findIndex(item => item.brand.toLowerCase() === _brand.toLowerCase() && item.model.toLowerCase() === _model.toLowerCase()) !== -1;
|
479 | }
|
480 |
|
481 | return dynamicIsland;
|
482 | }
|
483 |
|
484 | const [hasGms, hasGmsSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
485 | supportedPlatforms: ['android'],
|
486 | getter: () => _nativeInterface.default.hasGms(),
|
487 | syncGetter: () => _nativeInterface.default.hasGmsSync(),
|
488 | defaultValue: false
|
489 | });
|
490 | exports.hasGmsSync = hasGmsSync;
|
491 | exports.hasGms = hasGms;
|
492 | const [hasHms, hasHmsSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
493 | supportedPlatforms: ['android'],
|
494 | getter: () => _nativeInterface.default.hasHms(),
|
495 | syncGetter: () => _nativeInterface.default.hasHmsSync(),
|
496 | defaultValue: false
|
497 | });
|
498 | exports.hasHmsSync = hasHmsSync;
|
499 | exports.hasHms = hasHms;
|
500 | const [getFirstInstallTime, getFirstInstallTimeSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
501 | memoKey: 'firstInstallTime',
|
502 | supportedPlatforms: ['android', 'ios', 'windows'],
|
503 | getter: () => _nativeInterface.default.getFirstInstallTime(),
|
504 | syncGetter: () => _nativeInterface.default.getFirstInstallTimeSync(),
|
505 | defaultValue: -1
|
506 | });
|
507 | exports.getFirstInstallTimeSync = getFirstInstallTimeSync;
|
508 | exports.getFirstInstallTime = getFirstInstallTime;
|
509 | const [getInstallReferrer, getInstallReferrerSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
510 | memoKey: 'installReferrer',
|
511 | supportedPlatforms: ['android', 'windows', 'web'],
|
512 | getter: () => _nativeInterface.default.getInstallReferrer(),
|
513 | syncGetter: () => _nativeInterface.default.getInstallReferrerSync(),
|
514 | defaultValue: 'unknown'
|
515 | });
|
516 | exports.getInstallReferrerSync = getInstallReferrerSync;
|
517 | exports.getInstallReferrer = getInstallReferrer;
|
518 | const [getLastUpdateTime, getLastUpdateTimeSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
519 | memoKey: 'lastUpdateTime',
|
520 | supportedPlatforms: ['android'],
|
521 | getter: () => _nativeInterface.default.getLastUpdateTime(),
|
522 | syncGetter: () => _nativeInterface.default.getLastUpdateTimeSync(),
|
523 | defaultValue: -1
|
524 | });
|
525 | exports.getLastUpdateTimeSync = getLastUpdateTimeSync;
|
526 | exports.getLastUpdateTime = getLastUpdateTime;
|
527 | const [getPhoneNumber, getPhoneNumberSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
528 | supportedPlatforms: ['android'],
|
529 | getter: () => _nativeInterface.default.getPhoneNumber(),
|
530 | syncGetter: () => _nativeInterface.default.getPhoneNumberSync(),
|
531 | defaultValue: 'unknown'
|
532 | });
|
533 | exports.getPhoneNumberSync = getPhoneNumberSync;
|
534 | exports.getPhoneNumber = getPhoneNumber;
|
535 | const [getCarrier, getCarrierSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
536 | supportedPlatforms: ['android', 'ios'],
|
537 | getter: () => _nativeInterface.default.getCarrier(),
|
538 | syncGetter: () => _nativeInterface.default.getCarrierSync(),
|
539 | defaultValue: 'unknown'
|
540 | });
|
541 | exports.getCarrierSync = getCarrierSync;
|
542 | exports.getCarrier = getCarrier;
|
543 | const [getTotalMemory, getTotalMemorySync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
544 | memoKey: 'totalMemory',
|
545 | supportedPlatforms: ['android', 'ios', 'windows', 'web'],
|
546 | getter: () => _nativeInterface.default.getTotalMemory(),
|
547 | syncGetter: () => _nativeInterface.default.getTotalMemorySync(),
|
548 | defaultValue: -1
|
549 | });
|
550 | exports.getTotalMemorySync = getTotalMemorySync;
|
551 | exports.getTotalMemory = getTotalMemory;
|
552 | const [getMaxMemory, getMaxMemorySync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
553 | memoKey: 'maxMemory',
|
554 | supportedPlatforms: ['android', 'windows', 'web'],
|
555 | getter: () => _nativeInterface.default.getMaxMemory(),
|
556 | syncGetter: () => _nativeInterface.default.getMaxMemorySync(),
|
557 | defaultValue: -1
|
558 | });
|
559 | exports.getMaxMemorySync = getMaxMemorySync;
|
560 | exports.getMaxMemory = getMaxMemory;
|
561 | const [getTotalDiskCapacity, getTotalDiskCapacitySync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
562 | supportedPlatforms: ['android', 'ios', 'windows', 'web'],
|
563 | getter: () => _nativeInterface.default.getTotalDiskCapacity(),
|
564 | syncGetter: () => _nativeInterface.default.getTotalDiskCapacitySync(),
|
565 | defaultValue: -1
|
566 | });
|
567 | exports.getTotalDiskCapacitySync = getTotalDiskCapacitySync;
|
568 | exports.getTotalDiskCapacity = getTotalDiskCapacity;
|
569 |
|
570 | async function getTotalDiskCapacityOld() {
|
571 | if (_reactNative.Platform.OS === 'android') {
|
572 | return _nativeInterface.default.getTotalDiskCapacityOld();
|
573 | }
|
574 |
|
575 | if (_reactNative.Platform.OS === 'ios' || _reactNative.Platform.OS === 'windows' || _reactNative.Platform.OS === 'web') {
|
576 | return getTotalDiskCapacity();
|
577 | }
|
578 |
|
579 | return -1;
|
580 | }
|
581 |
|
582 | function getTotalDiskCapacityOldSync() {
|
583 | if (_reactNative.Platform.OS === 'android') {
|
584 | return _nativeInterface.default.getTotalDiskCapacityOldSync();
|
585 | }
|
586 |
|
587 | if (_reactNative.Platform.OS === 'ios' || _reactNative.Platform.OS === 'windows' || _reactNative.Platform.OS === 'web') {
|
588 | return getTotalDiskCapacitySync();
|
589 | }
|
590 |
|
591 | return -1;
|
592 | }
|
593 |
|
594 | const [getFreeDiskStorage, getFreeDiskStorageSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
595 | supportedPlatforms: ['android', 'ios', 'windows', 'web'],
|
596 | getter: () => _nativeInterface.default.getFreeDiskStorage(),
|
597 | syncGetter: () => _nativeInterface.default.getFreeDiskStorageSync(),
|
598 | defaultValue: -1
|
599 | });
|
600 | exports.getFreeDiskStorageSync = getFreeDiskStorageSync;
|
601 | exports.getFreeDiskStorage = getFreeDiskStorage;
|
602 |
|
603 | async function getFreeDiskStorageOld() {
|
604 | if (_reactNative.Platform.OS === 'android') {
|
605 | return _nativeInterface.default.getFreeDiskStorageOld();
|
606 | }
|
607 |
|
608 | if (_reactNative.Platform.OS === 'ios' || _reactNative.Platform.OS === 'windows' || _reactNative.Platform.OS === 'web') {
|
609 | return getFreeDiskStorage();
|
610 | }
|
611 |
|
612 | return -1;
|
613 | }
|
614 |
|
615 | function getFreeDiskStorageOldSync() {
|
616 | if (_reactNative.Platform.OS === 'android') {
|
617 | return _nativeInterface.default.getFreeDiskStorageOldSync();
|
618 | }
|
619 |
|
620 | if (_reactNative.Platform.OS === 'ios' || _reactNative.Platform.OS === 'windows' || _reactNative.Platform.OS === 'web') {
|
621 | return getFreeDiskStorageSync();
|
622 | }
|
623 |
|
624 | return -1;
|
625 | }
|
626 |
|
627 | const [getBatteryLevel, getBatteryLevelSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
628 | supportedPlatforms: ['android', 'ios', 'windows', 'web'],
|
629 | getter: () => _nativeInterface.default.getBatteryLevel(),
|
630 | syncGetter: () => _nativeInterface.default.getBatteryLevelSync(),
|
631 | defaultValue: -1
|
632 | });
|
633 | exports.getBatteryLevelSync = getBatteryLevelSync;
|
634 | exports.getBatteryLevel = getBatteryLevel;
|
635 | const [getPowerState, getPowerStateSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
636 | supportedPlatforms: ['ios', 'android', 'windows', 'web'],
|
637 | getter: () => _nativeInterface.default.getPowerState(),
|
638 | syncGetter: () => _nativeInterface.default.getPowerStateSync(),
|
639 | defaultValue: {}
|
640 | });
|
641 | exports.getPowerStateSync = getPowerStateSync;
|
642 | exports.getPowerState = getPowerState;
|
643 | const [isBatteryCharging, isBatteryChargingSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
644 | supportedPlatforms: ['android', 'ios', 'windows', 'web'],
|
645 | getter: () => _nativeInterface.default.isBatteryCharging(),
|
646 | syncGetter: () => _nativeInterface.default.isBatteryChargingSync(),
|
647 | defaultValue: false
|
648 | });
|
649 | exports.isBatteryChargingSync = isBatteryChargingSync;
|
650 | exports.isBatteryCharging = isBatteryCharging;
|
651 |
|
652 | async function isLandscape() {
|
653 | return Promise.resolve(isLandscapeSync());
|
654 | }
|
655 |
|
656 | function isLandscapeSync() {
|
657 | const {
|
658 | height,
|
659 | width
|
660 | } = _reactNative.Dimensions.get('window');
|
661 |
|
662 | return width >= height;
|
663 | }
|
664 |
|
665 | const [isAirplaneMode, isAirplaneModeSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
666 | supportedPlatforms: ['android', 'web'],
|
667 | getter: () => _nativeInterface.default.isAirplaneMode(),
|
668 | syncGetter: () => _nativeInterface.default.isAirplaneModeSync(),
|
669 | defaultValue: false
|
670 | });
|
671 | exports.isAirplaneModeSync = isAirplaneModeSync;
|
672 | exports.isAirplaneMode = isAirplaneMode;
|
673 |
|
674 | const getDeviceType = () => {
|
675 | return (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
676 | memoKey: 'deviceType',
|
677 | supportedPlatforms: ['android', 'ios', 'windows'],
|
678 | defaultValue: 'unknown',
|
679 | getter: () => _nativeInterface.default.deviceType
|
680 | });
|
681 | };
|
682 |
|
683 | exports.getDeviceType = getDeviceType;
|
684 |
|
685 | const getDeviceTypeSync = () => {
|
686 | return (0, _supportedPlatformInfo.getSupportedPlatformInfoSync)({
|
687 | memoKey: 'deviceType',
|
688 | supportedPlatforms: ['android', 'ios', 'windows'],
|
689 | defaultValue: 'unknown',
|
690 | getter: () => _nativeInterface.default.deviceType
|
691 | });
|
692 | };
|
693 |
|
694 | exports.getDeviceTypeSync = getDeviceTypeSync;
|
695 | const [supportedAbis, supportedAbisSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
696 | memoKey: '_supportedAbis',
|
697 | supportedPlatforms: ['android', 'ios', 'windows'],
|
698 | getter: () => _nativeInterface.default.getSupportedAbis(),
|
699 | syncGetter: () => _nativeInterface.default.getSupportedAbisSync(),
|
700 | defaultValue: []
|
701 | });
|
702 | exports.supportedAbisSync = supportedAbisSync;
|
703 | exports.supportedAbis = supportedAbis;
|
704 | const [supported32BitAbis, supported32BitAbisSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
705 | memoKey: '_supported32BitAbis',
|
706 | supportedPlatforms: ['android'],
|
707 | getter: () => _nativeInterface.default.getSupported32BitAbis(),
|
708 | syncGetter: () => _nativeInterface.default.getSupported32BitAbisSync(),
|
709 | defaultValue: []
|
710 | });
|
711 | exports.supported32BitAbisSync = supported32BitAbisSync;
|
712 | exports.supported32BitAbis = supported32BitAbis;
|
713 | const [supported64BitAbis, supported64BitAbisSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
714 | memoKey: '_supported64BitAbis',
|
715 | supportedPlatforms: ['android'],
|
716 | getter: () => _nativeInterface.default.getSupported64BitAbis(),
|
717 | syncGetter: () => _nativeInterface.default.getSupported64BitAbisSync(),
|
718 | defaultValue: []
|
719 | });
|
720 | exports.supported64BitAbisSync = supported64BitAbisSync;
|
721 | exports.supported64BitAbis = supported64BitAbis;
|
722 |
|
723 | async function hasSystemFeature(feature) {
|
724 | if (_reactNative.Platform.OS === 'android') {
|
725 | return _nativeInterface.default.hasSystemFeature(feature);
|
726 | }
|
727 |
|
728 | return false;
|
729 | }
|
730 |
|
731 | function hasSystemFeatureSync(feature) {
|
732 | if (_reactNative.Platform.OS === 'android') {
|
733 | return _nativeInterface.default.hasSystemFeatureSync(feature);
|
734 | }
|
735 |
|
736 | return false;
|
737 | }
|
738 |
|
739 | function isLowBatteryLevel(level) {
|
740 | if (_reactNative.Platform.OS === 'android') {
|
741 | return level < 0.15;
|
742 | }
|
743 |
|
744 | return level < 0.2;
|
745 | }
|
746 |
|
747 | const [getSystemAvailableFeatures, getSystemAvailableFeaturesSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
748 | supportedPlatforms: ['android'],
|
749 | getter: () => _nativeInterface.default.getSystemAvailableFeatures(),
|
750 | syncGetter: () => _nativeInterface.default.getSystemAvailableFeaturesSync(),
|
751 | defaultValue: []
|
752 | });
|
753 | exports.getSystemAvailableFeaturesSync = getSystemAvailableFeaturesSync;
|
754 | exports.getSystemAvailableFeatures = getSystemAvailableFeatures;
|
755 | const [isLocationEnabled, isLocationEnabledSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
756 | supportedPlatforms: ['android', 'ios', 'web'],
|
757 | getter: () => _nativeInterface.default.isLocationEnabled(),
|
758 | syncGetter: () => _nativeInterface.default.isLocationEnabledSync(),
|
759 | defaultValue: false
|
760 | });
|
761 | exports.isLocationEnabledSync = isLocationEnabledSync;
|
762 | exports.isLocationEnabled = isLocationEnabled;
|
763 | const [isHeadphonesConnected, isHeadphonesConnectedSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
764 | supportedPlatforms: ['android', 'ios'],
|
765 | getter: () => _nativeInterface.default.isHeadphonesConnected(),
|
766 | syncGetter: () => _nativeInterface.default.isHeadphonesConnectedSync(),
|
767 | defaultValue: false
|
768 | });
|
769 | exports.isHeadphonesConnectedSync = isHeadphonesConnectedSync;
|
770 | exports.isHeadphonesConnected = isHeadphonesConnected;
|
771 | const [isMouseConnected, isMouseConnectedSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
772 | supportedPlatforms: ['windows'],
|
773 | getter: () => _nativeInterface.default.isMouseConnected(),
|
774 | syncGetter: () => _nativeInterface.default.isMouseConnectedSync(),
|
775 | defaultValue: false
|
776 | });
|
777 | exports.isMouseConnectedSync = isMouseConnectedSync;
|
778 | exports.isMouseConnected = isMouseConnected;
|
779 | const [isKeyboardConnected, isKeyboardConnectedSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
780 | supportedPlatforms: ['windows'],
|
781 | getter: () => _nativeInterface.default.isKeyboardConnected(),
|
782 | syncGetter: () => _nativeInterface.default.isKeyboardConnectedSync(),
|
783 | defaultValue: false
|
784 | });
|
785 | exports.isKeyboardConnectedSync = isKeyboardConnectedSync;
|
786 | exports.isKeyboardConnected = isKeyboardConnected;
|
787 |
|
788 | const isTabletMode = () => (0, _supportedPlatformInfo.getSupportedPlatformInfoAsync)({
|
789 | supportedPlatforms: ['windows'],
|
790 | getter: () => _nativeInterface.default.isTabletMode(),
|
791 | defaultValue: false
|
792 | });
|
793 |
|
794 | exports.isTabletMode = isTabletMode;
|
795 | const [getAvailableLocationProviders, getAvailableLocationProvidersSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
796 | supportedPlatforms: ['android', 'ios'],
|
797 | getter: () => _nativeInterface.default.getAvailableLocationProviders(),
|
798 | syncGetter: () => _nativeInterface.default.getAvailableLocationProvidersSync(),
|
799 | defaultValue: {}
|
800 | });
|
801 | exports.getAvailableLocationProvidersSync = getAvailableLocationProvidersSync;
|
802 | exports.getAvailableLocationProviders = getAvailableLocationProviders;
|
803 | const [getBrightness, getBrightnessSync] = (0, _supportedPlatformInfo.getSupportedPlatformInfoFunctions)({
|
804 | supportedPlatforms: ['ios'],
|
805 | getter: () => _nativeInterface.default.getBrightness(),
|
806 | syncGetter: () => _nativeInterface.default.getBrightnessSync(),
|
807 | defaultValue: -1
|
808 | });
|
809 | exports.getBrightnessSync = getBrightnessSync;
|
810 | exports.getBrightness = getBrightness;
|
811 |
|
812 | async function getDeviceToken() {
|
813 | if (_reactNative.Platform.OS === 'ios') {
|
814 | return _nativeInterface.default.getDeviceToken();
|
815 | }
|
816 |
|
817 | return 'unknown';
|
818 | }
|
819 |
|
820 | const deviceInfoEmitter = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.RNDeviceInfo);
|
821 |
|
822 | function useBatteryLevel() {
|
823 | const [batteryLevel, setBatteryLevel] = (0, _react.useState)(null);
|
824 | (0, _react.useEffect)(() => {
|
825 | const setInitialValue = async () => {
|
826 | const initialValue = await getBatteryLevel();
|
827 | setBatteryLevel(initialValue);
|
828 | };
|
829 |
|
830 | const onChange = level => {
|
831 | setBatteryLevel(level);
|
832 | };
|
833 |
|
834 | setInitialValue();
|
835 | const subscription = deviceInfoEmitter.addListener('RNDeviceInfo_batteryLevelDidChange', onChange);
|
836 | return () => subscription.remove();
|
837 | }, []);
|
838 | return batteryLevel;
|
839 | }
|
840 |
|
841 | function useBatteryLevelIsLow() {
|
842 | const [batteryLevelIsLow, setBatteryLevelIsLow] = (0, _react.useState)(null);
|
843 | (0, _react.useEffect)(() => {
|
844 | const setInitialValue = async () => {
|
845 | const initialValue = await getBatteryLevel();
|
846 | isLowBatteryLevel(initialValue) && setBatteryLevelIsLow(initialValue);
|
847 | };
|
848 |
|
849 | setInitialValue();
|
850 |
|
851 | const onChange = level => {
|
852 | setBatteryLevelIsLow(level);
|
853 | };
|
854 |
|
855 | const subscription = deviceInfoEmitter.addListener('RNDeviceInfo_batteryLevelIsLow', onChange);
|
856 | return () => subscription.remove();
|
857 | }, []);
|
858 | return batteryLevelIsLow;
|
859 | }
|
860 |
|
861 | function usePowerState() {
|
862 | const [powerState, setPowerState] = (0, _react.useState)({});
|
863 | (0, _react.useEffect)(() => {
|
864 | const setInitialValue = async () => {
|
865 | const initialValue = await getPowerState();
|
866 | setPowerState(initialValue);
|
867 | };
|
868 |
|
869 | const onChange = state => {
|
870 | setPowerState(state);
|
871 | };
|
872 |
|
873 | setInitialValue();
|
874 | const subscription = deviceInfoEmitter.addListener('RNDeviceInfo_powerStateDidChange', onChange);
|
875 | return () => subscription.remove();
|
876 | }, []);
|
877 | return powerState;
|
878 | }
|
879 |
|
880 | function useIsHeadphonesConnected() {
|
881 | return (0, _asyncHookWrappers.useOnEvent)('RNDeviceInfo_headphoneConnectionDidChange', isHeadphonesConnected, false);
|
882 | }
|
883 |
|
884 | function useFirstInstallTime() {
|
885 | return (0, _asyncHookWrappers.useOnMount)(getFirstInstallTime, -1);
|
886 | }
|
887 |
|
888 | function useDeviceName() {
|
889 | return (0, _asyncHookWrappers.useOnMount)(getDeviceName, 'unknown');
|
890 | }
|
891 |
|
892 | function useHasSystemFeature(feature) {
|
893 | const asyncGetter = (0, _react.useCallback)(() => hasSystemFeature(feature), [feature]);
|
894 | return (0, _asyncHookWrappers.useOnMount)(asyncGetter, false);
|
895 | }
|
896 |
|
897 | function useIsEmulator() {
|
898 | return (0, _asyncHookWrappers.useOnMount)(isEmulator, false);
|
899 | }
|
900 |
|
901 | function useManufacturer() {
|
902 | return (0, _asyncHookWrappers.useOnMount)(getManufacturer, 'unknown');
|
903 | }
|
904 |
|
905 | function useBrightness() {
|
906 | const [brightness, setBrightness] = (0, _react.useState)(null);
|
907 | (0, _react.useEffect)(() => {
|
908 | const setInitialValue = async () => {
|
909 | const initialValue = await getBrightness();
|
910 | setBrightness(initialValue);
|
911 | };
|
912 |
|
913 | const onChange = value => {
|
914 | setBrightness(value);
|
915 | };
|
916 |
|
917 | setInitialValue();
|
918 | const subscription = deviceInfoEmitter.addListener('RNDeviceInfo_brightnessDidChange', onChange);
|
919 | return () => subscription.remove();
|
920 | }, []);
|
921 | return brightness;
|
922 | }
|
923 |
|
924 | const deviceInfoModule = {
|
925 | getAndroidId,
|
926 | getAndroidIdSync,
|
927 | getApiLevel,
|
928 | getApiLevelSync,
|
929 | getApplicationName,
|
930 | getAvailableLocationProviders,
|
931 | getAvailableLocationProvidersSync,
|
932 | getBaseOs,
|
933 | getBaseOsSync,
|
934 | getBatteryLevel,
|
935 | getBatteryLevelSync,
|
936 | getBootloader,
|
937 | getBootloaderSync,
|
938 | getBrand,
|
939 | getBuildId,
|
940 | getBuildIdSync,
|
941 | getBuildNumber,
|
942 | getBundleId,
|
943 | getCarrier,
|
944 | getCarrierSync,
|
945 | getCodename,
|
946 | getCodenameSync,
|
947 | getDevice,
|
948 | getDeviceId,
|
949 | getDeviceName,
|
950 | getDeviceNameSync,
|
951 | getDeviceSync,
|
952 | getDeviceToken,
|
953 | getDeviceType,
|
954 | getDisplay,
|
955 | getDisplaySync,
|
956 | getFingerprint,
|
957 | getFingerprintSync,
|
958 | getFirstInstallTime,
|
959 | getFirstInstallTimeSync,
|
960 | getFontScale,
|
961 | getFontScaleSync,
|
962 | getFreeDiskStorage,
|
963 | getFreeDiskStorageOld,
|
964 | getFreeDiskStorageSync,
|
965 | getFreeDiskStorageOldSync,
|
966 | getHardware,
|
967 | getHardwareSync,
|
968 | getHost,
|
969 | getHostSync,
|
970 | getIncremental,
|
971 | getIncrementalSync,
|
972 | getInstallerPackageName,
|
973 | getInstallerPackageNameSync,
|
974 | getInstallReferrer,
|
975 | getInstallReferrerSync,
|
976 | getInstanceId,
|
977 | getInstanceIdSync,
|
978 | getIpAddress,
|
979 | getIpAddressSync,
|
980 | getLastUpdateTime,
|
981 | getLastUpdateTimeSync,
|
982 | getMacAddress,
|
983 | getMacAddressSync,
|
984 | getManufacturer,
|
985 | getManufacturerSync,
|
986 | getMaxMemory,
|
987 | getMaxMemorySync,
|
988 | getModel,
|
989 | getPhoneNumber,
|
990 | getPhoneNumberSync,
|
991 | getPowerState,
|
992 | getPowerStateSync,
|
993 | getPreviewSdkInt,
|
994 | getPreviewSdkIntSync,
|
995 | getProduct,
|
996 | getProductSync,
|
997 | getReadableVersion,
|
998 | getSecurityPatch,
|
999 | getSecurityPatchSync,
|
1000 | getSerialNumber,
|
1001 | getSerialNumberSync,
|
1002 | getSystemAvailableFeatures,
|
1003 | getSystemAvailableFeaturesSync,
|
1004 | getSystemName,
|
1005 | getSystemVersion,
|
1006 | getTags,
|
1007 | getTagsSync,
|
1008 | getTotalDiskCapacity,
|
1009 | getTotalDiskCapacityOld,
|
1010 | getTotalDiskCapacitySync,
|
1011 | getTotalDiskCapacityOldSync,
|
1012 | getTotalMemory,
|
1013 | getTotalMemorySync,
|
1014 | getType,
|
1015 | getTypeSync,
|
1016 | getUniqueId,
|
1017 | getUniqueIdSync,
|
1018 | getUsedMemory,
|
1019 | getUsedMemorySync,
|
1020 | getUserAgent,
|
1021 | getUserAgentSync,
|
1022 | getVersion,
|
1023 | getBrightness,
|
1024 | getBrightnessSync,
|
1025 | hasGms,
|
1026 | hasGmsSync,
|
1027 | hasHms,
|
1028 | hasHmsSync,
|
1029 | hasNotch,
|
1030 | hasDynamicIsland,
|
1031 | hasSystemFeature,
|
1032 | hasSystemFeatureSync,
|
1033 | isAirplaneMode,
|
1034 | isAirplaneModeSync,
|
1035 | isBatteryCharging,
|
1036 | isBatteryChargingSync,
|
1037 | isCameraPresent,
|
1038 | isCameraPresentSync,
|
1039 | isEmulator,
|
1040 | isEmulatorSync,
|
1041 | isHeadphonesConnected,
|
1042 | isHeadphonesConnectedSync,
|
1043 | isLandscape,
|
1044 | isLandscapeSync,
|
1045 | isLocationEnabled,
|
1046 | isLocationEnabledSync,
|
1047 | isPinOrFingerprintSet,
|
1048 | isPinOrFingerprintSetSync,
|
1049 | isMouseConnected,
|
1050 | isMouseConnectedSync,
|
1051 | isKeyboardConnected,
|
1052 | isKeyboardConnectedSync,
|
1053 | isTabletMode,
|
1054 | isTablet,
|
1055 | supported32BitAbis,
|
1056 | supported32BitAbisSync,
|
1057 | supported64BitAbis,
|
1058 | supported64BitAbisSync,
|
1059 | supportedAbis,
|
1060 | supportedAbisSync,
|
1061 | syncUniqueId,
|
1062 | useBatteryLevel,
|
1063 | useBatteryLevelIsLow,
|
1064 | useDeviceName,
|
1065 | useFirstInstallTime,
|
1066 | useHasSystemFeature,
|
1067 | useIsEmulator,
|
1068 | usePowerState,
|
1069 | useManufacturer,
|
1070 | useIsHeadphonesConnected,
|
1071 | useBrightness
|
1072 | };
|
1073 | var _default = deviceInfoModule;
|
1074 | exports.default = _default;
|
1075 |
|
\ | No newline at end of file |