@unvired/react-native-unvired-sdk 0.0.25 → 0.0.26
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/BuildNo.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
R-0.000.
|
|
1
|
+
R-0.000.0026
|
|
@@ -6,16 +6,10 @@ import { IDeviceInfo } from './DeviceInfo.types';
|
|
|
6
6
|
export declare class BaseDeviceInfo {
|
|
7
7
|
private static cachedDeviceInfo;
|
|
8
8
|
/**
|
|
9
|
-
* Get comprehensive device information
|
|
10
|
-
*
|
|
9
|
+
* Get comprehensive device information synchronously
|
|
10
|
+
* Uses synchronous methods from react-native-device-info
|
|
11
11
|
*/
|
|
12
|
-
static getDeviceInfo():
|
|
13
|
-
/**
|
|
14
|
-
* Get device information synchronously (returns cached data)
|
|
15
|
-
* Returns loading state if not yet initialized
|
|
16
|
-
* Call getDeviceInfo() first to populate cache
|
|
17
|
-
*/
|
|
18
|
-
static getDeviceInfoSync(): IDeviceInfo;
|
|
12
|
+
static getDeviceInfo(): IDeviceInfo;
|
|
19
13
|
/**
|
|
20
14
|
* Get platform name
|
|
21
15
|
*/
|
|
@@ -8,27 +8,29 @@ import DeviceInfo from 'react-native-device-info';
|
|
|
8
8
|
*/
|
|
9
9
|
export class BaseDeviceInfo {
|
|
10
10
|
/**
|
|
11
|
-
* Get comprehensive device information
|
|
12
|
-
*
|
|
11
|
+
* Get comprehensive device information synchronously
|
|
12
|
+
* Uses synchronous methods from react-native-device-info
|
|
13
13
|
*/
|
|
14
|
-
static
|
|
14
|
+
static getDeviceInfo() {
|
|
15
15
|
if (this.cachedDeviceInfo) {
|
|
16
16
|
return this.cachedDeviceInfo;
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
+
// Use synchronous methods from react-native-device-info
|
|
19
20
|
const deviceInfo = {
|
|
20
21
|
platform: Platform.OS,
|
|
21
|
-
model:
|
|
22
|
+
model: DeviceInfo.getModel(),
|
|
22
23
|
version: Platform.Version.toString(),
|
|
23
24
|
isMobile: Platform.OS === 'ios' || Platform.OS === 'android',
|
|
24
|
-
manufacturer:
|
|
25
|
-
uuid:
|
|
25
|
+
manufacturer: DeviceInfo.getManufacturerSync(),
|
|
26
|
+
uuid: DeviceInfo.getUniqueIdSync(),
|
|
26
27
|
};
|
|
27
28
|
this.cachedDeviceInfo = deviceInfo;
|
|
28
29
|
return deviceInfo;
|
|
29
30
|
}
|
|
30
31
|
catch (error) {
|
|
31
32
|
console.error('Error getting device info:', error);
|
|
33
|
+
// Return fallback with synchronous Platform data
|
|
32
34
|
const fallback = {
|
|
33
35
|
platform: Platform.OS,
|
|
34
36
|
model: 'Unknown',
|
|
@@ -39,23 +41,6 @@ export class BaseDeviceInfo {
|
|
|
39
41
|
return fallback;
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Get device information synchronously (returns cached data)
|
|
44
|
-
* Returns loading state if not yet initialized
|
|
45
|
-
* Call getDeviceInfo() first to populate cache
|
|
46
|
-
*/
|
|
47
|
-
static getDeviceInfoSync() {
|
|
48
|
-
if (this.cachedDeviceInfo) {
|
|
49
|
-
return this.cachedDeviceInfo;
|
|
50
|
-
}
|
|
51
|
-
// Return immediate fallback while async initialization happens
|
|
52
|
-
return {
|
|
53
|
-
platform: Platform.OS,
|
|
54
|
-
model: 'Loading...',
|
|
55
|
-
version: Platform.Version.toString(),
|
|
56
|
-
isMobile: Platform.OS === 'ios' || Platform.OS === 'android',
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
44
|
/**
|
|
60
45
|
* Get platform name
|
|
61
46
|
*/
|
package/package.json
CHANGED
|
@@ -85,7 +85,7 @@ export interface ILocalStorageAdapter {
|
|
|
85
85
|
*/
|
|
86
86
|
export interface PlatformInterface {
|
|
87
87
|
// Device Information
|
|
88
|
-
getDeviceInfo():
|
|
88
|
+
getDeviceInfo(): IDeviceInfo;
|
|
89
89
|
getPlatform(): string;
|
|
90
90
|
getFrontendType(): string;
|
|
91
91
|
getDocumentDirectory(): string;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { DeviceInfo } from '
|
|
2
|
-
import { DatabaseManager } from '../src/database';
|
|
3
|
-
import { LocalStorage } from '../src/local-storage';
|
|
4
|
-
import { logger, LogLevel } from '../src/logger';
|
|
5
|
-
import { PushNotification } from '../src/push-notification';
|
|
6
|
-
import { FileSystem } from '../src/file-system';
|
|
1
|
+
import { DeviceInfo, DatabaseManager, LocalStorage, logger, LogLevel, PushNotification, FileSystem } from '@unvired/react-native-unvired-sdk';
|
|
7
2
|
import { PlatformInterface, IDeviceInfo, IFileEntry, IDatabaseAdapter, IPushNotificationAdapter, ILoggerAdapter, IStorageAdapter } from './PlatformInterface';
|
|
8
3
|
|
|
9
4
|
export class ReactNativePlatformAdapter implements PlatformInterface {
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
return
|
|
6
|
+
getDeviceInfo(): IDeviceInfo {
|
|
7
|
+
return DeviceInfo.getDeviceInfo();
|
|
13
8
|
}
|
|
14
9
|
|
|
15
10
|
getPlatform(): string {
|
|
@@ -79,8 +74,7 @@ export class ReactNativePlatformAdapter implements PlatformInterface {
|
|
|
79
74
|
await pushNotification.requestPermission(options);
|
|
80
75
|
},
|
|
81
76
|
getToken: async () => {
|
|
82
|
-
|
|
83
|
-
return token || '';
|
|
77
|
+
return await pushNotification.getToken();
|
|
84
78
|
},
|
|
85
79
|
onTokenRefresh: (callback) => {
|
|
86
80
|
pushNotification.onTokenRefresh(callback);
|