@symbiote-native/device 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +266 -0
- package/build/angular/index.d.ts +1 -0
- package/build/angular/index.js +4 -0
- package/build/core/device.d.ts +138 -0
- package/build/core/device.js +194 -0
- package/build/core/index.d.ts +2 -0
- package/build/core/index.js +2 -0
- package/build/core/native-module.d.ts +29 -0
- package/build/core/native-module.js +4 -0
- package/build/core/types.d.ts +13 -0
- package/build/core/types.js +17 -0
- package/build/react/index.d.ts +1 -0
- package/build/react/index.js +6 -0
- package/build/vue/index.d.ts +1 -0
- package/build/vue/index.js +4 -0
- package/build-ngc/angular/index.d.ts +1 -0
- package/build-ngc/angular/index.js +5 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/core/device.d.ts +138 -0
- package/build-ngc/core/device.js +195 -0
- package/build-ngc/core/device.js.map +1 -0
- package/build-ngc/core/index.d.ts +2 -0
- package/build-ngc/core/index.js +3 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +29 -0
- package/build-ngc/core/native-module.js +5 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/types.d.ts +13 -0
- package/build-ngc/core/types.js +18 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +12 -0
- package/package.json +107 -0
- package/src/angular/index.ts +4 -0
- package/src/core/device.test.ts +202 -0
- package/src/core/device.ts +222 -0
- package/src/core/index.ts +28 -0
- package/src/core/native-module.ts +42 -0
- package/src/core/types.ts +17 -0
- package/src/react/index.ts +6 -0
- package/src/vue/index.ts +4 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The type of device the app is currently running on. */
|
|
2
|
+
export declare enum DeviceType {
|
|
3
|
+
/** An unrecognized device type. */
|
|
4
|
+
UNKNOWN = 0,
|
|
5
|
+
/** Mobile phone handsets, typically with a touch screen and held in one hand. */
|
|
6
|
+
PHONE = 1,
|
|
7
|
+
/** Tablet computers, typically with a touch screen that is larger than a usual phone. */
|
|
8
|
+
TABLET = 2,
|
|
9
|
+
/** Desktop or laptop computers, typically with a keyboard and mouse. */
|
|
10
|
+
DESKTOP = 3,
|
|
11
|
+
/** Device with TV-based interfaces. */
|
|
12
|
+
TV = 4
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Hand-ported from .vendors/expo/packages/expo-device/src/Device.types.ts (sdk-57). The enum
|
|
2
|
+
// itself carries no platform-specific logic (unlike local-auth's SecurityLevel.BIOMETRIC alias),
|
|
3
|
+
// so it's a verbatim port with no expo-modules-core dependency at all.
|
|
4
|
+
/** The type of device the app is currently running on. */
|
|
5
|
+
export var DeviceType;
|
|
6
|
+
(function (DeviceType) {
|
|
7
|
+
/** An unrecognized device type. */
|
|
8
|
+
DeviceType[DeviceType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
9
|
+
/** Mobile phone handsets, typically with a touch screen and held in one hand. */
|
|
10
|
+
DeviceType[DeviceType["PHONE"] = 1] = "PHONE";
|
|
11
|
+
/** Tablet computers, typically with a touch screen that is larger than a usual phone. */
|
|
12
|
+
DeviceType[DeviceType["TABLET"] = 2] = "TABLET";
|
|
13
|
+
/** Desktop or laptop computers, typically with a keyboard and mouse. */
|
|
14
|
+
DeviceType[DeviceType["DESKTOP"] = 3] = "DESKTOP";
|
|
15
|
+
/** Device with TV-based interfaces. */
|
|
16
|
+
DeviceType[DeviceType["TV"] = 4] = "TV";
|
|
17
|
+
})(DeviceType || (DeviceType = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../core';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @symbiote-native/device/react: the React entry over the framework-agnostic core. Upstream
|
|
2
|
+
// ships eager constants and free async functions, no per-instance state and no event stream
|
|
3
|
+
// (unlike @symbiote-native/sensors) — there is nothing for a hook to wrap, so this is a plain
|
|
4
|
+
// re-export, mirroring how @symbiote-native/local-auth's React entry passes its own free
|
|
5
|
+
// functions through untouched.
|
|
6
|
+
export * from '../core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../core';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @symbiote-native/device/angular: the Angular entry over the framework-agnostic core. Same
|
|
2
|
+
// reasoning as the React/Vue entries — no per-instance state or event stream to wrap in a
|
|
3
|
+
// service, so this is a plain re-export.
|
|
4
|
+
export * from '../core';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,0FAA0F;AAC1F,yCAAyC;AACzC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { DeviceType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* `true` if the app is running on a real device and `false` if running in a simulator or
|
|
4
|
+
* emulator.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isDevice: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The device brand. The consumer-visible brand of the product/hardware.
|
|
9
|
+
* @example Device.brand; // Android: "google", "xiaomi"; iOS: "Apple"
|
|
10
|
+
*/
|
|
11
|
+
export declare const brand: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* The actual device manufacturer of the product or hardware. May be `null` if it cannot be
|
|
14
|
+
* determined.
|
|
15
|
+
*/
|
|
16
|
+
export declare const manufacturer: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* The internal model ID of the device — useful for programmatically identifying the type of
|
|
19
|
+
* device, not a human-friendly string.
|
|
20
|
+
* @platform ios
|
|
21
|
+
*/
|
|
22
|
+
export declare const modelId: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* The human-friendly name of the device model. May be `null` if it cannot be determined.
|
|
25
|
+
* @example Device.modelName; // Android: "Pixel 2"; iOS: "iPhone XS Max"
|
|
26
|
+
*/
|
|
27
|
+
export declare const modelName: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The specific configuration or name of the industrial design — the device's name when it was
|
|
30
|
+
* designed during manufacturing into mass production. Corresponds to `Build.DEVICE`.
|
|
31
|
+
* @platform android
|
|
32
|
+
*/
|
|
33
|
+
export declare const designName: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* The device's overall product name chosen by the device implementer, containing the
|
|
36
|
+
* development name or code name of the device. Corresponds to `Build.PRODUCT`.
|
|
37
|
+
* @platform android
|
|
38
|
+
*/
|
|
39
|
+
export declare const productName: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* The type of the device as a {@link DeviceType} enum value.
|
|
42
|
+
*/
|
|
43
|
+
export declare const deviceType: DeviceType | null;
|
|
44
|
+
/** The device year class (https://github.com/facebook/device-year-class) of this device. */
|
|
45
|
+
export declare const deviceYearClass: number | null;
|
|
46
|
+
/**
|
|
47
|
+
* The device's total memory, in bytes — the total memory accessible to the kernel, but not
|
|
48
|
+
* necessarily to a single app.
|
|
49
|
+
*/
|
|
50
|
+
export declare const totalMemory: number | null;
|
|
51
|
+
/**
|
|
52
|
+
* A list of supported processor architecture versions. `null` if the supported architectures
|
|
53
|
+
* could not be determined.
|
|
54
|
+
*/
|
|
55
|
+
export declare const supportedCpuArchitectures: string[] | null;
|
|
56
|
+
/**
|
|
57
|
+
* The name of the OS running on the device.
|
|
58
|
+
* @example Device.osName; // Android: "Android" or a build fingerprint string; iOS: "iOS"/"iPadOS"
|
|
59
|
+
*/
|
|
60
|
+
export declare const osName: string | null;
|
|
61
|
+
/**
|
|
62
|
+
* The human-readable OS version string. Note that the version string may not always contain
|
|
63
|
+
* three numbers separated by dots.
|
|
64
|
+
*/
|
|
65
|
+
export declare const osVersion: string | null;
|
|
66
|
+
/**
|
|
67
|
+
* The build ID of the OS that more precisely identifies the version of the OS. On Android this
|
|
68
|
+
* corresponds to `Build.DISPLAY` (not `Build.ID`); on iOS to `kern.osversion`.
|
|
69
|
+
*/
|
|
70
|
+
export declare const osBuildId: string | null;
|
|
71
|
+
/**
|
|
72
|
+
* The internal build ID of the OS running on the device. On Android this corresponds to
|
|
73
|
+
* `Build.ID`; on iOS it's the same value as {@link osBuildId}.
|
|
74
|
+
*/
|
|
75
|
+
export declare const osInternalBuildId: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* A string that uniquely identifies the build of the currently running system OS.
|
|
78
|
+
* @platform android
|
|
79
|
+
*/
|
|
80
|
+
export declare const osBuildFingerprint: string | null;
|
|
81
|
+
/**
|
|
82
|
+
* The Android SDK version of the software currently running on this hardware device.
|
|
83
|
+
* @platform android
|
|
84
|
+
*/
|
|
85
|
+
export declare const platformApiLevel: number | null;
|
|
86
|
+
/**
|
|
87
|
+
* The human-readable name of the device, which may be set by the device's user. `null` if the
|
|
88
|
+
* device name is unavailable.
|
|
89
|
+
*/
|
|
90
|
+
export declare const deviceName: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Checks the type of the device as a {@link DeviceType} enum value.
|
|
93
|
+
*
|
|
94
|
+
* On Android, for devices other than TVs, the device type is determined by the screen
|
|
95
|
+
* resolution (screen diagonal size), so the result may not be completely accurate. If the
|
|
96
|
+
* screen diagonal length is between 3" and 6.9", the method returns `DeviceType.PHONE`. For
|
|
97
|
+
* lengths between 7" and 18", the method returns `DeviceType.TABLET`. Otherwise it returns
|
|
98
|
+
* `DeviceType.UNKNOWN`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function getDeviceTypeAsync(): Promise<DeviceType>;
|
|
101
|
+
/**
|
|
102
|
+
* Gets the uptime since the last reboot of the device, in milliseconds. Android devices do not
|
|
103
|
+
* count time spent in deep sleep.
|
|
104
|
+
* @platform android
|
|
105
|
+
* @platform ios
|
|
106
|
+
*/
|
|
107
|
+
export declare function getUptimeAsync(): Promise<number>;
|
|
108
|
+
/**
|
|
109
|
+
* Returns the maximum amount of memory that the Java VM will attempt to use. If there is no
|
|
110
|
+
* inherent limit, `Number.MAX_SAFE_INTEGER` is returned instead of the native `-1` sentinel.
|
|
111
|
+
* @platform android
|
|
112
|
+
*/
|
|
113
|
+
export declare function getMaxMemoryAsync(): Promise<number>;
|
|
114
|
+
/**
|
|
115
|
+
* Checks whether the device has been rooted (Android) or jailbroken (iOS). This is a best-effort
|
|
116
|
+
* check — root/jailbreak-detection bypasses exist on both platforms, so a `false` result is not
|
|
117
|
+
* a guarantee.
|
|
118
|
+
*/
|
|
119
|
+
export declare function isRootedExperimentalAsync(): Promise<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* Returns whether applications can be installed for this user via the system's
|
|
122
|
+
* `ACTION_INSTALL_PACKAGE` mechanism, rather than through the OS's default app store. Requires
|
|
123
|
+
* the `REQUEST_INSTALL_PACKAGES` permission.
|
|
124
|
+
* @platform android
|
|
125
|
+
*/
|
|
126
|
+
export declare function isSideLoadingEnabledAsync(): Promise<boolean>;
|
|
127
|
+
/**
|
|
128
|
+
* Gets a list of platform-specific feature names available on the system. Resolves to an empty
|
|
129
|
+
* array rather than throwing when the native method is absent (e.g. on iOS), matching upstream.
|
|
130
|
+
* @platform android
|
|
131
|
+
*/
|
|
132
|
+
export declare function getPlatformFeaturesAsync(): Promise<string[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Tells if the device has a specific system feature. Resolves to `false` rather than throwing
|
|
135
|
+
* when the native method is absent (e.g. on iOS), matching upstream.
|
|
136
|
+
* @platform android
|
|
137
|
+
*/
|
|
138
|
+
export declare function hasPlatformFeatureAsync(feature: string): Promise<boolean>;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// Hand-ported from .vendors/expo/packages/expo-device/src/Device.ts (sdk-57). Every constant
|
|
2
|
+
// below is resolved eagerly, once, at import time — matching upstream's own top-level `export
|
|
3
|
+
// const` shape — from the native module's optional fields (native-module.ts), never imported
|
|
4
|
+
// from expo-device's own JS.
|
|
5
|
+
//
|
|
6
|
+
// Deviation from upstream: upstream guards each constant with `ExpoDevice ? field : fallback`,
|
|
7
|
+
// i.e. a truthiness check on the WHOLE module, because its own requireNativeModule call could in
|
|
8
|
+
// principle resolve to a falsy value on some legacy/web target. Every sibling package in this
|
|
9
|
+
// repo (local-auth, cellular, battery) instead resolves its native module unconditionally via
|
|
10
|
+
// expo-modules-core's requireNativeModule, which throws rather than returning null/undefined —
|
|
11
|
+
// so "the whole module is absent" already fails at import time here, same as every other
|
|
12
|
+
// package. What upstream's ternary is actually doing field-by-field IS still real and worth
|
|
13
|
+
// keeping: several constants are `undefined` on one platform by design (modelId is iOS-only;
|
|
14
|
+
// designName/productName/osBuildFingerprint/platformApiLevel are Android-only), so each constant
|
|
15
|
+
// below falls back with `??`, matching that per-field behavior without a redundant whole-module
|
|
16
|
+
// check the rest of this codebase's convention doesn't otherwise use.
|
|
17
|
+
import { UnavailabilityError } from 'expo-modules-core';
|
|
18
|
+
import { expoDevice } from './native-module';
|
|
19
|
+
import { DeviceType } from './types';
|
|
20
|
+
const NATIVE_MODULE_NAME = 'expo-device';
|
|
21
|
+
const MAX_MEMORY_UNLIMITED_SENTINEL = -1;
|
|
22
|
+
/**
|
|
23
|
+
* `true` if the app is running on a real device and `false` if running in a simulator or
|
|
24
|
+
* emulator.
|
|
25
|
+
*/
|
|
26
|
+
export const isDevice = expoDevice.isDevice ?? true;
|
|
27
|
+
/**
|
|
28
|
+
* The device brand. The consumer-visible brand of the product/hardware.
|
|
29
|
+
* @example Device.brand; // Android: "google", "xiaomi"; iOS: "Apple"
|
|
30
|
+
*/
|
|
31
|
+
export const brand = expoDevice.brand ?? null;
|
|
32
|
+
/**
|
|
33
|
+
* The actual device manufacturer of the product or hardware. May be `null` if it cannot be
|
|
34
|
+
* determined.
|
|
35
|
+
*/
|
|
36
|
+
export const manufacturer = expoDevice.manufacturer ?? null;
|
|
37
|
+
/**
|
|
38
|
+
* The internal model ID of the device — useful for programmatically identifying the type of
|
|
39
|
+
* device, not a human-friendly string.
|
|
40
|
+
* @platform ios
|
|
41
|
+
*/
|
|
42
|
+
export const modelId = expoDevice.modelId ?? null;
|
|
43
|
+
/**
|
|
44
|
+
* The human-friendly name of the device model. May be `null` if it cannot be determined.
|
|
45
|
+
* @example Device.modelName; // Android: "Pixel 2"; iOS: "iPhone XS Max"
|
|
46
|
+
*/
|
|
47
|
+
export const modelName = expoDevice.modelName ?? null;
|
|
48
|
+
/**
|
|
49
|
+
* The specific configuration or name of the industrial design — the device's name when it was
|
|
50
|
+
* designed during manufacturing into mass production. Corresponds to `Build.DEVICE`.
|
|
51
|
+
* @platform android
|
|
52
|
+
*/
|
|
53
|
+
export const designName = expoDevice.designName ?? null;
|
|
54
|
+
/**
|
|
55
|
+
* The device's overall product name chosen by the device implementer, containing the
|
|
56
|
+
* development name or code name of the device. Corresponds to `Build.PRODUCT`.
|
|
57
|
+
* @platform android
|
|
58
|
+
*/
|
|
59
|
+
export const productName = expoDevice.productName ?? null;
|
|
60
|
+
/**
|
|
61
|
+
* The type of the device as a {@link DeviceType} enum value.
|
|
62
|
+
*/
|
|
63
|
+
export const deviceType = expoDevice.deviceType ?? null;
|
|
64
|
+
/** The device year class (https://github.com/facebook/device-year-class) of this device. */
|
|
65
|
+
export const deviceYearClass = expoDevice.deviceYearClass ?? null;
|
|
66
|
+
/**
|
|
67
|
+
* The device's total memory, in bytes — the total memory accessible to the kernel, but not
|
|
68
|
+
* necessarily to a single app.
|
|
69
|
+
*/
|
|
70
|
+
export const totalMemory = expoDevice.totalMemory ?? null;
|
|
71
|
+
/**
|
|
72
|
+
* A list of supported processor architecture versions. `null` if the supported architectures
|
|
73
|
+
* could not be determined.
|
|
74
|
+
*/
|
|
75
|
+
export const supportedCpuArchitectures = expoDevice.supportedCpuArchitectures ?? null;
|
|
76
|
+
/**
|
|
77
|
+
* The name of the OS running on the device.
|
|
78
|
+
* @example Device.osName; // Android: "Android" or a build fingerprint string; iOS: "iOS"/"iPadOS"
|
|
79
|
+
*/
|
|
80
|
+
export const osName = expoDevice.osName ?? null;
|
|
81
|
+
/**
|
|
82
|
+
* The human-readable OS version string. Note that the version string may not always contain
|
|
83
|
+
* three numbers separated by dots.
|
|
84
|
+
*/
|
|
85
|
+
export const osVersion = expoDevice.osVersion ?? null;
|
|
86
|
+
/**
|
|
87
|
+
* The build ID of the OS that more precisely identifies the version of the OS. On Android this
|
|
88
|
+
* corresponds to `Build.DISPLAY` (not `Build.ID`); on iOS to `kern.osversion`.
|
|
89
|
+
*/
|
|
90
|
+
export const osBuildId = expoDevice.osBuildId ?? null;
|
|
91
|
+
/**
|
|
92
|
+
* The internal build ID of the OS running on the device. On Android this corresponds to
|
|
93
|
+
* `Build.ID`; on iOS it's the same value as {@link osBuildId}.
|
|
94
|
+
*/
|
|
95
|
+
export const osInternalBuildId = expoDevice.osInternalBuildId ?? null;
|
|
96
|
+
/**
|
|
97
|
+
* A string that uniquely identifies the build of the currently running system OS.
|
|
98
|
+
* @platform android
|
|
99
|
+
*/
|
|
100
|
+
export const osBuildFingerprint = expoDevice.osBuildFingerprint ?? null;
|
|
101
|
+
/**
|
|
102
|
+
* The Android SDK version of the software currently running on this hardware device.
|
|
103
|
+
* @platform android
|
|
104
|
+
*/
|
|
105
|
+
export const platformApiLevel = expoDevice.platformApiLevel ?? null;
|
|
106
|
+
/**
|
|
107
|
+
* The human-readable name of the device, which may be set by the device's user. `null` if the
|
|
108
|
+
* device name is unavailable.
|
|
109
|
+
*/
|
|
110
|
+
export const deviceName = expoDevice.deviceName ?? null;
|
|
111
|
+
/**
|
|
112
|
+
* Checks the type of the device as a {@link DeviceType} enum value.
|
|
113
|
+
*
|
|
114
|
+
* On Android, for devices other than TVs, the device type is determined by the screen
|
|
115
|
+
* resolution (screen diagonal size), so the result may not be completely accurate. If the
|
|
116
|
+
* screen diagonal length is between 3" and 6.9", the method returns `DeviceType.PHONE`. For
|
|
117
|
+
* lengths between 7" and 18", the method returns `DeviceType.TABLET`. Otherwise it returns
|
|
118
|
+
* `DeviceType.UNKNOWN`.
|
|
119
|
+
*/
|
|
120
|
+
export async function getDeviceTypeAsync() {
|
|
121
|
+
if (!expoDevice.getDeviceTypeAsync) {
|
|
122
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getDeviceTypeAsync');
|
|
123
|
+
}
|
|
124
|
+
return expoDevice.getDeviceTypeAsync();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Gets the uptime since the last reboot of the device, in milliseconds. Android devices do not
|
|
128
|
+
* count time spent in deep sleep.
|
|
129
|
+
* @platform android
|
|
130
|
+
* @platform ios
|
|
131
|
+
*/
|
|
132
|
+
export async function getUptimeAsync() {
|
|
133
|
+
if (!expoDevice.getUptimeAsync) {
|
|
134
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getUptimeAsync');
|
|
135
|
+
}
|
|
136
|
+
return expoDevice.getUptimeAsync();
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Returns the maximum amount of memory that the Java VM will attempt to use. If there is no
|
|
140
|
+
* inherent limit, `Number.MAX_SAFE_INTEGER` is returned instead of the native `-1` sentinel.
|
|
141
|
+
* @platform android
|
|
142
|
+
*/
|
|
143
|
+
export async function getMaxMemoryAsync() {
|
|
144
|
+
if (!expoDevice.getMaxMemoryAsync) {
|
|
145
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getMaxMemoryAsync');
|
|
146
|
+
}
|
|
147
|
+
const maxMemory = await expoDevice.getMaxMemoryAsync();
|
|
148
|
+
return maxMemory === MAX_MEMORY_UNLIMITED_SENTINEL ? Number.MAX_SAFE_INTEGER : maxMemory;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Checks whether the device has been rooted (Android) or jailbroken (iOS). This is a best-effort
|
|
152
|
+
* check — root/jailbreak-detection bypasses exist on both platforms, so a `false` result is not
|
|
153
|
+
* a guarantee.
|
|
154
|
+
*/
|
|
155
|
+
export async function isRootedExperimentalAsync() {
|
|
156
|
+
if (!expoDevice.isRootedExperimentalAsync) {
|
|
157
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'isRootedExperimentalAsync');
|
|
158
|
+
}
|
|
159
|
+
return expoDevice.isRootedExperimentalAsync();
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Returns whether applications can be installed for this user via the system's
|
|
163
|
+
* `ACTION_INSTALL_PACKAGE` mechanism, rather than through the OS's default app store. Requires
|
|
164
|
+
* the `REQUEST_INSTALL_PACKAGES` permission.
|
|
165
|
+
* @platform android
|
|
166
|
+
*/
|
|
167
|
+
export async function isSideLoadingEnabledAsync() {
|
|
168
|
+
if (!expoDevice.isSideLoadingEnabledAsync) {
|
|
169
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'isSideLoadingEnabledAsync');
|
|
170
|
+
}
|
|
171
|
+
return expoDevice.isSideLoadingEnabledAsync();
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Gets a list of platform-specific feature names available on the system. Resolves to an empty
|
|
175
|
+
* array rather than throwing when the native method is absent (e.g. on iOS), matching upstream.
|
|
176
|
+
* @platform android
|
|
177
|
+
*/
|
|
178
|
+
export async function getPlatformFeaturesAsync() {
|
|
179
|
+
if (!expoDevice.getPlatformFeaturesAsync) {
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
return expoDevice.getPlatformFeaturesAsync();
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Tells if the device has a specific system feature. Resolves to `false` rather than throwing
|
|
186
|
+
* when the native method is absent (e.g. on iOS), matching upstream.
|
|
187
|
+
* @platform android
|
|
188
|
+
*/
|
|
189
|
+
export async function hasPlatformFeatureAsync(feature) {
|
|
190
|
+
if (!expoDevice.hasPlatformFeatureAsync) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
return expoDevice.hasPlatformFeatureAsync(feature);
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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e;IAC3D,IAAI,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,UAAU,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { isDevice, brand, manufacturer, modelId, modelName, designName, productName, deviceType, deviceYearClass, totalMemory, supportedCpuArchitectures, osName, osVersion, osBuildId, osInternalBuildId, osBuildFingerprint, platformApiLevel, deviceName, getDeviceTypeAsync, getUptimeAsync, getMaxMemoryAsync, isRootedExperimentalAsync, isSideLoadingEnabledAsync, getPlatformFeaturesAsync, hasPlatformFeatureAsync, } from './device';
|
|
2
|
+
export { DeviceType } from './types';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { isDevice, brand, manufacturer, modelId, modelName, designName, productName, deviceType, deviceYearClass, totalMemory, supportedCpuArchitectures, osName, osVersion, osBuildId, osInternalBuildId, osBuildFingerprint, platformApiLevel, deviceName, getDeviceTypeAsync, getUptimeAsync, getMaxMemoryAsync, isRootedExperimentalAsync, isSideLoadingEnabledAsync, getPlatformFeaturesAsync, hasPlatformFeatureAsync, } from './device';
|
|
2
|
+
export { DeviceType } from './types';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,OAAO,EACP,SAAS,EACT,UAAU,EACV,WAAW,EACX,UAAU,EACV,eAAe,EACf,WAAW,EACX,yBAAyB,EACzB,MAAM,EACN,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DeviceType } from './types';
|
|
2
|
+
export type INativeDeviceModule = {
|
|
3
|
+
isDevice?: boolean;
|
|
4
|
+
brand?: string | null;
|
|
5
|
+
manufacturer?: string | null;
|
|
6
|
+
modelId?: string | null;
|
|
7
|
+
modelName?: string | null;
|
|
8
|
+
designName?: string | null;
|
|
9
|
+
productName?: string | null;
|
|
10
|
+
deviceType?: DeviceType | null;
|
|
11
|
+
deviceYearClass?: number | null;
|
|
12
|
+
totalMemory?: number | null;
|
|
13
|
+
supportedCpuArchitectures?: string[] | null;
|
|
14
|
+
osName?: string | null;
|
|
15
|
+
osVersion?: string | null;
|
|
16
|
+
osBuildId?: string | null;
|
|
17
|
+
osInternalBuildId?: string | null;
|
|
18
|
+
osBuildFingerprint?: string | null;
|
|
19
|
+
platformApiLevel?: number | null;
|
|
20
|
+
deviceName?: string | null;
|
|
21
|
+
getDeviceTypeAsync?(): Promise<DeviceType>;
|
|
22
|
+
getUptimeAsync?(): Promise<number>;
|
|
23
|
+
getMaxMemoryAsync?(): Promise<number>;
|
|
24
|
+
isRootedExperimentalAsync?(): Promise<boolean>;
|
|
25
|
+
isSideLoadingEnabledAsync?(): Promise<boolean>;
|
|
26
|
+
getPlatformFeaturesAsync?(): Promise<string[]>;
|
|
27
|
+
hasPlatformFeatureAsync?(feature: string): Promise<boolean>;
|
|
28
|
+
};
|
|
29
|
+
export declare const expoDevice: INativeDeviceModule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAsC7C,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAsB,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The type of device the app is currently running on. */
|
|
2
|
+
export declare enum DeviceType {
|
|
3
|
+
/** An unrecognized device type. */
|
|
4
|
+
UNKNOWN = 0,
|
|
5
|
+
/** Mobile phone handsets, typically with a touch screen and held in one hand. */
|
|
6
|
+
PHONE = 1,
|
|
7
|
+
/** Tablet computers, typically with a touch screen that is larger than a usual phone. */
|
|
8
|
+
TABLET = 2,
|
|
9
|
+
/** Desktop or laptop computers, typically with a keyboard and mouse. */
|
|
10
|
+
DESKTOP = 3,
|
|
11
|
+
/** Device with TV-based interfaces. */
|
|
12
|
+
TV = 4
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Hand-ported from .vendors/expo/packages/expo-device/src/Device.types.ts (sdk-57). The enum
|
|
2
|
+
// itself carries no platform-specific logic (unlike local-auth's SecurityLevel.BIOMETRIC alias),
|
|
3
|
+
// so it's a verbatim port with no expo-modules-core dependency at all.
|
|
4
|
+
/** The type of device the app is currently running on. */
|
|
5
|
+
export var DeviceType;
|
|
6
|
+
(function (DeviceType) {
|
|
7
|
+
/** An unrecognized device type. */
|
|
8
|
+
DeviceType[DeviceType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
9
|
+
/** Mobile phone handsets, typically with a touch screen and held in one hand. */
|
|
10
|
+
DeviceType[DeviceType["PHONE"] = 1] = "PHONE";
|
|
11
|
+
/** Tablet computers, typically with a touch screen that is larger than a usual phone. */
|
|
12
|
+
DeviceType[DeviceType["TABLET"] = 2] = "TABLET";
|
|
13
|
+
/** Desktop or laptop computers, typically with a keyboard and mouse. */
|
|
14
|
+
DeviceType[DeviceType["DESKTOP"] = 3] = "DESKTOP";
|
|
15
|
+
/** Device with TV-based interfaces. */
|
|
16
|
+
DeviceType[DeviceType["TV"] = 4] = "TV";
|
|
17
|
+
})(DeviceType || (DeviceType = {}));
|
|
18
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,iGAAiG;AACjG,uEAAuE;AAEvE,0DAA0D;AAC1D,MAAM,CAAN,IAAY,UAWX;AAXD,WAAY,UAAU;IACpB,mCAAmC;IACnC,iDAAW,CAAA;IACX,iFAAiF;IACjF,6CAAK,CAAA;IACL,yFAAyF;IACzF,+CAAM,CAAA;IACN,wEAAwE;IACxE,iDAAO,CAAA;IACP,uCAAuC;IACvC,uCAAE,CAAA;AACJ,CAAC,EAXW,UAAU,KAAV,UAAU,QAWrB"}
|
package/native-link.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@symbiote-native/device",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "expo-device wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, and Angular adapters. Device brand/model/OS constants, uptime, max-memory, root/jailbreak detection, side-loading detection, and platform-feature queries.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/OneEyed1366/symbiote-native.git",
|
|
9
|
+
"directory": "packages/device"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/OneEyed1366/symbiote-native/tree/master/packages/device#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/OneEyed1366/symbiote-native/issues"
|
|
14
|
+
},
|
|
15
|
+
"author": "Andrey Prokopenko <psevdoproger@gmail.com>",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "./build/core/index.js",
|
|
18
|
+
"module": "./build/core/index.js",
|
|
19
|
+
"types": "./build/core/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./build/core/index.d.ts",
|
|
23
|
+
"default": "./build/core/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./vue": {
|
|
26
|
+
"types": "./build/vue/index.d.ts",
|
|
27
|
+
"default": "./build/vue/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./react": {
|
|
30
|
+
"types": "./build/react/index.d.ts",
|
|
31
|
+
"default": "./build/react/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./angular": {
|
|
34
|
+
"types": "./build-ngc/angular/index.d.ts",
|
|
35
|
+
"react-native": "./build-ngc/angular/index.js",
|
|
36
|
+
"default": "./src/angular/index.ts"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"src",
|
|
41
|
+
"build",
|
|
42
|
+
"build-ngc",
|
|
43
|
+
"native-link.json"
|
|
44
|
+
],
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"expo-device": "57.0.1",
|
|
50
|
+
"expo-modules-core": "57.0.5"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@symbiote-native/engine": ">=0.1.7",
|
|
54
|
+
"@angular/core": ">=20",
|
|
55
|
+
"@vue/runtime-core": "^3.5.13",
|
|
56
|
+
"react": ">=19.0.0",
|
|
57
|
+
"react-native": ">=0.86",
|
|
58
|
+
"vue": ">=3.5.0",
|
|
59
|
+
"@symbiote-native/angular": "0.6.1",
|
|
60
|
+
"@symbiote-native/react": "0.2.8",
|
|
61
|
+
"@symbiote-native/vue": "0.3.8"
|
|
62
|
+
},
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"@symbiote-native/angular": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"@symbiote-native/react": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"@symbiote-native/vue": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@angular/core": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"@vue/runtime-core": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"react": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"vue": {
|
|
83
|
+
"optional": true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@angular/compiler": "^22",
|
|
88
|
+
"@angular/compiler-cli": "^22",
|
|
89
|
+
"@angular/core": "^22",
|
|
90
|
+
"@types/node": "^26.0.0",
|
|
91
|
+
"@types/react": "^19.2.0",
|
|
92
|
+
"@vue/runtime-core": "^3.5.13",
|
|
93
|
+
"react": "19.2.3",
|
|
94
|
+
"typescript": "~6.0.0",
|
|
95
|
+
"@symbiote-native/test-utils": "0.1.6",
|
|
96
|
+
"@symbiote-native/angular": "0.6.1",
|
|
97
|
+
"@symbiote-native/engine": "0.1.7",
|
|
98
|
+
"@symbiote-native/vue": "0.3.8",
|
|
99
|
+
"@symbiote-native/react": "0.2.8"
|
|
100
|
+
},
|
|
101
|
+
"scripts": {
|
|
102
|
+
"typecheck": "tsc --build",
|
|
103
|
+
"clean": "rm -rf build-ngc",
|
|
104
|
+
"ng:build": "pnpm run clean && ngc -p tsconfig.angular.json",
|
|
105
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
106
|
+
}
|
|
107
|
+
}
|