@unvired/react-native-unvired-sdk 0.0.13 → 0.0.14
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 +1 -1
- package/dist/database/DatabaseManager.d.ts +3 -23
- package/dist/database/DatabaseManager.js +9 -314
- package/dist/database/services/DatabaseNative.d.ts +8 -0
- package/dist/database/services/DatabaseNative.js +149 -0
- package/dist/database/services/DatabaseWeb.d.ts +13 -0
- package/dist/database/services/DatabaseWeb.js +138 -0
- package/dist/file-system/BaseFileSystem.d.ts +6 -5
- package/dist/file-system/BaseFileSystem.js +20 -50
- package/dist/file-system/services/FileSystemNative.d.ts +17 -0
- package/dist/file-system/services/FileSystemNative.js +73 -0
- package/dist/file-system/services/FileSystemWeb.d.ts +16 -0
- package/dist/file-system/services/FileSystemWeb.js +41 -0
- package/dist/local-storage/localStorage.d.ts +3 -2
- package/dist/local-storage/localStorage.js +16 -11
- package/dist/local-storage/services/StorageNative.d.ts +10 -0
- package/dist/local-storage/services/StorageNative.js +27 -0
- package/dist/local-storage/services/StorageWeb.d.ts +10 -0
- package/dist/local-storage/services/StorageWeb.js +26 -0
- package/dist/main.d.ts +0 -2
- package/dist/main.js +0 -4
- package/package.json +4 -2
- package/dist/PlatformAdapter.d.ts +0 -57
- package/dist/PlatformAdapter.js +0 -116
package/dist/PlatformAdapter.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { logger } from './logger';
|
|
2
|
-
import { DatabaseManager } from './database';
|
|
3
|
-
import { LocalStorage } from './local-storage';
|
|
4
|
-
import { DeviceInfo } from './device-info';
|
|
5
|
-
import { FileSystem } from './file-system';
|
|
6
|
-
import { PushNotification } from './push-notification';
|
|
7
|
-
export var DatabaseType;
|
|
8
|
-
(function (DatabaseType) {
|
|
9
|
-
DatabaseType["SQLITE"] = "sqlite";
|
|
10
|
-
DatabaseType["WEBSQL"] = "websql";
|
|
11
|
-
})(DatabaseType || (DatabaseType = {}));
|
|
12
|
-
export class ReactNativePlatformAdapter {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.deviceInfo = null;
|
|
15
|
-
this.pushNotification = null;
|
|
16
|
-
this.initializeDeviceInfo();
|
|
17
|
-
}
|
|
18
|
-
async initializeDeviceInfo() {
|
|
19
|
-
try {
|
|
20
|
-
this.deviceInfo = await DeviceInfo.getDeviceInfo();
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
console.error('Error initializing device info:', error);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
getDeviceInfo() {
|
|
27
|
-
return this.deviceInfo || DeviceInfo.getDeviceInfoSync();
|
|
28
|
-
}
|
|
29
|
-
getPlatform() {
|
|
30
|
-
return DeviceInfo.getPlatform();
|
|
31
|
-
}
|
|
32
|
-
getFrontendType() {
|
|
33
|
-
return DeviceInfo.getFrontendType();
|
|
34
|
-
}
|
|
35
|
-
getDocumentDirectory() {
|
|
36
|
-
return FileSystem.getDocumentDirectory();
|
|
37
|
-
}
|
|
38
|
-
async resolveLocalFileSystemURL(url) {
|
|
39
|
-
return FileSystem.resolveLocalFileSystemURL(url);
|
|
40
|
-
}
|
|
41
|
-
async getFolderBasedOnUserId(userId) {
|
|
42
|
-
return FileSystem.getFolderBasedOnUserId(userId);
|
|
43
|
-
}
|
|
44
|
-
async deleteUserFolder(userId) {
|
|
45
|
-
return FileSystem.deleteUserFolder(userId);
|
|
46
|
-
}
|
|
47
|
-
getDatabaseAdapter() {
|
|
48
|
-
return DatabaseManager.getDatabaseAdapter();
|
|
49
|
-
}
|
|
50
|
-
getPushNotificationAdapter() {
|
|
51
|
-
try {
|
|
52
|
-
if (!this.pushNotification) {
|
|
53
|
-
this.pushNotification = new PushNotification();
|
|
54
|
-
}
|
|
55
|
-
return this.pushNotification;
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
console.error('Error initializing push notification adapter:', error);
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
getLoggerAdapter() {
|
|
63
|
-
return {
|
|
64
|
-
logDebug: (sourceClass, method, message) => {
|
|
65
|
-
logger.logDebug(sourceClass, method, message);
|
|
66
|
-
},
|
|
67
|
-
logError: (sourceClass, method, message) => {
|
|
68
|
-
logger.logError(sourceClass, method, message);
|
|
69
|
-
},
|
|
70
|
-
logInfo: (sourceClass, method, message) => {
|
|
71
|
-
logger.logInfo(sourceClass, method, message);
|
|
72
|
-
},
|
|
73
|
-
setLogLevel: (logLevel) => {
|
|
74
|
-
logger.setLogLevel(logLevel);
|
|
75
|
-
},
|
|
76
|
-
getLogFileURL: async () => {
|
|
77
|
-
return logger.getLogFileURL();
|
|
78
|
-
},
|
|
79
|
-
getLogFileContent: async () => {
|
|
80
|
-
return logger.getLogFileContent() || '';
|
|
81
|
-
},
|
|
82
|
-
getBackupLogFileContent: async () => {
|
|
83
|
-
return logger.getBackupLogFileContent();
|
|
84
|
-
},
|
|
85
|
-
clearLogFile: async () => {
|
|
86
|
-
await logger.clearLogFile();
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
getStorageAdapter() {
|
|
91
|
-
return {
|
|
92
|
-
getItem: async (key) => {
|
|
93
|
-
return LocalStorage.getItem(key);
|
|
94
|
-
},
|
|
95
|
-
setItem: async (key, value) => {
|
|
96
|
-
return LocalStorage.setItem(key, value);
|
|
97
|
-
},
|
|
98
|
-
removeItem: async (key) => {
|
|
99
|
-
return LocalStorage.removeItem(key);
|
|
100
|
-
},
|
|
101
|
-
clear: async () => {
|
|
102
|
-
return LocalStorage.clear();
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
let platformInstance = null;
|
|
108
|
-
export function getPlatformAdapter() {
|
|
109
|
-
if (!platformInstance) {
|
|
110
|
-
platformInstance = new ReactNativePlatformAdapter();
|
|
111
|
-
}
|
|
112
|
-
return platformInstance;
|
|
113
|
-
}
|
|
114
|
-
export function resetPlatformAdapter() {
|
|
115
|
-
platformInstance = null;
|
|
116
|
-
}
|