@umituz/react-native-design-system 2.9.21 → 2.9.23
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.23",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -12,6 +12,7 @@ import { Dimensions } from 'react-native';
|
|
|
12
12
|
import * as Localization from 'expo-localization';
|
|
13
13
|
import { DeviceInfoService } from './DeviceInfoService';
|
|
14
14
|
import { ApplicationInfoService } from './ApplicationInfoService';
|
|
15
|
+
import { DeviceIdService } from './DeviceIdService';
|
|
15
16
|
import { PersistentDeviceIdService } from './PersistentDeviceIdService';
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -21,43 +22,48 @@ import { PersistentDeviceIdService } from './PersistentDeviceIdService';
|
|
|
21
22
|
*/
|
|
22
23
|
export interface DeviceExtras {
|
|
23
24
|
[key: string]: string | number | boolean | undefined;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
/** The stable ID stored in Keychain/SecureStore */
|
|
26
|
+
deviceId: string;
|
|
27
|
+
/** Alias for deviceId for clarity in Firestore */
|
|
28
|
+
persistentDeviceId: string;
|
|
29
|
+
/** The raw native platform ID (IDFV on iOS, Android ID on Android) */
|
|
30
|
+
nativeDeviceId: string;
|
|
31
|
+
platform: string;
|
|
32
|
+
deviceModel: string;
|
|
33
|
+
deviceBrand: string;
|
|
34
|
+
deviceName: string;
|
|
35
|
+
deviceType: number | string;
|
|
36
|
+
deviceYearClass: number | string;
|
|
37
|
+
isDevice: boolean;
|
|
38
|
+
osName: string;
|
|
39
|
+
osVersion: string;
|
|
40
|
+
osBuildId: string;
|
|
41
|
+
totalMemory: number | string;
|
|
42
|
+
appVersion: string;
|
|
43
|
+
buildNumber: string;
|
|
44
|
+
locale: string;
|
|
45
|
+
region: string;
|
|
46
|
+
timezone: string;
|
|
47
|
+
screenWidth: number;
|
|
48
|
+
screenHeight: number;
|
|
49
|
+
screenScale: number;
|
|
50
|
+
fontScale: number;
|
|
51
|
+
isLandscape: boolean;
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
/**
|
|
49
55
|
* Get device locale code
|
|
50
56
|
*/
|
|
51
|
-
function getDeviceLocale(): string
|
|
57
|
+
function getDeviceLocale(): string {
|
|
52
58
|
try {
|
|
53
59
|
const locales = Localization.getLocales();
|
|
54
60
|
if (locales && locales.length > 0) {
|
|
55
61
|
const locale = locales[0];
|
|
56
|
-
return locale?.languageTag ||
|
|
62
|
+
return locale?.languageTag || '-';
|
|
57
63
|
}
|
|
58
|
-
return
|
|
64
|
+
return '-';
|
|
59
65
|
} catch {
|
|
60
|
-
return
|
|
66
|
+
return '-';
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
|
|
@@ -77,40 +83,68 @@ function getDeviceLocale(): string | undefined {
|
|
|
77
83
|
*/
|
|
78
84
|
export async function collectDeviceExtras(): Promise<DeviceExtras> {
|
|
79
85
|
try {
|
|
80
|
-
const [deviceInfo, appInfo, deviceId] = await Promise.all([
|
|
86
|
+
const [deviceInfo, appInfo, deviceId, nativeDeviceId] = await Promise.all([
|
|
81
87
|
DeviceInfoService.getDeviceInfo(),
|
|
82
88
|
ApplicationInfoService.getApplicationInfo(),
|
|
83
89
|
PersistentDeviceIdService.getDeviceId(),
|
|
90
|
+
DeviceIdService.getDeviceId(),
|
|
84
91
|
]);
|
|
85
92
|
|
|
86
93
|
const locale = getDeviceLocale();
|
|
87
94
|
const { width, height, scale, fontScale } = Dimensions.get('screen');
|
|
88
95
|
|
|
89
96
|
return {
|
|
90
|
-
deviceId,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
deviceId: deviceId || '-',
|
|
98
|
+
persistentDeviceId: deviceId || '-',
|
|
99
|
+
nativeDeviceId: nativeDeviceId || '-',
|
|
100
|
+
platform: deviceInfo.platform || '-',
|
|
101
|
+
deviceModel: deviceInfo.modelName || '-',
|
|
102
|
+
deviceBrand: deviceInfo.brand || '-',
|
|
103
|
+
deviceName: deviceInfo.deviceName || '-',
|
|
104
|
+
deviceType: deviceInfo.deviceType ?? '-',
|
|
105
|
+
deviceYearClass: deviceInfo.deviceYearClass ?? '-',
|
|
106
|
+
isDevice: deviceInfo.isDevice ?? false,
|
|
107
|
+
osName: deviceInfo.osName || '-',
|
|
108
|
+
osVersion: deviceInfo.osVersion || '-',
|
|
109
|
+
osBuildId: deviceInfo.osBuildId || '-',
|
|
110
|
+
totalMemory: deviceInfo.totalMemory ?? '-',
|
|
111
|
+
appVersion: appInfo.nativeApplicationVersion || '-',
|
|
112
|
+
buildNumber: appInfo.nativeBuildVersion || '-',
|
|
104
113
|
locale,
|
|
105
|
-
region: deviceInfo.region ||
|
|
106
|
-
timezone: deviceInfo.timezone ||
|
|
107
|
-
screenWidth: Math.round(width),
|
|
108
|
-
screenHeight: Math.round(height),
|
|
109
|
-
screenScale: scale,
|
|
110
|
-
fontScale,
|
|
114
|
+
region: deviceInfo.region || '-',
|
|
115
|
+
timezone: deviceInfo.timezone || '-',
|
|
116
|
+
screenWidth: Math.round(width) || 0,
|
|
117
|
+
screenHeight: Math.round(height) || 0,
|
|
118
|
+
screenScale: scale || 1,
|
|
119
|
+
fontScale: fontScale || 1,
|
|
111
120
|
isLandscape: width > height,
|
|
112
121
|
};
|
|
113
122
|
} catch {
|
|
114
|
-
return {
|
|
123
|
+
return {
|
|
124
|
+
deviceId: '-',
|
|
125
|
+
persistentDeviceId: '-',
|
|
126
|
+
nativeDeviceId: '-',
|
|
127
|
+
platform: '-',
|
|
128
|
+
deviceModel: '-',
|
|
129
|
+
deviceBrand: '-',
|
|
130
|
+
deviceName: '-',
|
|
131
|
+
deviceType: '-',
|
|
132
|
+
deviceYearClass: '-',
|
|
133
|
+
isDevice: false,
|
|
134
|
+
osName: '-',
|
|
135
|
+
osVersion: '-',
|
|
136
|
+
osBuildId: '-',
|
|
137
|
+
totalMemory: '-',
|
|
138
|
+
appVersion: '-',
|
|
139
|
+
buildNumber: '-',
|
|
140
|
+
locale: '-',
|
|
141
|
+
region: '-',
|
|
142
|
+
timezone: '-',
|
|
143
|
+
screenWidth: 0,
|
|
144
|
+
screenHeight: 0,
|
|
145
|
+
screenScale: 1,
|
|
146
|
+
fontScale: 1,
|
|
147
|
+
isLandscape: false,
|
|
148
|
+
};
|
|
115
149
|
}
|
|
116
150
|
}
|