Skip to content

Commit

Permalink
feat(adjust): updating to match official typings (#3523)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangibbsnc authored Oct 16, 2020
1 parent 99e6a53 commit 5a77eab
Showing 1 changed file with 121 additions and 1 deletion.
122 changes: 121 additions & 1 deletion src/@ionic-native/plugins/adjust/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export class AdjustConfig {
private delayStart = 0.0;
private logLevel: AdjustLogLevel = null;
private defaultTracker: string = null;
private urlStrategy: string = null;
private externalDeviceId: string = null;
private sendInBackground: boolean = null;
private shouldLaunchDeeplink: boolean = null;
private eventBufferingEnabled: boolean = null;
Expand All @@ -56,6 +58,8 @@ export class AdjustConfig {
private info3: number = null;
private info4: number = null;
private processName: string = null; // Android only
private allowiAdInfoReading: boolean = null; // iOS only
private allowIdfaReading: boolean = null; // iOS only

private attributionCallback: (attribution: AdjustAttribution) => void = null;
private eventTrackingSucceededCallback: (event: AdjustEventSuccess) => void = null;
Expand Down Expand Up @@ -89,6 +93,10 @@ export class AdjustConfig {
this.defaultTracker = defaultTracker;
}

setExternalDeviceId(externalDeviceId: string) {
this.externalDeviceId = externalDeviceId;
}

setSendInBackground(sendInBackground: boolean) {
this.sendInBackground = sendInBackground;
}
Expand All @@ -113,6 +121,14 @@ export class AdjustConfig {
this.processName = processName;
}

setAllowiAdInfoReading(allowiAdInfoReading: boolean) {
this.allowiAdInfoReading = allowiAdInfoReading;
}

setAllowIdfaReading(allowIdfaReading: boolean) {
this.allowIdfaReading = allowIdfaReading;
}

setAttributionCallbackListener(attributionCallback: (attribution: AdjustAttribution) => void) {
this.attributionCallback = attributionCallback;
}
Expand Down Expand Up @@ -188,6 +204,77 @@ export class AdjustConfig {
}
}

export class AdjustAppStoreSubscription {
private price: string;
private currency: string;
private transactionId: string;
private receipt: string;
private transactionDate: string;
private salesRegion: string;
private callbackParameters: string[] = [];
private partnerParameters: string[] = [];

constructor(price: string, currency: string, transactionId: string, receipt: string) {
this.price = price;
this.currency = currency;
this.transactionId = transactionId;
this.receipt = receipt;
}

setTransactionDate(transactionDate: string): void {
this.transactionDate = transactionDate;
}

setSalesRegion(salesRegion: string): void {
this.salesRegion = salesRegion;
}

addCallbackParameter(key: string, value: string): void {
this.callbackParameters.push(key);
this.callbackParameters.push(value);
}

addPartnerParameter(key: string, value: string): void {
this.partnerParameters.push(key);
this.partnerParameters.push(value);
}
}

export class AdjustPlayStoreSubscription {
private price: string;
private currency: string;
private sku: string;
private orderId: string;
private signature: string;
private purchaseToken: string;
private purchaseTime: string;
private callbackParameters: string[] = [];
private partnerParameters: string[] = [];

constructor(price: string, currency: string, sku: string, orderId: string, signature: string, purchaseToken: string) {
this.price = price;
this.currency = currency;
this.sku = sku;
this.orderId = orderId;
this.signature = signature;
this.purchaseToken = purchaseToken;
}

setPurchaseTime(purchaseTime: string): void {
this.purchaseTime = purchaseTime;
}

addCallbackParameter(key: string, value: string): void {
this.callbackParameters.push(key);
this.callbackParameters.push(value);
}

addPartnerParameter(key: string, value: string): void {
this.partnerParameters.push(key);
this.partnerParameters.push(value);
}
}

export interface AdjustAttribution {
trackerToken: string;
trackerName: string;
Expand Down Expand Up @@ -257,7 +344,7 @@ export enum AdjustLogLevel {
*
* @usage
* ```typescript
* import { Adjust, AdjustConfig, AdjustEnvironment } from '@ionic-native/adjust/ngx';
* import { Adjust, AdjustConfig, AdjustEnvironment } from '@ionic-native/adjust';
*
* constructor(private adjust: Adjust) { }
*
Expand All @@ -278,6 +365,8 @@ export enum AdjustLogLevel {
* @classes
* AdjustEvent
* AdjustConfig
* AdjustAppStoreSubscription
* AdjustPlayStoreSubscription
* @enums
* AdjustEnvironment
* AdjustLogLevel
Expand Down Expand Up @@ -305,6 +394,20 @@ export class Adjust extends IonicNativePlugin {
@Cordova({ sync: true })
trackEvent(event: AdjustEvent): void {}

/**
* This method tracks App Store subscription
* @param {AdjustAppStoreSubscription} subscription Adjust App Store subscription object to be tracked
*/
@Cordova({ sync: true })
trackAppStoreSubscription(subscription: AdjustAppStoreSubscription): void {}

/**
* This method tracks Play Store subscription
* @param {AdjustPlayStoreSubscription} subscription Adjust Play Store subscription object to be tracked
*/
@Cordova({ sync: true })
trackPlayStoreSubscription(subscription: AdjustPlayStoreSubscription): void {}

/**
* This method sets offline mode on or off
* @param {boolean} enabled set to true for offline mode on
Expand Down Expand Up @@ -350,6 +453,13 @@ export class Adjust extends IonicNativePlugin {
@Cordova({ sync: true })
gdprForgetMe(): void {}

/**
* You can now notify Adjust when a user has exercised their right to stop sharing their data with partners for marketing purposes, but has allowed it to be shared for statistics purposes.
* Calling the following method will instruct the Adjust SDK to communicate the user's choice to disable data sharing to the Adjust backend
*/
@Cordova({ sync: true })
disableThirdPartySharing(): void {}

/**
* Function used to get Google AdId
* @return {Promise<string>} Returns a promise with google AdId value
Expand Down Expand Up @@ -452,4 +562,14 @@ export class Adjust extends IonicNativePlugin {
*/
@Cordova({ sync: true })
sendFirstPackages(): void {}

/**
* Request Adjust SDK to show pop up dialog for asking user's consent to be tracked.
* In order to do this, call this function
* @return {Promise<int>} Returns a promise with user's consent value
*/
@Cordova()
requestTrackingAuthorizationWithCompletionHandler(): Promise<number> {
return;
}
}

0 comments on commit 5a77eab

Please sign in to comment.