From 1462bcfb10a48facb23ac0e2ce7715fc04a42980 Mon Sep 17 00:00:00 2001 From: "DESKTOP\\paul" Date: Mon, 3 Sep 2018 10:29:44 +0200 Subject: [PATCH 1/5] feat(appsflyer): Added Appsflyer Cordova SDK --- src/@ionic-native/plugins/appsflyer/index.ts | 170 +++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 src/@ionic-native/plugins/appsflyer/index.ts diff --git a/src/@ionic-native/plugins/appsflyer/index.ts b/src/@ionic-native/plugins/appsflyer/index.ts new file mode 100644 index 0000000000..83f5e9d11d --- /dev/null +++ b/src/@ionic-native/plugins/appsflyer/index.ts @@ -0,0 +1,170 @@ +import { Injectable } from '@angular/core'; +import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; + +export interface AppsflyerOptions { + /** + * Appsflyer Dev key + */ + devKey: string; + + /** + * Apple Application ID(for iOS only) + */ + appId?: string; + + /** + * debug mode + */ + isDebug?: boolean; + + /** + * optout of collection of IMEI + */ + collectIMEI?: boolean; + + /** + * optout of collection of collectAndroidID + */ + collectAndroidID?: boolean; + + /** + * default false Accessing AppsFlyer Attribution / Conversion Data from the SDK (Deferred Deeplinking). Read more: Android, iOS. AppsFlyer plugin will return attribution data in onSuccess callback. + */ + onInstallConversionDataListener?: boolean; +} + +export interface AppsflyerEvent { + [x: string]: any; +} + +export interface AppsflyerInviteOptions { + channel?: string; + campaign?: string; + userParams?: { + [x: string]: any; + } +} + +/** + * @name Appsflyer + * @description + * This plugin does something + * + * @usage + * ```typescript + * import { Appsflyer } from '@ionic-native/appsflyer'; + * + * + * constructor(private appsflyer: Appsflyer) { } + * + * ... + * + * + * this.appsflyer.initSdk(options); + * + * ``` + */ +@Plugin({ + pluginName: 'Appsflyer', + plugin: 'cordova-plugin-appsflyer-sdk', + pluginRef: 'window.plugins.appsFlyer', + repo: 'https://github.com/AppsFlyerSDK/cordova-plugin-appsflyer-sdk', + platforms: ['iOS', 'Android'], + install: 'Add to config.xml like stated on github and then start' +}) +@Injectable() +export class Appsflyer extends IonicNativePlugin { + + /** + * initialize the SDK + */ + //@Cordova({ otherPromise: true }) + @Cordova() + initSdk(options: AppsflyerOptions): Promise { return; } + + /** + * These in-app events help you track how loyal users discover your app, and attribute them to specific campaigns/media-sources. Please take the time define the event/s you want to measure to allow you to track ROI (Return on Investment) and LTV (Lifetime Value). + * @param eventName custom event name, is presented in your dashboard + * @param eventValues event details + */ + @Cordova({ sync: true }) + trackEvent(eventName: string, eventValues: AppsflyerEvent): void { } + + /** + * Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs. + * @param customerUserId user id + */ + @Cordova({ sync: true }) + setAppUserId(customerUserId: string): void { } + + /** + * Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs. + * @param customerUserId In some extreme cases you might want to shut down all SDK tracking due to legal and privacy compliance. This can be achieved with the isStopTracking API. Once this API is invoked, our SDK will no longer communicate with our servers and stop functioning. + */ + @Cordova({ sync: true }) + stopTracking(isStopTracking: boolean): void { } + + /** + * Get the data from Attribution + */ + @Cordova({ otherPromise: true }) + registerOnAppOpenAttribution(): Promise { return; } + + /** + * Enables app uninstall tracking + * @param token GCM/FCM ProjectNumber + */ + @Cordova({ otherPromise: true }) + enableUninstallTracking(token: string): Promise { return; } + + /** + * Allows to pass GCM/FCM Tokens that where collected by third party plugins to the AppsFlyer server. Can be used for Uninstall Tracking. + * @param token GCM/FCM ProjectNumber + */ + @Cordova({ sync: true }) + updateServerUninstallToken(token: string): void { } + + /** + * Get AppsFlyer’s proprietary Device ID. The AppsFlyer Device ID is the main ID used by AppsFlyer in Reports and APIs. + */ + @Cordova({ otherPromise: true }) + getAppsFlyerUID(): Promise { return; } + + /** + * End User Opt-Out (Optional) AppsFlyer provides you a method to opt‐out specific users from AppsFlyer analytics. This method complies with the latest privacy requirements and complies with Facebook data and privacy policies. Default is FALSE, meaning tracking is enabled by default. + * @param disable Set to true to opt-out user from tracking + */ + @Cordova({ sync: true }) + deviceTrackingDisabled(disable: boolean): void { } + + /** + * Set AppsFlyer’s OneLink ID. Setting a valid OneLink ID will result in shortened User Invite links, when one is generated. The OneLink ID can be obtained on the AppsFlyer Dashboard. + * @param oneLinkId OneLink ID + */ + @Cordova({ sync: true }) + setAppInviteOneLinkID(oneLinkId: string): void { } + + /** + * Allowing your existing users to invite their friends and contacts as new users to your app can be a key growth factor for your app. AppsFlyer allows you to track and attribute new installs originating from user invites within your app. + * @param options Parameters for Invite link + */ + @Cordova({ otherPromise: true }) + generateInviteLink(options: AppsflyerInviteOptions): Promise { return; } + + /** + * Use this call to track an impression use the following API call. Make sure to use the promoted App ID as it appears within the AppsFlyer dashboard. + * @param appId Promoted Application ID + * @param campaign Promoted Campaign + */ + @Cordova({ sync: true }) + trackCrossPromotionImpression(appId: string, campaign: string): void { } + + /** + * Use this call to track the click and launch the app store's app page (via Browser) + * @param appId Promoted Application ID + * @param campaign Promoted Campaign + * @param options Additional Parameters to track + */ + @Cordova({ sync: true }) + trackAndOpenStore(appId: string, campaign: string, options: Object): void { } +} From 015da7c8accf24a117eccf7904c7f067f6bad5bb Mon Sep 17 00:00:00 2001 From: "DESKTOP\\paul" Date: Mon, 3 Sep 2018 10:37:02 +0200 Subject: [PATCH 2/5] fix(appsflyer): Corrected promises --- src/@ionic-native/plugins/appsflyer/index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/@ionic-native/plugins/appsflyer/index.ts b/src/@ionic-native/plugins/appsflyer/index.ts index 83f5e9d11d..8a1482159b 100644 --- a/src/@ionic-native/plugins/appsflyer/index.ts +++ b/src/@ionic-native/plugins/appsflyer/index.ts @@ -78,7 +78,6 @@ export class Appsflyer extends IonicNativePlugin { /** * initialize the SDK */ - //@Cordova({ otherPromise: true }) @Cordova() initSdk(options: AppsflyerOptions): Promise { return; } @@ -107,14 +106,14 @@ export class Appsflyer extends IonicNativePlugin { /** * Get the data from Attribution */ - @Cordova({ otherPromise: true }) + @Cordova() registerOnAppOpenAttribution(): Promise { return; } /** * Enables app uninstall tracking * @param token GCM/FCM ProjectNumber */ - @Cordova({ otherPromise: true }) + @Cordova() enableUninstallTracking(token: string): Promise { return; } /** @@ -127,7 +126,7 @@ export class Appsflyer extends IonicNativePlugin { /** * Get AppsFlyer’s proprietary Device ID. The AppsFlyer Device ID is the main ID used by AppsFlyer in Reports and APIs. */ - @Cordova({ otherPromise: true }) + @Cordova() getAppsFlyerUID(): Promise { return; } /** @@ -148,7 +147,7 @@ export class Appsflyer extends IonicNativePlugin { * Allowing your existing users to invite their friends and contacts as new users to your app can be a key growth factor for your app. AppsFlyer allows you to track and attribute new installs originating from user invites within your app. * @param options Parameters for Invite link */ - @Cordova({ otherPromise: true }) + @Cordova() generateInviteLink(options: AppsflyerInviteOptions): Promise { return; } /** From a8a5103be95ed0b2d163ca663ee501c294403f5c Mon Sep 17 00:00:00 2001 From: "DESKTOP\\paul" Date: Mon, 3 Sep 2018 10:38:50 +0200 Subject: [PATCH 3/5] fix(appsflyer): Add description --- src/@ionic-native/plugins/appsflyer/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/appsflyer/index.ts b/src/@ionic-native/plugins/appsflyer/index.ts index 8a1482159b..748a88d9f8 100644 --- a/src/@ionic-native/plugins/appsflyer/index.ts +++ b/src/@ionic-native/plugins/appsflyer/index.ts @@ -48,7 +48,7 @@ export interface AppsflyerInviteOptions { /** * @name Appsflyer * @description - * This plugin does something + * Appsflyer Cordova SDK support for Attribution * * @usage * ```typescript From e6f20308cee858556fbf94bcf76153f9a8b46232 Mon Sep 17 00:00:00 2001 From: "DESKTOP\\paul" Date: Mon, 3 Sep 2018 11:06:18 +0200 Subject: [PATCH 4/5] fix(appsflyer): Missing semicolon --- src/@ionic-native/plugins/appsflyer/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/appsflyer/index.ts b/src/@ionic-native/plugins/appsflyer/index.ts index 748a88d9f8..90e3ea5db0 100644 --- a/src/@ionic-native/plugins/appsflyer/index.ts +++ b/src/@ionic-native/plugins/appsflyer/index.ts @@ -42,7 +42,7 @@ export interface AppsflyerInviteOptions { campaign?: string; userParams?: { [x: string]: any; - } + }; } /** From 7d17cf512deec933ff2d1a011573e84554710c23 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Sat, 15 Sep 2018 10:46:29 +0200 Subject: [PATCH 5/5] Update index.ts --- src/@ionic-native/plugins/appsflyer/index.ts | 121 +++++++++++-------- 1 file changed, 70 insertions(+), 51 deletions(-) diff --git a/src/@ionic-native/plugins/appsflyer/index.ts b/src/@ionic-native/plugins/appsflyer/index.ts index 90e3ea5db0..479393d820 100644 --- a/src/@ionic-native/plugins/appsflyer/index.ts +++ b/src/@ionic-native/plugins/appsflyer/index.ts @@ -1,35 +1,35 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; export interface AppsflyerOptions { - /** - * Appsflyer Dev key + /** + * Appsflyer Dev key */ devKey: string; - /** - * Apple Application ID(for iOS only) - */ + /** + * Apple Application ID(for iOS only) + */ appId?: string; - /** - * debug mode - */ + /** + * debug mode + */ isDebug?: boolean; - /** - * optout of collection of IMEI - */ + /** + * optout of collection of IMEI + */ collectIMEI?: boolean; - /** + /** * optout of collection of collectAndroidID - */ + */ collectAndroidID?: boolean; - /** - * default false Accessing AppsFlyer Attribution / Conversion Data from the SDK (Deferred Deeplinking). Read more: Android, iOS. AppsFlyer plugin will return attribution data in onSuccess callback. - */ + /** + * default false Accessing AppsFlyer Attribution / Conversion Data from the SDK (Deferred Deeplinking). Read more: Android, iOS. AppsFlyer plugin will return attribution data in onSuccess callback. + */ onInstallConversionDataListener?: boolean; } @@ -63,6 +63,11 @@ export interface AppsflyerInviteOptions { * this.appsflyer.initSdk(options); * * ``` + * + * @interfaces + * AppsflyerOptions + * AppsflyerEvent + * AppsflyerInviteOptions */ @Plugin({ pluginName: 'Appsflyer', @@ -74,96 +79,110 @@ export interface AppsflyerInviteOptions { }) @Injectable() export class Appsflyer extends IonicNativePlugin { - /** * initialize the SDK + * @param {AppsflyerOptions} options + * @returns {Promise} */ @Cordova() - initSdk(options: AppsflyerOptions): Promise { return; } + initSdk(options: AppsflyerOptions): Promise { + return; + } /** * These in-app events help you track how loyal users discover your app, and attribute them to specific campaigns/media-sources. Please take the time define the event/s you want to measure to allow you to track ROI (Return on Investment) and LTV (Lifetime Value). - * @param eventName custom event name, is presented in your dashboard - * @param eventValues event details + * @param {string} eventName custom event name, is presented in your dashboard + * @param {AppsflyerEvent} eventValues event details */ @Cordova({ sync: true }) - trackEvent(eventName: string, eventValues: AppsflyerEvent): void { } + trackEvent(eventName: string, eventValues: AppsflyerEvent): void {} /** * Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs. - * @param customerUserId user id + * @param {string} customerUserId user id */ @Cordova({ sync: true }) - setAppUserId(customerUserId: string): void { } + setAppUserId(customerUserId: string): void {} /** * Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs. - * @param customerUserId In some extreme cases you might want to shut down all SDK tracking due to legal and privacy compliance. This can be achieved with the isStopTracking API. Once this API is invoked, our SDK will no longer communicate with our servers and stop functioning. + * @param {boolean} customerUserId In some extreme cases you might want to shut down all SDK tracking due to legal and privacy compliance. This can be achieved with the isStopTracking API. Once this API is invoked, our SDK will no longer communicate with our servers and stop functioning. */ @Cordova({ sync: true }) - stopTracking(isStopTracking: boolean): void { } + stopTracking(isStopTracking: boolean): void {} /** * Get the data from Attribution + * @returns {Promise} */ @Cordova() - registerOnAppOpenAttribution(): Promise { return; } + registerOnAppOpenAttribution(): Promise { + return; + } /** - * Enables app uninstall tracking - * @param token GCM/FCM ProjectNumber - */ + * Enables app uninstall tracking + * @param {string} token GCM/FCM ProjectNumber + * @returns {Promise} + */ @Cordova() - enableUninstallTracking(token: string): Promise { return; } + enableUninstallTracking(token: string): Promise { + return; + } /** - * Allows to pass GCM/FCM Tokens that where collected by third party plugins to the AppsFlyer server. Can be used for Uninstall Tracking. - * @param token GCM/FCM ProjectNumber - */ + * Allows to pass GCM/FCM Tokens that where collected by third party plugins to the AppsFlyer server. Can be used for Uninstall Tracking. + * @param {string} token GCM/FCM ProjectNumber + */ @Cordova({ sync: true }) - updateServerUninstallToken(token: string): void { } + updateServerUninstallToken(token: string): void {} /** - * Get AppsFlyer’s proprietary Device ID. The AppsFlyer Device ID is the main ID used by AppsFlyer in Reports and APIs. - */ + * Get AppsFlyer’s proprietary Device ID. The AppsFlyer Device ID is the main ID used by AppsFlyer in Reports and APIs. + */ @Cordova() - getAppsFlyerUID(): Promise { return; } + getAppsFlyerUID(): Promise { + return; + } /** * End User Opt-Out (Optional) AppsFlyer provides you a method to opt‐out specific users from AppsFlyer analytics. This method complies with the latest privacy requirements and complies with Facebook data and privacy policies. Default is FALSE, meaning tracking is enabled by default. - * @param disable Set to true to opt-out user from tracking + * @param {boolean} disable Set to true to opt-out user from tracking */ @Cordova({ sync: true }) - deviceTrackingDisabled(disable: boolean): void { } + deviceTrackingDisabled(disable: boolean): void {} /** * Set AppsFlyer’s OneLink ID. Setting a valid OneLink ID will result in shortened User Invite links, when one is generated. The OneLink ID can be obtained on the AppsFlyer Dashboard. - * @param oneLinkId OneLink ID + * @param {string} oneLinkId OneLink ID */ @Cordova({ sync: true }) - setAppInviteOneLinkID(oneLinkId: string): void { } + setAppInviteOneLinkID(oneLinkId: string): void {} /** * Allowing your existing users to invite their friends and contacts as new users to your app can be a key growth factor for your app. AppsFlyer allows you to track and attribute new installs originating from user invites within your app. - * @param options Parameters for Invite link + * @param {AppsflyerInviteOptions} options Parameters for Invite link + * @returns {Promise} */ @Cordova() - generateInviteLink(options: AppsflyerInviteOptions): Promise { return; } + generateInviteLink(options: AppsflyerInviteOptions): Promise { + return; + } /** * Use this call to track an impression use the following API call. Make sure to use the promoted App ID as it appears within the AppsFlyer dashboard. - * @param appId Promoted Application ID - * @param campaign Promoted Campaign + * @param {string} appId Promoted Application ID + * @param {string} campaign Promoted Campaign */ @Cordova({ sync: true }) - trackCrossPromotionImpression(appId: string, campaign: string): void { } + trackCrossPromotionImpression(appId: string, campaign: string): void {} /** * Use this call to track the click and launch the app store's app page (via Browser) - * @param appId Promoted Application ID - * @param campaign Promoted Campaign - * @param options Additional Parameters to track + * @param {string} appId Promoted Application ID + * @param {string} campaign Promoted Campaign + * @param {Object} options Additional Parameters to track */ @Cordova({ sync: true }) - trackAndOpenStore(appId: string, campaign: string, options: Object): void { } + trackAndOpenStore(appId: string, campaign: string, options: Object): void {} }