apps-sdk 1.0.58 → 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 +1 -1
- package/src/libraries/AdJust.js +36 -15
- package/src/libraries/Session.js +7 -5
- package/types/index.d.ts +3 -1
package/package.json
CHANGED
package/src/libraries/AdJust.js
CHANGED
|
@@ -7,6 +7,7 @@ import Networking from './Networking';
|
|
|
7
7
|
|
|
8
8
|
class AdJust {
|
|
9
9
|
sdkVersion = null;
|
|
10
|
+
attribution = {};
|
|
10
11
|
initialize() {
|
|
11
12
|
const adjustEnvironment = config.ADJUST.ENVIRONMENT === 'SANDBOX' ? AdjustConfig.EnvironmentSandbox : AdjustConfig.EnvironmentProduction;
|
|
12
13
|
const adjustLogLevel = config.ADJUST.LOG_LEVEL === 'VERBOSE' ? AdjustConfig.LogLevelVerbose : AdjustConfig.LogLevelSuppress;
|
|
@@ -15,16 +16,23 @@ class AdJust {
|
|
|
15
16
|
adjustConfig.setLogLevel(adjustLogLevel);
|
|
16
17
|
const self = this;
|
|
17
18
|
adjustConfig.setAttributionCallbackListener(function(attribution) {
|
|
19
|
+
self.attribution = attribution;
|
|
18
20
|
setTimeout(() => {
|
|
19
21
|
self.sendAttributionData(attribution);
|
|
20
22
|
}, 60000);
|
|
21
23
|
});
|
|
22
|
-
Adjust.create(adjustConfig)
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
Adjust.create(adjustConfig)
|
|
25
|
+
this.updateAttributionInfo();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
updateAttributionInfo() {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
this.getAttribution();
|
|
31
|
+
this.getAdid();
|
|
32
|
+
this.getIdfa();
|
|
33
|
+
this.getGoogleAdId();
|
|
34
|
+
this.getSDKVersion();
|
|
35
|
+
}, 10000);
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
async getAttributionData() {
|
|
@@ -43,7 +51,7 @@ class AdJust {
|
|
|
43
51
|
const data = {
|
|
44
52
|
user_id: Session.getUserID(),
|
|
45
53
|
adjust: {
|
|
46
|
-
attribution_id: Session.getAdjustAttributionID(),
|
|
54
|
+
attribution_id: Session.getAdjustAttributionID() || attribution.adid,
|
|
47
55
|
googleAdid: Session.getAdjustGoogleAdid(),
|
|
48
56
|
idfa: Session.getAdjustIDFA(),
|
|
49
57
|
sdkVersion: this.sdkVersion,
|
|
@@ -104,32 +112,45 @@ class AdJust {
|
|
|
104
112
|
|
|
105
113
|
async getAttribution() {
|
|
106
114
|
Adjust.getAttribution((attribution) => {
|
|
107
|
-
|
|
115
|
+
if (attribution) {
|
|
116
|
+
Session.setAdjustAttribution(attribution);
|
|
117
|
+
}
|
|
108
118
|
});
|
|
109
119
|
}
|
|
110
120
|
|
|
111
|
-
|
|
112
121
|
async getAdid() {
|
|
113
122
|
Adjust.getAdid((adid) => {
|
|
114
|
-
|
|
123
|
+
if (adid) {
|
|
124
|
+
Session.setAdjustAttributionID(adid);
|
|
125
|
+
}
|
|
115
126
|
});
|
|
116
127
|
}
|
|
117
128
|
|
|
118
129
|
async getIdfa() {
|
|
119
130
|
await Adjust.getIdfa((idfa) => {
|
|
120
|
-
|
|
131
|
+
if (typeof idfa === 'string' && idfa.length > 0 && idfa !== '00000000-0000-0000-0000-000000000000') {
|
|
132
|
+
Session.setAdjustIDFA(idfa);
|
|
133
|
+
}
|
|
121
134
|
});
|
|
122
135
|
}
|
|
123
136
|
|
|
124
137
|
async getGoogleAdId() {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
138
|
+
try {
|
|
139
|
+
Adjust.getGoogleAdId((googleAdId) => {
|
|
140
|
+
if (typeof googleAdId === 'string' && googleAdId.length > 0) {
|
|
141
|
+
Session.setAdjustGoogleAdid(googleAdId);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
} catch (error) {
|
|
145
|
+
console.log(error);
|
|
146
|
+
}
|
|
128
147
|
}
|
|
129
148
|
|
|
130
149
|
getSDKVersion() {
|
|
131
150
|
Adjust.getSdkVersion((sdkVersion) => {
|
|
132
|
-
|
|
151
|
+
if (typeof sdkVersion === 'string' && sdkVersion.length > 0) {
|
|
152
|
+
this.sdkVersion = sdkVersion;
|
|
153
|
+
}
|
|
133
154
|
});
|
|
134
155
|
}
|
|
135
156
|
}
|
package/src/libraries/Session.js
CHANGED
|
@@ -47,7 +47,7 @@ class Session {
|
|
|
47
47
|
},
|
|
48
48
|
adjust : {
|
|
49
49
|
attribution_id: '',
|
|
50
|
-
idfa:
|
|
50
|
+
idfa: '',
|
|
51
51
|
googleAdid: '',
|
|
52
52
|
},
|
|
53
53
|
dev : false,
|
|
@@ -145,14 +145,16 @@ class Session {
|
|
|
145
145
|
|
|
146
146
|
setAdjustIDFA = (idfa) => {
|
|
147
147
|
this.sessionData.adjust.idfa = idfa;
|
|
148
|
+
Storage.storeData("adjustIDFA", idfa);
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
getAdjustIDFA = () => {
|
|
151
|
-
return this.sessionData.adjust.idfa;
|
|
152
|
+
return this.sessionData.adjust.idfa || '';
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
setAdjustGoogleAdid = (googleAdid) => {
|
|
155
156
|
this.sessionData.adjust.googleAdid = googleAdid;
|
|
157
|
+
Storage.storeData("adjustGoogleAdid", googleAdid);
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
getAdjustGoogleAdid = () => {
|
|
@@ -161,6 +163,7 @@ class Session {
|
|
|
161
163
|
|
|
162
164
|
setAdjustAttributionID = (attribution_id) => {
|
|
163
165
|
this.sessionData.adjust.attribution_id = attribution_id;
|
|
166
|
+
Storage.storeData("adjustAttributionID", attribution_id);
|
|
164
167
|
}
|
|
165
168
|
|
|
166
169
|
getAdjustAttributionID = () => {
|
|
@@ -171,11 +174,10 @@ class Session {
|
|
|
171
174
|
console.log('setAdjustAttribution', attribution);
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
|
|
175
177
|
sendFirstOpen = async () => {
|
|
176
178
|
config.DEBUG_MODE && console.debug("sendFirstOpen");
|
|
177
179
|
try {
|
|
178
|
-
let result = Networking.sendEvent(config.EVENT_TYPES.OTHER, 'first_open');
|
|
180
|
+
let result = await Networking.sendEvent(config.EVENT_TYPES.OTHER, 'first_open');
|
|
179
181
|
config.DEBUG_MODE && console.debug("sendFirstOpen - result: ", result);
|
|
180
182
|
} catch (error) {
|
|
181
183
|
console.error(error);
|
|
@@ -186,7 +188,7 @@ class Session {
|
|
|
186
188
|
checkSubscription = async () => {
|
|
187
189
|
config.DEBUG_MODE && console.debug("checkSubscription");
|
|
188
190
|
try {
|
|
189
|
-
let result = Networking.checkSubscription();
|
|
191
|
+
let result = await Networking.checkSubscription();
|
|
190
192
|
config.DEBUG_MODE && console.debug("checkSubscription - result: ", result);
|
|
191
193
|
} catch (error) {
|
|
192
194
|
console.error(error);
|
package/types/index.d.ts
CHANGED
|
@@ -124,7 +124,9 @@ declare module 'apps-sdk' {
|
|
|
124
124
|
|
|
125
125
|
export class AdJust {
|
|
126
126
|
sdkVersion: string | null;
|
|
127
|
-
|
|
127
|
+
attribution: object;
|
|
128
|
+
initialize(): void;
|
|
129
|
+
updateAttributionInfo(): void;
|
|
128
130
|
getAttributionData(): Promise<any>;
|
|
129
131
|
sendAttributionData(attribution: any): Promise<void>;
|
|
130
132
|
trackEventIfExist(eventKeyword: string, eventValue?: number): void;
|