feat(adjust): updating to match official typings (#3523)

This commit is contained in:
Ryan Gibbs 2020-10-16 19:21:38 +02:00 committed by GitHub
parent 99e6a5398f
commit 5a77eabf76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
@ -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;
@ -89,6 +93,10 @@ export class AdjustConfig {
this.defaultTracker = defaultTracker;
}
setExternalDeviceId(externalDeviceId: string) {
this.externalDeviceId = externalDeviceId;
}
setSendInBackground(sendInBackground: boolean) {
this.sendInBackground = sendInBackground;
}
@ -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;
}
@ -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;
@ -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) { }
*
@ -278,6 +365,8 @@ export enum AdjustLogLevel {
* @classes
* AdjustEvent
* AdjustConfig
* AdjustAppStoreSubscription
* AdjustPlayStoreSubscription
* @enums
* AdjustEnvironment
* AdjustLogLevel
@ -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
@ -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
@ -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;
}
}