apps-sdk 1.0.59 → 1.0.60

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.59",
3
+ "version": "1.0.60",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,6 +22,7 @@ class AdJust {
22
22
  }, 60000);
23
23
  });
24
24
  Adjust.create(adjustConfig)
25
+ this.updateAttributionInfo();
25
26
  }
26
27
 
27
28
  updateAttributionInfo() {
@@ -110,78 +111,46 @@ class AdJust {
110
111
  }
111
112
 
112
113
  async getAttribution() {
113
- try {
114
- const attribution = await new Promise((resolve, reject) => {
115
- Adjust.getAttribution((attribution) => {
116
- if (attribution) {
117
- resolve(attribution);
118
- } else {
119
- reject('Invalid Attribution');
120
- }
121
- });
122
- });
123
-
124
- Session.setAdjustAttribution(attribution);
125
- } catch (error) {
126
- console.error(error);
127
- }
114
+ Adjust.getAttribution((attribution) => {
115
+ if (attribution) {
116
+ Session.setAdjustAttribution(attribution);
117
+ }
118
+ });
128
119
  }
129
120
 
130
121
  async getAdid() {
131
- try {
132
- const adid = await new Promise((resolve, reject) => {
133
- Adjust.getAdid((adid) => {
134
- if (adid) {
135
- resolve(adid);
136
- } else {
137
- reject('Invalid Adid');
138
- }
139
- });
140
- });
122
+ Adjust.getAdid((adid) => {
123
+ if (adid) {
124
+ Session.setAdjustAttributionID(adid);
125
+ }
126
+ });
127
+ }
141
128
 
142
- Session.setAdjustAttributionID(adid);
143
- } catch (error) {
144
- console.error(error);
145
- }
129
+ async getIdfa() {
130
+ await Adjust.getIdfa((idfa) => {
131
+ if (typeof idfa === 'string' && idfa.length > 0 && idfa !== '00000000-0000-0000-0000-000000000000') {
132
+ Session.setAdjustIDFA(idfa);
133
+ }
134
+ });
146
135
  }
147
136
 
148
137
  async getGoogleAdId() {
149
138
  try {
150
- const googleAdId = await new Promise((resolve, reject) => {
151
- Adjust.getGoogleAdId((googleAdId) => {
152
- if (googleAdId) {
153
- resolve(googleAdId);
154
- } else {
155
- reject('Invalid Google AdId');
156
- }
157
- });
139
+ Adjust.getGoogleAdId((googleAdId) => {
140
+ if (typeof googleAdId === 'string' && googleAdId.length > 0) {
141
+ Session.setAdjustGoogleAdid(googleAdId);
142
+ }
158
143
  });
159
-
160
- Session.setAdjustGoogleAdid(googleAdId);
161
144
  } catch (error) {
162
- console.error(error);
145
+ console.log(error);
163
146
  }
164
147
  }
165
148
 
166
- async getIdfa() {
167
- try {
168
- const idfa = await new Promise((resolve, reject) => {
169
- Adjust.getIdfa((idfa) => {
170
- if (idfa && idfa !== '00000000-0000-0000-0000-000000000000') {
171
- resolve(idfa);
172
- } else {
173
- reject('Invalid IDFA');
174
- }
175
- });
176
- });
177
- Session.setAdjustIDFA(idfa);
178
- } catch (error) {
179
- console.error(error);
180
- }
181
- }
182
149
  getSDKVersion() {
183
150
  Adjust.getSdkVersion((sdkVersion) => {
184
- this.sdkVersion = sdkVersion;
151
+ if (typeof sdkVersion === 'string' && sdkVersion.length > 0) {
152
+ this.sdkVersion = sdkVersion;
153
+ }
185
154
  });
186
155
  }
187
156
  }
@@ -46,9 +46,9 @@ class Session {
46
46
  "domains": "0"
47
47
  },
48
48
  adjust : {
49
- attribution_id: await Storage.getData("adjustAttributionID") || '',
50
- idfa: await Storage.getData("adjustIDFA") || '',
51
- googleAdid: await Storage.getData("adjustGoogleAdid") || '',
49
+ attribution_id: '',
50
+ idfa: '',
51
+ googleAdid: '',
52
52
  },
53
53
  dev : false,
54
54
  lang : Localization.getLocales()[0].languageCode || 'en',
@@ -149,7 +149,7 @@ class Session {
149
149
  }
150
150
 
151
151
  getAdjustIDFA = () => {
152
- return this.sessionData.adjust.idfa || Storage.getData("adjustIDFA") || '';
152
+ return this.sessionData.adjust.idfa || '';
153
153
  }
154
154
 
155
155
  setAdjustGoogleAdid = (googleAdid) => {
@@ -158,7 +158,7 @@ class Session {
158
158
  }
159
159
 
160
160
  getAdjustGoogleAdid = () => {
161
- return this.sessionData.adjust.googleAdid || Storage.getData("adjustGoogleAdid") || '';
161
+ return this.sessionData.adjust.googleAdid;
162
162
  }
163
163
 
164
164
  setAdjustAttributionID = (attribution_id) => {
@@ -167,7 +167,7 @@ class Session {
167
167
  }
168
168
 
169
169
  getAdjustAttributionID = () => {
170
- return this.sessionData.adjust.attribution_id || Storage.getData("adjustAttributionID") || '';
170
+ return this.sessionData.adjust.attribution_id;
171
171
  }
172
172
 
173
173
  setAdjustAttribution = (attribution) => {