apps-sdk 1.0.76 → 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
|
@@ -48,7 +48,7 @@ class PayWall extends React.Component {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
async
|
|
51
|
+
async componentDidMount(prevProps) {
|
|
52
52
|
if (this.props.visible && !prevProps.visible) {
|
|
53
53
|
this.webviewRef.current.injectJavaScript(PayWallLogic.paywallJS);
|
|
54
54
|
Networking.sendEvent('scene', 'payment_card', { user_id: Session.getUserID(), card_id: this.getCardID(), scene: 'payment_card' });
|
|
@@ -126,7 +126,7 @@ class PayWall extends React.Component {
|
|
|
126
126
|
|
|
127
127
|
render() {
|
|
128
128
|
const { visible, onClose, type, keyword } = this.props;
|
|
129
|
-
if (PayWallLogic.paywallJS === '') {
|
|
129
|
+
if (PayWallLogic.paywallJS === '' || Object.keys(this.paywallData).length === 0) {
|
|
130
130
|
this.getPayWallData(type, keyword);
|
|
131
131
|
config.DEBUG_MODE && console.log('PayWallLogic.paywallJS:', PayWallLogic.paywallJS);
|
|
132
132
|
config.DEBUG_MODE && console.log('PayWallLogic.paywallJS type:', typeof PayWallLogic.paywallJS);
|
|
@@ -31,39 +31,39 @@ class NotificationsPush {
|
|
|
31
31
|
let token;
|
|
32
32
|
|
|
33
33
|
if (Platform.OS === 'android') {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
importance: Notifications.AndroidImportance.MAX,
|
|
37
|
-
vibrationPattern: [0, 250, 250, 250],
|
|
38
|
-
lightColor: '#FF231F7C',
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (Device.isDevice) {
|
|
43
|
-
if (Platform.OS === 'android') {
|
|
44
|
-
const channel = await Notifications.setNotificationChannelAsync('default', {
|
|
34
|
+
try {
|
|
35
|
+
await Notifications.setNotificationChannelAsync('default', {
|
|
45
36
|
name: 'default',
|
|
46
37
|
importance: Notifications.AndroidImportance.MAX,
|
|
47
38
|
vibrationPattern: [0, 250, 250, 250],
|
|
48
39
|
lightColor: '#FF231F7C',
|
|
49
40
|
});
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.log('Error en setNotificationChannelAsync', error);
|
|
50
43
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (Device.isDevice) {
|
|
47
|
+
try {
|
|
48
|
+
const {status: existingStatus} = await Notifications.getPermissionsAsync();
|
|
49
|
+
let finalStatus = existingStatus;
|
|
50
|
+
if (existingStatus !== 'granted') {
|
|
51
|
+
const {status} = await Notifications.requestPermissionsAsync();
|
|
52
|
+
finalStatus = status;
|
|
53
|
+
}
|
|
54
|
+
if (finalStatus === 'granted') {
|
|
55
|
+
token = (await Notifications.getExpoPushTokenAsync({"projectId": Constants.expoConfig.extra.eas.projectId})).data;
|
|
56
|
+
console.log('Notification token', token);
|
|
57
|
+
await Storage.storeData('PUSH_NOTIFICATIONS_ACCEPTED', true);
|
|
58
|
+
await Storage.storeData('PUSH_NOTIFICATIONS_TOKEN', token);
|
|
59
|
+
if (token) {
|
|
60
|
+
await Networking.setToken(token);
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
console.log('Notifications permissions not granted');
|
|
64
64
|
}
|
|
65
|
-
}
|
|
66
|
-
console.log('
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.log('Error en getExpoPushTokenAsync', error);
|
|
67
67
|
}
|
|
68
68
|
} else {
|
|
69
69
|
console.log('Must use physical device for Push Notifications');
|
|
@@ -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
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
}
|
package/src/libraries/Storage.js
CHANGED
|
@@ -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
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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.
|
|
203
|
+
console.log('Error al obtener los datos de las imágenes:', error);
|
|
199
204
|
}
|
|
200
205
|
}
|
|
201
206
|
|