apps-sdk 1.0.20 → 1.0.22

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": "apps-sdk",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -85,7 +85,11 @@ class Networking {
85
85
 
86
86
  async request(url, data = {}, encrypt = this.DEFAULT_ENCRYPT_VALUE) {
87
87
  data = { ...Session.sessionData, ...data };
88
- config.DEBUG_MODE && console.debug("request data: ", url, data);
88
+ let dataConsoleLog = data;
89
+ if (dataConsoleLog && dataConsoleLog.img) {
90
+ dataConsoleLog.img = dataConsoleLog.img.substring(0, 50) + '...';
91
+ }
92
+ config.DEBUG_MODE && console.debug("request data: ", url, dataConsoleLog);
89
93
 
90
94
  let headers = { Accept: 'application/json', 'Content-Type': 'application/json' };
91
95
 
@@ -50,7 +50,7 @@ class Storage {
50
50
  const { status } = await MediaLibrary.requestPermissionsAsync();
51
51
  if (status === 'granted') {
52
52
  let fileUri = FileSystem.documentDirectory + fileName;
53
- if (utils.isBase64(url)) {
53
+ if (utils.isBase64Image(url)) {
54
54
  await FileSystem.writeAsStringAsync(fileUri, url, { encoding: FileSystem.EncodingType.Base64 });
55
55
  } else {
56
56
  const { uri: localUri } = await FileSystem.downloadAsync(url, fileUri);
@@ -7,6 +7,11 @@ class Utils {
7
7
  return false;
8
8
  }
9
9
  }
10
+
11
+ isBase64Image(str) {
12
+ if (str ==='' || str.trim() ===''){ return false; }
13
+ return str.startsWith('data:image/');
14
+ }
10
15
  }
11
16
 
12
17
  export default new Utils();
package/types/index.d.ts CHANGED
@@ -69,6 +69,7 @@ declare module 'apps-sdk' {
69
69
 
70
70
  export class Utils {
71
71
  isBase64(str: string): boolean;
72
+ isBase64Image(str: string): boolean;
72
73
  }
73
74
 
74
75
  export class NotificationsPush {