apps-sdk 1.0.81 → 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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.0.81",
3
+ "version": "1.0.83",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,8 +24,10 @@ class AdJust {
24
24
  });
25
25
  Adjust.create(adjustConfig)
26
26
  this.updateAttributionInfo();
27
+ Networking.sendEvent('other', 'adjust_init_ok');
27
28
  } catch (e) {
28
29
  console.log('Error en inicialización de AdJust', e);
30
+ Networking.sendEvent('other', 'adjust_init_error');
29
31
  }
30
32
  }
31
33
 
@@ -51,6 +51,15 @@ class Storage {
51
51
  }
52
52
  }
53
53
 
54
+
55
+ async removeAllKeys() {
56
+ try {
57
+ await AsyncStorage.clear();
58
+ } catch (error) {
59
+ console.error('Error removing all data from AsyncStorage:', error);
60
+ }
61
+ }
62
+
54
63
  async handleRequestGalleryPermission() {
55
64
  try {
56
65
  let galleryPermission = await this.getData('GALLERY_PERMISSION');
@@ -157,6 +166,21 @@ class Storage {
157
166
  return false;
158
167
  }
159
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
+
160
184
  async getCreations() {
161
185
  try {
162
186
  const info = await FileSystem.getInfoAsync(CREATIONS_DIR);
package/types/index.d.ts CHANGED
@@ -92,6 +92,8 @@ declare module 'apps-sdk' {
92
92
  handleDownloadImageToGallery(imageURI: string): Promise<string>;
93
93
  handleRequestGalleryPermission(): Promise<string>;
94
94
  setTrackingPermissionGranted(value: boolean): void;
95
+ removeAllKeys(): Promise<void>;
96
+ deleteTempFiles(): Promise<void>;
95
97
  }
96
98
 
97
99
  export class Utils {