apps-sdk 1.0.82 → 1.0.83
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/index.js +23 -0
- package/package.json +1 -1
- package/src/libraries/Storage.js +15 -0
- package/types/index.d.ts +1 -0
package/index.js
CHANGED
|
@@ -2,6 +2,28 @@ import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Ra
|
|
|
2
2
|
import PayWall from "./src/components/PayWall";
|
|
3
3
|
|
|
4
4
|
class AppsSDK {
|
|
5
|
+
sobrescribeConsole = () => {
|
|
6
|
+
try {
|
|
7
|
+
console.log('Overwriting console.log and console.debug...');
|
|
8
|
+
const originalConsoleLog = console.log;
|
|
9
|
+
const originalConsoleDebug = console.debug;
|
|
10
|
+
|
|
11
|
+
console.log = function() {
|
|
12
|
+
let date = new Date();
|
|
13
|
+
let timestamp = date.toLocaleDateString() + ' ' + date.toLocaleTimeString() + '.' + date.getMilliseconds();
|
|
14
|
+
originalConsoleLog.apply(console, ['[' + timestamp + ']'].concat(Array.from(arguments)));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
console.debug = function() {
|
|
18
|
+
let date = new Date();
|
|
19
|
+
let timestamp = date.toLocaleDateString() + ' ' + date.toLocaleTimeString() + '.' + date.getMilliseconds();
|
|
20
|
+
originalConsoleDebug.apply(console, ['[' + timestamp + ']'].concat(Array.from(arguments)));
|
|
21
|
+
};
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('Error al sobreescribir console.log:', error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
5
27
|
initializePushNotifications = async() => {
|
|
6
28
|
await NotificationsPush.initialize();
|
|
7
29
|
|
|
@@ -16,6 +38,7 @@ class AppsSDK {
|
|
|
16
38
|
}
|
|
17
39
|
|
|
18
40
|
const Core = new AppsSDK();
|
|
41
|
+
Core.sobrescribeConsole();
|
|
19
42
|
export default {
|
|
20
43
|
initializePushNotifications: Core.initializePushNotifications,
|
|
21
44
|
getPushNotificationsStatus: Core.getNotificationsStatus,
|
package/package.json
CHANGED
package/src/libraries/Storage.js
CHANGED
|
@@ -166,6 +166,21 @@ class Storage {
|
|
|
166
166
|
return false;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
async deleteTempFiles() {
|
|
170
|
+
try {
|
|
171
|
+
const dirInfo = await FileSystem.getInfoAsync(TMP_DIR);
|
|
172
|
+
if (dirInfo.exists) {
|
|
173
|
+
await FileSystem.deleteAsync(TMP_DIR, { idempotent: true });
|
|
174
|
+
await FileSystem.makeDirectoryAsync(TMP_DIR);
|
|
175
|
+
console.log('All temp files deleted and directory created again.');
|
|
176
|
+
} else {
|
|
177
|
+
console.log('No temp files to delete. Directory does not exist.');
|
|
178
|
+
}
|
|
179
|
+
} catch (error) {
|
|
180
|
+
console.error('Error deleting temp files', error);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
169
184
|
async getCreations() {
|
|
170
185
|
try {
|
|
171
186
|
const info = await FileSystem.getInfoAsync(CREATIONS_DIR);
|
package/types/index.d.ts
CHANGED