@essent/nativescript-iadvize
Advanced tools
Comparing version 2.9.1 to 2.9.2-alpha.0
@@ -6,2 +6,3 @@ import { ChatConfiguration, IAdvizeCommon } from './common'; | ||
static getInstance(): IAdvize; | ||
private static targetingListener; | ||
private buildGdprOption; | ||
@@ -8,0 +9,0 @@ activate(projectId: number, userId: string, legalUrl: string | undefined, onSuccess: () => void, onFailure: () => void): void; |
@@ -25,2 +25,3 @@ import { IAdvizeCommon } from './common'; | ||
instance = new IAdvize(); | ||
IAdvize.initiate(); | ||
} | ||
@@ -38,3 +39,2 @@ return instance; | ||
activate(projectId, userId, legalUrl = undefined, onSuccess, onFailure) { | ||
IAdvize.initiate(); | ||
const gdprOption = this.buildGdprOption(legalUrl); | ||
@@ -61,13 +61,19 @@ com.iadvize.conversation.sdk.IAdvizeSDK.activate(projectId, new com.iadvize.conversation.sdk.feature.authentication.AuthenticationOption.Simple(userId), gdprOption, new com.iadvize.conversation.sdk.IAdvizeSDK.Callback({ | ||
} | ||
const listeners = IAdvizeSDK().getTargetingController().getListeners(); | ||
listeners.add(new com.iadvize.conversation.sdk.feature.targeting.TargetingListener({ | ||
onActiveTargetingRuleAvailabilityUpdated(param0) { | ||
console.log('iAdvize[Android] Targeting rule available - ' + param0); | ||
IAdvize.activateChatbot(); | ||
}, | ||
})); | ||
if (!IAdvize.targetingListener) { | ||
const listeners = IAdvizeSDK().getTargetingController().getListeners(); | ||
IAdvize.targetingListener = new com.iadvize.conversation.sdk.feature.targeting.TargetingListener({ | ||
onActiveTargetingRuleAvailabilityUpdated(param0) { | ||
console.log('iAdvize[Android] Targeting rule available - ' + param0); | ||
if (param0) { | ||
IAdvize.activateChatbot(); | ||
return; | ||
} | ||
IAdvize.deactivateChatbot(); | ||
}, | ||
}); | ||
listeners.add(IAdvize.targetingListener); | ||
} | ||
const language = com.iadvize.conversation.sdk.type.Language.class.getDeclaredField('nl').get(null); | ||
IAdvizeSDK().getTargetingController().setLanguage(new com.iadvize.conversation.sdk.feature.targeting.LanguageOption.Custom(language)); | ||
IAdvizeSDK().getTargetingController().activateTargetingRule(this.buildTargetingRule(targetingRuleUUID)); | ||
IAdvize.activateChatbot(); | ||
} | ||
@@ -135,6 +141,6 @@ logout() { | ||
dismissChat() { | ||
const isChatActivity = Application.android.foregroundActivity instanceof com.iadvize.conversation.sdk.feature.chatbox.ChatboxActivity; | ||
if (isChatActivity) { | ||
Application.android.foregroundActivity.finish(); | ||
if (!IAdvizeSDK()) { | ||
return; | ||
} | ||
IAdvizeSDK().getChatboxController().dismissChatbox(); | ||
} | ||
@@ -180,2 +186,3 @@ registerPushToken(token, _isProd) { | ||
} | ||
IAdvize.targetingListener = null; | ||
//# sourceMappingURL=index.android.js.map |
@@ -41,6 +41,12 @@ import { Color, ImageSource } from '@nativescript/core'; | ||
activateTargetingRule(targetingRuleUUID) { | ||
this.targetingRuleDelegate = TargetingControllerDelegateImpl.initWithCallbacks((isActiveTargetingRuleAvailable) => { | ||
console.log('iAdvize[iOS] Targeting rule available - ' + isActiveTargetingRuleAvailable); | ||
IAdvize.activateChatbot(); | ||
}); | ||
if (!this.targetingRuleDelegate) { | ||
this.targetingRuleDelegate = TargetingControllerDelegateImpl.initWithCallbacks((isActiveTargetingRuleAvailable) => { | ||
console.log('iAdvize[iOS] Targeting rule available - ' + isActiveTargetingRuleAvailable); | ||
if (isActiveTargetingRuleAvailable) { | ||
IAdvize.activateChatbot(); | ||
return; | ||
} | ||
IAdvize.deactivateChatbot(); | ||
}); | ||
} | ||
IAdvizeSDK.shared.targetingController.delegate = this.targetingRuleDelegate; | ||
@@ -47,0 +53,0 @@ IAdvizeSDK.shared.targetingController.setLanguage(SDKLanguageOption.customWithValue(119 /* GraphQLLanguage.Nl */)); |
{ | ||
"name": "@essent/nativescript-iadvize", | ||
"version": "2.9.1", | ||
"version": "2.9.2-alpha.0", | ||
"description": "iAdvize plugin for NativeScript.", | ||
@@ -5,0 +5,0 @@ "main": "index", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50459
439
1