apps-sdk 1.0.77 → 1.0.78

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.77",
3
+ "version": "1.0.78",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -103,7 +103,6 @@ class PayWallLogic {
103
103
  let subscribed = false;
104
104
  try {
105
105
  const subscriptionTemplates = await getSubscriptions({skus: [productID]});
106
- console.log('subscriptionTemplates', subscriptionTemplates);
107
106
  if (subscriptionTemplates.length > 0) {
108
107
  const subscription = subscriptionTemplates[0];
109
108
  const sku = subscription.productId;
@@ -136,17 +135,21 @@ class PayWallLogic {
136
135
  for(let i in purchases){
137
136
  if(purchases[i].productId ){
138
137
  restorePurchaseData = this.purchaseData(purchases[i], Platform.OS === 'android' ? purchases[i].purchaseToken : purchases[i].originalTransactionIdentifierIOS);
138
+ subscribed = true;
139
139
  break;
140
140
  }
141
141
  }
142
142
  }
143
- subscribed = true;
144
- Session.setIsSubscribed(true);
145
- Session.setSubscriptionID(restorePurchaseData.subs_id);
146
- if (hidePayWallCallback) {
147
- hidePayWallCallback();
143
+ if (subscribed) {
144
+ Session.setIsSubscribed(true);
145
+ Session.setSubscriptionID(restorePurchaseData.subs_id);
146
+ if (hidePayWallCallback) {
147
+ hidePayWallCallback();
148
+ }
149
+ config.DEBUG_MODE && console.log('Purchase restored successfully', restorePurchaseData);
150
+ } else {
151
+ config.DEBUG_MODE && console.log('No purchases to restore');
148
152
  }
149
- config.DEBUG_MODE && console.log('Purchase restored successfully', restorePurchaseData);
150
153
  } catch (error) {
151
154
  console.warn(error);
152
155
  }
@@ -173,18 +173,23 @@ class Storage {
173
173
  const directoryUri = `${CREATIONS_DIR}/${directory}`;
174
174
  const imageUri = `${directoryUri}/image.jpg`;
175
175
  const dataUri = `${directoryUri}/data.json`;
176
-
177
- const imageData = await FileSystem.readAsStringAsync(imageUri, { encoding: FileSystem.EncodingType.Base64 });
178
- const jsonData = await FileSystem.readAsStringAsync(dataUri, { encoding: FileSystem.EncodingType.UTF8 });
179
- config.DEBUG_MODE && console.debug('getCreations jsonData:', jsonData);
180
-
181
- let dataParsed = JSON.parse(jsonData)
182
- config.DEBUG_MODE && console.debug('getCreations dataParsed:', dataParsed);
183
- directoryData.push({
184
- url: imageUri,
185
- job_id: directory,
186
- data: dataParsed['_j'] || dataParsed
187
- });
176
+ try {
177
+ const imageData = await FileSystem.readAsStringAsync(imageUri, { encoding: FileSystem.EncodingType.Base64 });
178
+ const jsonData = await FileSystem.readAsStringAsync(dataUri, { encoding: FileSystem.EncodingType.UTF8 });
179
+ config.DEBUG_MODE && console.debug('getCreations jsonData:', jsonData);
180
+
181
+ let dataParsed = JSON.parse(jsonData)
182
+ config.DEBUG_MODE && console.debug('getCreations dataParsed:', dataParsed);
183
+ if (imageData && dataParsed) {
184
+ directoryData.push({
185
+ url: imageUri,
186
+ job_id: directory,
187
+ data: dataParsed['_j'] || dataParsed
188
+ });
189
+ }
190
+ } catch (error) {
191
+ console.log('Error al obtener los datos de la imagen', directory, error);
192
+ }
188
193
  }
189
194
 
190
195
  directoryData.sort((a, b) => {
@@ -195,7 +200,7 @@ class Storage {
195
200
 
196
201
  return directoryData;
197
202
  } catch (error) {
198
- console.error('Error al obtener los datos de las imágenes:', error);
203
+ console.log('Error al obtener los datos de las imágenes:', error);
199
204
  }
200
205
  }
201
206