@essent/nativescript-iadvize
Advanced tools
Comparing version 2.9.2 to 2.9.3-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(); | ||
} | ||
@@ -162,10 +168,10 @@ registerPushToken(token, _isProd) { | ||
case 0: | ||
return com.iadvize.conversation.sdk.feature.logger.Logger.Level.VERBOSE; | ||
return com.iadvize.conversation.sdk.feature.logger.Logger.Level.class.getDeclaredField('VERBOSE').get(null); | ||
case 1: | ||
return com.iadvize.conversation.sdk.feature.logger.Logger.Level.INFO; | ||
return com.iadvize.conversation.sdk.feature.logger.Logger.Level.class.getDeclaredField('INFO').get(null); | ||
case 3: | ||
return com.iadvize.conversation.sdk.feature.logger.Logger.Level.ERROR; | ||
return com.iadvize.conversation.sdk.feature.logger.Logger.Level.class.getDeclaredField('ERROR').get(null); | ||
case 2: | ||
default: | ||
return com.iadvize.conversation.sdk.feature.logger.Logger.Level.WARNING; | ||
return com.iadvize.conversation.sdk.feature.logger.Logger.Level.class.getDeclaredField('WARNING').get(null); | ||
} | ||
@@ -181,2 +187,3 @@ } | ||
} | ||
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.2", | ||
"version": "2.9.3-alpha.0", | ||
"description": "iAdvize plugin for NativeScript.", | ||
@@ -34,4 +34,3 @@ "main": "index", | ||
"readmeFilename": "README.md", | ||
"bootstrapper": "@nativescript/plugin-seed", | ||
"types": "./index.d.d.ts" | ||
"bootstrapper": "@nativescript/plugin-seed" | ||
} |
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
18
439
1