apps-sdk 1.0.64 → 1.0.66

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
@@ -9,11 +9,16 @@ class AppsSDK {
9
9
  return expoToken
10
10
  })
11
11
  }
12
+
13
+ getNotificationsStatus = async () => {
14
+ return await NotificationsPush.getPushNotificationsStatus();
15
+ }
12
16
  }
13
17
 
14
18
  const Core = new AppsSDK();
15
19
  export default {
16
20
  initializePushNotifications: Core.initializePushNotifications,
21
+ getPushNotificationsStatus: Core.getNotificationsStatus,
17
22
  networking: Networking,
18
23
  storage: Storage,
19
24
  session: Session,
@@ -23,4 +28,5 @@ export default {
23
28
  adjust: AdJust,
24
29
  tracking: TrackingTransparency,
25
30
  paywall: PayWall,
31
+ notifications: NotificationsPush,
26
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,6 +4,7 @@ import * as Notifications from 'expo-notifications';
4
4
  import * as Device from 'expo-device';
5
5
  import Constants from 'expo-constants';
6
6
  import { default as Networking } from './Networking';
7
+ import { default as Storage } from './Storage';
7
8
 
8
9
  class NotificationsPush {
9
10
  initialize = async () => {
@@ -56,6 +57,8 @@ class NotificationsPush {
56
57
  if (finalStatus === 'granted') {
57
58
  token = (await Notifications.getExpoPushTokenAsync({"projectId": Constants.expoConfig.extra.eas.projectId})).data;
58
59
  console.log('Notification token',token);
60
+ await Storage.storeData('PUSH_NOTIFICATIONS_ACCEPTED', true);
61
+ await Storage.storeData('PUSH_NOTIFICATIONS_TOKEN', token);
59
62
  if(token) {
60
63
  await Networking.setToken(token);
61
64
  }
@@ -68,6 +71,13 @@ class NotificationsPush {
68
71
 
69
72
  return token;
70
73
  }
74
+
75
+ async getPushNotificationsStatus() {
76
+ const { status: existingStatus } = await Notifications.getPermissionsAsync();
77
+ return existingStatus;
78
+ }
71
79
  }
72
80
 
81
+
82
+
73
83
  export default new NotificationsPush();
@@ -128,13 +128,13 @@ class PayWallLogic {
128
128
  subscriptionsData[product.productId] = product;
129
129
  });
130
130
  config.PAYWALL_DATA.products_metadata = subscriptionsData;
131
- console.log('products_metadata', config.PAYWALL_DATA.products_metadata);
131
+ config.DEBUG_MODE && console.debug('products_metadata', config.PAYWALL_DATA.products_metadata);
132
132
  }
133
133
  } catch (err) {
134
134
  console.log(err.code, err.message);
135
135
  return {};
136
136
  }
137
- console.log('subscription Metadata: ', subscriptionsData);
137
+ config.DEBUG_MODE && console.log('subscription Metadata: ', subscriptionsData);
138
138
  return subscriptionsData;
139
139
  }
140
140
 
@@ -167,7 +167,7 @@ class PayWallLogic {
167
167
  });
168
168
  }
169
169
  config.PAYWALL_DATA.paywall_info = payWallInfo;
170
- console.log('paywall_info', config.PAYWALL_DATA.paywall_info);
170
+ config.DEBUG_MODE && console.debug('paywall_info', config.PAYWALL_DATA.paywall_info);
171
171
  }
172
172
  return payWallInfo;
173
173
  }
@@ -1,7 +1,7 @@
1
1
  import * as StoreReview from 'expo-store-review';
2
2
  import Storage from './Storage';
3
3
 
4
- const REVIEW_INTERVAL = 1000 * 60 * 60 * 24 * 3; // 3 días
4
+ const REVIEW_INTERVAL = 1000 * 60 * 60 * 24 * 7; // 7 días
5
5
  class Rating {
6
6
  showRatingDialog = async (force = false) => {
7
7
  try {
@@ -166,7 +166,7 @@ class Storage {
166
166
  }
167
167
 
168
168
  const directories = await FileSystem.readDirectoryAsync(CREATIONS_DIR);
169
- console.log('getCreations directories:', directories);
169
+ config.DEBUG_MODE && console.debug('getCreations directories:', directories);
170
170
  const directoryData = [];
171
171
 
172
172
  for (const directory of directories) {
@@ -176,10 +176,10 @@ class Storage {
176
176
 
177
177
  const imageData = await FileSystem.readAsStringAsync(imageUri, { encoding: FileSystem.EncodingType.Base64 });
178
178
  const jsonData = await FileSystem.readAsStringAsync(dataUri, { encoding: FileSystem.EncodingType.UTF8 });
179
- console.log('getCreations jsonData:', jsonData);
179
+ config.DEBUG_MODE && console.debug('getCreations jsonData:', jsonData);
180
180
 
181
181
  let dataParsed = JSON.parse(jsonData)
182
- console.log('getCreations dataParsed:', dataParsed);
182
+ config.DEBUG_MODE && console.debug('getCreations dataParsed:', dataParsed);
183
183
  directoryData.push({
184
184
  url: imageUri,
185
185
  job_id: directory,
package/types/index.d.ts CHANGED
@@ -106,6 +106,7 @@ declare module 'apps-sdk' {
106
106
  export class NotificationsPush {
107
107
  initialize(): Promise<void>;
108
108
  registerForPushNotificationsAsync(): Promise<string>;
109
+ getPushNotificationsStatus(): Promise<string>;
109
110
  }
110
111
 
111
112
  export interface PayWallProps {
@@ -150,6 +151,7 @@ declare module 'apps-sdk' {
150
151
 
151
152
  export interface AppsSDK {
152
153
  initializePushNotifications(): Promise<string>;
154
+ getPushNotificationsStatus(): Promise<string>;
153
155
  networking : Networking;
154
156
  storage : Storage;
155
157
  session : Session;
@@ -159,6 +161,7 @@ declare module 'apps-sdk' {
159
161
  adjust : AdJust;
160
162
  tracking : TrackingTransparency;
161
163
  paywallLogic : PayWallLogic;
164
+ notificationsPush : NotificationsPush;
162
165
  }
163
166
 
164
167
  const Core: AppsSDK;