apps-sdk 1.0.76 → 1.0.77

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.76",
3
+ "version": "1.0.77",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -48,7 +48,7 @@ class PayWall extends React.Component {
48
48
  }
49
49
  }
50
50
 
51
- async componentDidUpdate(prevProps) {
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
- await Notifications.setNotificationChannelAsync('default', {
35
- name: 'default',
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
- const { status: existingStatus } = await Notifications.getPermissionsAsync();
52
- let finalStatus = existingStatus;
53
- if (existingStatus !== 'granted') {
54
- const { status } = await Notifications.requestPermissionsAsync();
55
- finalStatus = status;
56
- }
57
- if (finalStatus === 'granted') {
58
- token = (await Notifications.getExpoPushTokenAsync({"projectId": Constants.expoConfig.extra.eas.projectId})).data;
59
- console.log('Notification token',token);
60
- await Storage.storeData('PUSH_NOTIFICATIONS_ACCEPTED', true);
61
- await Storage.storeData('PUSH_NOTIFICATIONS_TOKEN', token);
62
- if(token) {
63
- await Networking.setToken(token);
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
- } else {
66
- console.log('Notifications permissions not granted');
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');