Skip to content
Merged
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
21 changes: 21 additions & 0 deletions packages/nativescript-iadvize/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions packages/nativescript-iadvize/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion packages/nativescript-iadvize/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down