Skip to content

Commit f16d67a

Browse files
authored
feat(adjust): update adjust sdk index.ts api to v5.4.0 (#4948)
1 parent 7edcb00 commit f16d67a

File tree

1 file changed

+146
-68
lines changed
  • src/@awesome-cordova-plugins/plugins/adjust

1 file changed

+146
-68
lines changed

src/@awesome-cordova-plugins/plugins/adjust/index.ts

Lines changed: 146 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
22
import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
33

44
export class AdjustConfig {
5+
// common
56
private appToken: string;
67
private environment: AdjustEnvironment;
78
private sdkPrefix: string;
@@ -17,6 +18,15 @@ export class AdjustConfig {
1718
private urlStrategyDomains: string[] = [];
1819
private useSubdomains: boolean = null;
1920
private isDataResidency: boolean = null;
21+
private isFirstSessionDelayEnabled: boolean = null;
22+
private storeInfo: AdjustStoreInfo = null;
23+
24+
private attributionCallback: (attribution: AdjustAttribution) => void = null;
25+
private eventTrackingSucceededCallback: (event: AdjustEventSuccess) => void = null;
26+
private eventTrackingFailedCallback: (event: AdjustEventFailure) => void = null;
27+
private sessionTrackingSucceededCallback: (session: AdjustSessionSuccess) => void = null;
28+
private sessionTrackingFailedCallback: (session: AdjustSessionFailure) => void = null;
29+
private deferredDeeplinkCallback: (deeplink: string) => void = null;
2030

2131
// android only
2232
private processName: string = null;
@@ -32,16 +42,10 @@ export class AdjustConfig {
3242
private isSkanAttributionEnabled: boolean = null;
3343
private isLinkMeEnabled: boolean = null;
3444
private attConsentWaitingInterval: number = null;
35-
36-
// callbacks
37-
private attributionCallback: (attribution: AdjustAttribution) => void = null;
38-
private eventTrackingSucceededCallback: (event: AdjustEventSuccess) => void = null;
39-
private eventTrackingFailedCallback: (event: AdjustEventFailure) => void = null;
40-
private sessionTrackingSucceededCallback: (session: AdjustSessionSuccess) => void = null;
41-
private sessionTrackingFailedCallback: (session: AdjustSessionFailure) => void = null;
42-
private deferredDeeplinkCallback: (deeplink: string) => void = null;
45+
private isAppTrackingTransparencyUsageEnabled: boolean = null;
4346
private skanUpdatedCallback: (skanData: AdjustSkanData) => void = null;
4447

48+
// common
4549
constructor(appToken: string, environment: AdjustEnvironment) {
4650
this.appToken = appToken;
4751
this.environment = environment;
@@ -60,7 +64,9 @@ export class AdjustConfig {
6064
}
6165

6266
setUrlStrategy(urlStrategyDomains: string[], useSubdomains: boolean, isDataResidency: boolean): void {
63-
this.urlStrategy = urlStrategy;
67+
this.urlStrategyDomains = urlStrategyDomains;
68+
this.useSubdomains = useSubdomains;
69+
this.isDataResidency = isDataResidency;
6470
}
6571

6672
enableSendingInBackground(): void {
@@ -87,44 +93,12 @@ export class AdjustConfig {
8793
this.isCostDataInAttributionEnabled = true;
8894
}
8995

90-
setProcessName(processName: string) {
91-
this.processName = processName;
92-
}
93-
94-
enablePreinstallTracking(): void {
95-
this.isPreinstallTrackingEnabled = true;
96-
}
97-
98-
setPreinstallFilePath(preinstallFilePath: string): void {
99-
this.preinstallFilePath = preinstallFilePath;
100-
}
101-
102-
setFbAppId(fbAppId: string): void {
103-
this.fbAppId = fbAppId;
104-
}
105-
106-
disableIdfaReading(): void {
107-
this.isIdfaReadingEnabled = false;
96+
enableFirstSessionDelay(): void {
97+
this.isFirstSessionDelayEnabled = true;
10898
}
10999

110-
disableIdfvReading(): void {
111-
this.isIdfvReadingEnabled = false;
112-
}
113-
114-
disableAdServices(): void {
115-
this.isAdServicesEnabled = false;
116-
}
117-
118-
enableLinkMe(): void {
119-
this.isLinkMeEnabled = true;
120-
}
121-
122-
disableSkanAttribution(): void {
123-
this.isSkanAttributionEnabled = false;
124-
}
125-
126-
setAttConsentWaitingInterval(attConsentWaitingInterval: number): void {
127-
this.attConsentWaitingInterval = attConsentWaitingInterval;
100+
setStoreInfo(storeInfo: AdjustStoreInfo): void {
101+
this.storeInfo = storeInfo;
128102
}
129103

130104
setAttributionCallback(attributionCallback: (attribution: AdjustAttribution) => void): void {
@@ -151,63 +125,109 @@ export class AdjustConfig {
151125
this.deferredDeeplinkCallback = deferredDeeplinkCallback;
152126
}
153127

154-
setSkanUpdatedCallback(skanUpdatedCallback: (skanData: AdjustSkanData) => void): void {
155-
this.skanUpdatedCallback = skanUpdatedCallback;
156-
}
157-
158-
private getAttributionCallback(): void {
128+
private getAttributionCallback(): ((attribution: AdjustAttribution) => void) | null {
159129
return this.attributionCallback;
160130
}
161131

162-
private getEventTrackingSucceededCallback(): void {
132+
private getEventTrackingSucceededCallback(): ((event: AdjustEventSuccess) => void) | null {
163133
return this.eventTrackingSucceededCallback;
164134
}
165135

166-
private getEventTrackingFailedCallback(): void {
136+
private getEventTrackingFailedCallback(): ((event: AdjustEventFailure) => void) | null {
167137
return this.eventTrackingFailedCallback;
168138
}
169139

170-
private getSessionTrackingSucceededCallback(): void {
140+
private getSessionTrackingSucceededCallback(): ((session: AdjustSessionSuccess) => void) | null {
171141
return this.sessionTrackingSucceededCallback;
172142
}
173143

174-
private getSessionTrackingFailedCallback(): void {
144+
private getSessionTrackingFailedCallback(): ((session: AdjustSessionFailure) => void) | null {
175145
return this.sessionTrackingFailedCallback;
176146
}
177147

178-
private getDeferredDeeplinkCallback(): void {
148+
private getDeferredDeeplinkCallback(): ((deeplink: string) => void) | null {
179149
return this.deferredDeeplinkCallback;
180150
}
181151

182-
private getSkanUpdatedCallback(): void {
183-
return this.skanUpdatedCallback;
184-
}
185-
186-
private hasAttributionCallback(): void {
152+
private hasAttributionCallback(): boolean {
187153
return this.attributionCallback !== null;
188154
}
189155

190-
private hasEventTrackingSucceededCallback(): void {
156+
private hasEventTrackingSucceededCallback(): boolean {
191157
return this.eventTrackingSucceededCallback !== null;
192158
}
193159

194-
private hasEventTrackingFailedCallback(): void {
160+
private hasEventTrackingFailedCallback(): boolean {
195161
return this.eventTrackingFailedCallback !== null;
196162
}
197163

198-
private hasSessionTrackingSucceededCallback(): void {
164+
private hasSessionTrackingSucceededCallback(): boolean {
199165
return this.sessionTrackingSucceededCallback !== null;
200166
}
201167

202-
private hasSessionTrackingFailedCallback(): void {
168+
private hasSessionTrackingFailedCallback(): boolean {
203169
return this.sessionTrackingFailedCallback !== null;
204170
}
205171

206-
private hasDeferredDeeplinkCallback(): void {
172+
private hasDeferredDeeplinkCallback(): boolean {
207173
return this.deferredDeeplinkCallback !== null;
208174
}
209175

210-
private hasSkanUpdatedCallback(): void {
176+
// android only
177+
setProcessName(processName: string): void {
178+
this.processName = processName;
179+
}
180+
181+
enablePreinstallTracking(): void {
182+
this.isPreinstallTrackingEnabled = true;
183+
}
184+
185+
setPreinstallFilePath(preinstallFilePath: string): void {
186+
this.preinstallFilePath = preinstallFilePath;
187+
}
188+
189+
setFbAppId(fbAppId: string): void {
190+
this.fbAppId = fbAppId;
191+
}
192+
193+
// ios only
194+
disableIdfaReading(): void {
195+
this.isIdfaReadingEnabled = false;
196+
}
197+
198+
disableIdfvReading(): void {
199+
this.isIdfvReadingEnabled = false;
200+
}
201+
202+
disableAdServices(): void {
203+
this.isAdServicesEnabled = false;
204+
}
205+
206+
enableLinkMe(): void {
207+
this.isLinkMeEnabled = true;
208+
}
209+
210+
disableSkanAttribution(): void {
211+
this.isSkanAttributionEnabled = false;
212+
}
213+
214+
setAttConsentWaitingInterval(attConsentWaitingInterval: number): void {
215+
this.attConsentWaitingInterval = attConsentWaitingInterval;
216+
}
217+
218+
disableAppTrackingTransparencyUsage(): void {
219+
this.isAppTrackingTransparencyUsageEnabled = false;
220+
}
221+
222+
setSkanUpdatedCallback(skanUpdatedCallback: (skanData: AdjustSkanData) => void): void {
223+
this.skanUpdatedCallback = skanUpdatedCallback;
224+
}
225+
226+
private getSkanUpdatedCallback(): ((skanData: AdjustSkanData) => void) | null {
227+
return this.skanUpdatedCallback;
228+
}
229+
230+
private hasSkanUpdatedCallback(): boolean {
211231
return this.skanUpdatedCallback !== null;
212232
}
213233
}
@@ -424,10 +444,28 @@ export class AdjustPlayStorePurchase {
424444

425445
export class AdjustDeeplink {
426446
private deeplink: string;
447+
private referrer: string;
427448

428449
constructor(deeplink: string) {
429450
this.deeplink = deeplink;
430451
}
452+
453+
setReferrer(referrer: string): void {
454+
this.referrer = referrer;
455+
}
456+
}
457+
458+
export class AdjustStoreInfo {
459+
private storeName: string;
460+
private storeAppId: string;
461+
462+
constructor(storeName: string) {
463+
this.storeName = storeName;
464+
}
465+
466+
setStoreAppId(storeAppId: string): void {
467+
this.storeAppId = storeAppId;
468+
}
431469
}
432470

433471
export interface AdjustAttribution {
@@ -443,6 +481,7 @@ export interface AdjustAttribution {
443481
costAmount: string;
444482
costCurrency: string;
445483
fbInstallReferrer: string; // android only
484+
jsonResponse: string;
446485
}
447486

448487
export interface AdjustSessionSuccess {
@@ -546,6 +585,7 @@ export enum AdjustLogLevel {
546585
* AdjustAppStorePurchase
547586
* AdjustPlayStorePurchase
548587
* AdjustDeeplink
588+
* AdjustStoreInfo
549589
* @enums
550590
* AdjustEnvironment
551591
* AdjustLogLevel
@@ -562,7 +602,7 @@ export class Adjust extends AwesomeCordovaNativePlugin {
562602
/**
563603
* This method initializes Adjust SDK
564604
*
565-
* @param {AdjustConig} adjustConfig Adjust config object used as starting options
605+
* @param {AdjustConfig} adjustConfig Adjust config object used as starting options
566606
*/
567607
@Cordova({ sync: true })
568608
initSdk(adjustConfig: AdjustConfig): void {}
@@ -863,4 +903,42 @@ export class Adjust extends AwesomeCordovaNativePlugin {
863903
verifyPlayStorePurchase(adjustPlayStorePurchase: AdjustPlayStorePurchase): Promise<AdjustPurchaseVerificationResult> {
864904
return;
865905
}
866-
}
906+
907+
/**
908+
* This method ends first session delay
909+
*/
910+
@Cordova({ sync: true })
911+
endFirstSessionDelay(): void {}
912+
913+
/**
914+
* This method enables COPPA compliance while in first session delay
915+
*/
916+
@Cordova({ sync: true })
917+
enableCoppaComplianceInDelay(): void {}
918+
919+
/**
920+
* This method disables COPPA compliance while in first session delay
921+
*/
922+
@Cordova({ sync: true })
923+
disableCoppaComplianceInDelay(): void {}
924+
925+
/**
926+
* This method enables Play Store Kids compliance while in first session delay
927+
*/
928+
@Cordova({ sync: true })
929+
enablePlayStoreKidsComplianceInDelay(): void {}
930+
931+
/**
932+
* This method disables Play Store Kids compliance while in first session delay
933+
*/
934+
@Cordova({ sync: true })
935+
disablePlayStoreKidsComplianceInDelay(): void {}
936+
937+
/**
938+
* This method allows you to set external device ID while in first session delay
939+
*
940+
* @param {string} externalDeviceId External device ID value
941+
*/
942+
@Cordova({ sync: true })
943+
setExternalDeviceIdInDelay(externalDeviceId: string): void {}
944+
}

0 commit comments

Comments
 (0)