Skip to content

Commit

Permalink
Merge pull request #80 from AppsFlyerSDK/removePlayServicesAds
Browse files Browse the repository at this point in the history
fix generate invite link and version update
  • Loading branch information
GM-appsflyer authored Aug 3, 2023
2 parents ea97ea4 + 152e5e3 commit bd2e5d2
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 27 deletions.
11 changes: 11 additions & 0 deletions appsflyer.android.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { InitSDKOptions, LogEventOptions } from './index';
export declare const initSdk: (args: InitSDKOptions) => Promise<unknown>;
export declare const logEvent: (args: LogEventOptions) => Promise<unknown>;
export declare const setCustomerUserId: (userId: string) => Promise<unknown>;
export declare const setAppInviteOneLink: (link: string) => Promise<unknown>;
export declare const generateInviteUrl: (args: AppsFlyerLinkGeneratorArgs) => Promise<unknown>;
export declare const stop: (isStopped: bool) => Promise<unknown>;
export declare const setSharingFilter: (partners: Array<string>) => Promise<unknown>;
export declare const setSharingFilterForAllPartners: () => Promise<unknown>;
export declare const _toHashMap: (obj: Object) => javautilHashMap<unknown, unknown>;
export declare const _toValue: (val: any) => any;
20 changes: 10 additions & 10 deletions appsflyer.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,37 +254,37 @@ export const generateInviteUrl = function (args: AppsFlyerLinkGeneratorArgs) {
const linkGenerator: com.appsflyer.share.LinkGenerator = appsflyerShareInviteHelper.generateInviteUrl(Application.android.context);

if (channel != null && channel != "") {
linkGenerator.setChannel(channel);
linkGenerator.setChannel(String(channel));
}
if (campaign != null && campaign != "") {
linkGenerator.setCampaign(campaign);
linkGenerator.setCampaign(String(campaign));
}
if (referrerName != null && referrerName != "") {
linkGenerator.setReferrerName(referrerName);
linkGenerator.setReferrerName(String(referrerName));
}
if (referrerImageUrl != null && referrerImageUrl != "") {
linkGenerator.setReferrerImageURL(referrerImageUrl);
linkGenerator.setReferrerImageURL(String(referrerImageUrl));
}
if (customerID != null && customerID != "") {
linkGenerator.setReferrerCustomerId(customerID);
linkGenerator.setReferrerCustomerId(String(customerID));
}
if (baseDeepLink != null && baseDeepLink != "") {
linkGenerator.setBaseDeeplink(baseDeepLink);
linkGenerator.setBaseDeeplink(String(baseDeepLink));
}
if (brandDomain != null && brandDomain != "") {
linkGenerator.setBrandDomain(brandDomain);
linkGenerator.setBrandDomain(String(brandDomain));
}

if (!isEmpty(params.userParams)) {
Object.entries(params.userParams).forEach(([key, value]) => {
linkGenerator.addParameter(key, value);
linkGenerator.addParameter(key, String(value));
})
}

if(args.onSuccess && args.onFailure){
if(args.onSuccess && args.onError){
const listener: com.appsflyer.CreateOneLinkHttpTask.ResponseListener = new com.appsflyer.CreateOneLinkHttpTask.ResponseListener(<any>{
_successCallback: args.onSuccess,
_failureCallback: args.onFailure,
_failureCallback: args.onError,
onResponse(): void {
if (!this._successCallback) {
return;
Expand Down
7 changes: 7 additions & 0 deletions appsflyer.ios.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { InitSDKOptions, LogEventOptions } from './index';
export declare const initSdk: (args: InitSDKOptions) => Promise<unknown>;
export declare const logEvent: (args: LogEventOptions) => Promise<unknown>;
export declare const stop: (isStopped: bool) => Promise<unknown>;
export declare const setCustomerUserId: (userId: string) => Promise<unknown>;
export declare const setAppInviteOneLink: (link: string) => Promise<unknown>;
export declare const generateInviteUrl: (args: AppsFlyerLinkGeneratorArgs) => Promise<unknown>;
18 changes: 10 additions & 8 deletions appsflyer.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,29 +179,31 @@ export const generateInviteUrl = function (args: AppsFlyerLinkGeneratorArgs) {

const linkGenerator: function = function(linkGenerator: AppsFlyerLinkGenerator){
if (channel != null && channel != "") {
linkGenerator.setChannel(channel);
linkGenerator.setChannel(String(channel));
}
if (campaign != null && campaign != "") {
linkGenerator.setCampaign(campaign);
linkGenerator.setCampaign(String(campaign));
}
if (referrerName != null && referrerName != "") {
linkGenerator.setReferrerName(referrerName);
linkGenerator.setReferrerName(String(referrerName));
}
if (referrerImageUrl != null && referrerImageUrl != "") {
linkGenerator.setReferrerImageURL(referrerImageUrl);
linkGenerator.setReferrerImageURL(String(referrerImageUrl));
}
if (customerID != null && customerID != "") {
linkGenerator.setReferrerCustomerId(customerID);
linkGenerator.setReferrerCustomerId(String(customerID));
}
if (baseDeepLink != null && baseDeepLink != "") {
linkGenerator.setBaseDeeplink(baseDeepLink);
linkGenerator.setBaseDeeplink(String(baseDeepLink));
}
if (brandDomain != null && brandDomain != "") {
linkGenerator.setBrandDomain(brandDomain);
linkGenerator.brandDomain = brandDomain
}

if (!isEmpty(params.userParams)) {
linkGenerator.addParameters(params.userParams);
Object.entries(params.userParams).forEach(([key, value]) => {
linkGenerator.addParameterValueForKey(String(value), key);
})
}
return linkGenerator
}
Expand Down
6 changes: 3 additions & 3 deletions demoNative/app/main-view-model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Observable } from "@nativescript/core";

var appsFlyer = require("nativescript-plugin-appsflyer");
import * as appsFlyer from "nativescript-plugin-appsflyer";

export class HelloWorldModel extends Observable {
options: any;
Expand All @@ -19,7 +18,8 @@ export class HelloWorldModel extends Observable {
params: {
channel: 'gmail',
campaign: 'myCampaign',
customerID: '1234',
customerID: 1234,
brandDomain: "brand.domain.com",
userParams: {
myParam: 'newUser',
anotherParam: 'fromWeb',
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-plugin-appsflyer",
"version": "6.12.5",
"version": "6.12.6",
"description": "Appsflyer SDK for NativeScript applications",
"main": "appsflyer",
"typings": "index.d.ts",
Expand Down Expand Up @@ -51,13 +51,13 @@
"@nativescript/ios": ">=7.0.0",
"@nativescript/types": ">=7.0.0",
"@nativescript/webpack": "~5.0.16",
"ts-patch": "~1.3.1",
"typescript": "~3.9.0"
"ts-patch": "~3.0.2",
"typescript": "~4.8.0"
},
"peerDependencies": {
"@nativescript/core": ">=7.0.0"
},
"dependencies": {
"ts-node": "~9.1.1"
"ts-node": "~10.9.1"
}
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"target": "es2017",
"module": "esnext",
"moduleResolution": "node",
"declaration": false,
"declaration": true,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
Expand All @@ -23,7 +23,7 @@
"baseUrl": ".",
"plugins": [
{
"transform": "@nativescript/webpack/transformers/ns-transform-native-classes",
"transform": "@nativescript/webpack/dist/transformers/NativeClass",
"type": "raw"
}
]
Expand Down

0 comments on commit bd2e5d2

Please sign in to comment.