Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getAppsFlyerUID exposed in API #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions appsflyer.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,21 @@ export const setCustomerUserId = function (userId: string) {
});
};

export const getAppsFlyerUID = function() {
return new Promise(function (resolve, reject) {
try {
const appsFlyerLibInstance = com.appsflyer.AppsFlyerLib.getInstance();
const c = Application.android.context || (<any>com).tns.NativeScriptApplication.getInstance();
const uid = appsFlyerLibInstance.getAppsFlyerUID(c);

resolve(uid);
} catch (ex) {
printLogs("setCustomerUserId Error: " + ex);
reject(ex);
}
});
}

export const setSharingFilter = function (partners: Array<string>) {

return new Promise(function (resolve, reject) {
Expand Down
18 changes: 18 additions & 0 deletions appsflyer.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,24 @@ export const setCustomerUserId = function (userId: string) {
});
};

export const getAppsFlyerUID = function() {
return new Promise((resolve, reject) => {
try {

if (typeof(AppsFlyerLib) !== "undefined") {
const uid = AppsFlyerLib.shared().getAppsFlyerUID();
resolve(uid);
} else {
reject({status: "failure", message: "AppsFlyer is not defined, call 1st 'initSdk'"});
}

} catch (ex) {
console.log("AF_IOS :: Error: " + ex);
reject(ex);
}
});
}

@NativeClass
class DeepLinkDelegate extends NSObject implements AppsFlyerDeepLinkDelegate {
public static ObjCProtocols = [AppsFlyerDeepLinkDelegate];
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function setSharingFilterForAllPartners(): Promise<{status} | any>;

export function setCustomerUserId (userId: string): Promise<{status} | any>;


export function getAppsFlyerUID(): Promise<string>;

export interface ConversionData {
af_status;
Expand Down