diff --git a/packages/nativescript-iadvize/index.android.ts b/packages/nativescript-iadvize/index.android.ts index 7cff71b..9114bba 100644 --- a/packages/nativescript-iadvize/index.android.ts +++ b/packages/nativescript-iadvize/index.android.ts @@ -200,6 +200,27 @@ export class IAdvize extends IAdvizeCommon { com.iadvize.conversation.sdk.IAdvizeSDK.setLogLevel(this.logLevelFrom(logLevel)); } + public isActiveTargetingRuleAvailable(): boolean { + if (!IAdvizeSDK()) { + return false; + } + + return IAdvizeSDK().getTargetingController().isActiveTargetingRuleAvailable(); + } + + public hasOngoingConversation(): boolean { + if (!IAdvizeSDK()) { + return false; + } + + const ongoingConversation = IAdvizeSDK().getConversationController().ongoingConversation(); + if (!ongoingConversation) { + return false; + } + + return ongoingConversation.getConversationId().trim().length !== 0; + } + private logLevelFrom(logLevel: number): com.iadvize.conversation.sdk.feature.logger.Logger.Level { switch (logLevel) { case 0: diff --git a/packages/nativescript-iadvize/index.ios.ts b/packages/nativescript-iadvize/index.ios.ts index 3882e6c..abfa5a0 100644 --- a/packages/nativescript-iadvize/index.ios.ts +++ b/packages/nativescript-iadvize/index.ios.ts @@ -138,6 +138,19 @@ export class IAdvize extends IAdvizeCommon { IAdvizeSDK.shared.setLogLevel(this.logLevelFrom(logLevel)); } + public isActiveTargetingRuleAvailable(): boolean { + return IAdvizeSDK.shared.targetingController.isActiveTargetingRuleAvailable; + } + + public hasOngoingConversation(): boolean { + const ongoingConversation = IAdvizeSDK.shared.conversationController.ongoingConversation(); + if (!ongoingConversation) { + return false; + } + + return ongoingConversation.conversationId.UUIDString.trim().length !== 0; + } + private logLevelFrom(logLevel: number): LoggerLogLevel { switch (logLevel) { case 0: diff --git a/packages/nativescript-iadvize/package.json b/packages/nativescript-iadvize/package.json index 56a9e86..e96413f 100644 --- a/packages/nativescript-iadvize/package.json +++ b/packages/nativescript-iadvize/package.json @@ -1,6 +1,6 @@ { "name": "@essent/nativescript-iadvize", - "version": "2.10.0", + "version": "2.10.1", "description": "iAdvize plugin for NativeScript.", "main": "index", "typings": "index.d.ts", diff --git a/packages/nativescript-iadvize/typings/objc!IAdvizeConversationSDK.d.ts b/packages/nativescript-iadvize/typings/objc!IAdvizeConversationSDK.d.ts index 067690f..7fd2383 100644 --- a/packages/nativescript-iadvize/typings/objc!IAdvizeConversationSDK.d.ts +++ b/packages/nativescript-iadvize/typings/objc!IAdvizeConversationSDK.d.ts @@ -1141,6 +1141,8 @@ declare class OngoingConversation extends NSObject { static alloc(): OngoingConversation; // inherited from NSObject static new(): OngoingConversation; // inherited from NSObject + + conversationId: NSUUID; } declare class SDKLanguageOption extends NSObject {