Skip to content

Commit

Permalink
Release v4.2.6
Browse files Browse the repository at this point in the history
Release v4.2.6
  • Loading branch information
anbarasu-v committed Feb 1, 2022
1 parent 37d3c7d commit 1b1227e
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![SupportedLanguages](https://img.shields.io/badge/Platforms-iOS%20%7C%20%20Android-green.svg)](https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-installation.html) [![Version](https://img.shields.io/badge/version-4.2.5-blue.svg)](https://mobilisten.io/) [![Mobilisten NPM CD](https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/workflows/Mobilisten%20NPM%20CD/badge.svg)](https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/actions)
[![SupportedLanguages](https://img.shields.io/badge/Platforms-iOS%20%7C%20%20Android-green.svg)](https://www.zoho.com/salesiq/help/developer-section/react-native-sdk-installation.html) [![Version](https://img.shields.io/badge/version-4.2.6-blue.svg)](https://mobilisten.io/) [![Mobilisten NPM CD](https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/workflows/Mobilisten%20NPM%20CD/badge.svg)](https://github.com/zoho/SalesIQ-Mobilisten-ReactNative/actions)

# React Native module for SalesIQ Mobilisten SDK

Expand Down
5 changes: 4 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
buildscript {
repositories {
jcenter()
google()
}

dependencies {
Expand All @@ -10,6 +11,7 @@ buildscript {

apply plugin: 'com.android.library'


def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
Expand All @@ -31,9 +33,10 @@ android {

repositories {
mavenCentral()
google()
}

dependencies {
compile 'com.facebook.react:react-native:+'
implementation 'com.zoho.salesiq:mobilisten:4.2.2'
implementation 'com.zoho.salesiq:mobilisten:4.2.3'
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.facebook.react.bridge.WritableNativeMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.zoho.commons.OnInitCompleteListener;
import com.zoho.livechat.android.NotificationListener;
import com.zoho.livechat.android.SIQDepartment;
import com.zoho.livechat.android.SIQVisitor;
import com.zoho.livechat.android.SIQVisitorLocation;
Expand Down Expand Up @@ -87,6 +88,7 @@ public class RNZohoSalesIQ extends ReactContextBaseJavaModule {
private static final String EVENT_PERFORM_CHATACTION = "EVENT_PERFORM_CHATACTION"; // No I18N
private static final String EVENT_CUSTOMTRIGGER = "EVENT_CUSTOMTRIGGER"; // No I18N
private static final String EVENT_CHAT_QUEUE_POSITION_CHANGED = "EVENT_CHAT_QUEUE_POSITION_CHANGED"; // No I18N
private static final String EVENT_CHAT_UNREAD_COUNT_CHANGED = "EVENT_CHAT_UNREAD_COUNT_CHANGED"; // No I18N

private static final String TYPE_OPEN = "OPEN"; // No I18N
private static final String TYPE_CONNECTED = "CONNECTED"; // No I18N
Expand Down Expand Up @@ -133,6 +135,7 @@ public Map<String, Object> getConstants() {
constants.put("PERFORM_CHATACTION", EVENT_PERFORM_CHATACTION); // No I18N
constants.put("CUSTOMTRIGGER", EVENT_CUSTOMTRIGGER); // No I18N
constants.put("CHAT_QUEUE_POSITION_CHANGED", EVENT_CHAT_QUEUE_POSITION_CHANGED); // No I18N
constants.put("CHAT_UNREAD_COUNT_CHANGED", EVENT_CHAT_UNREAD_COUNT_CHANGED); // No I18N

constants.put("ARTICLE_LIKED", EVENT_ARTICLE_LIKED); // No I18N
constants.put("ARTICLE_DISLIKED", EVENT_ARTICLE_DISLIKED); // No I18N
Expand Down Expand Up @@ -422,6 +425,7 @@ public void run() {
ZohoSalesIQ.Chat.setListener(new RNZohoSalesIQListener());
ZohoSalesIQ.FAQ.setListener(new RNZohoSalesIQListener());
ZohoSalesIQ.ChatActions.setListener(new RNZohoSalesIQListener());
ZohoSalesIQ.Notification.setListener(new RNZohoSalesIQListener());
}
});
}
Expand All @@ -439,6 +443,7 @@ public void run() {
ZohoSalesIQ.Chat.setListener(new RNZohoSalesIQListener());
ZohoSalesIQ.FAQ.setListener(new RNZohoSalesIQListener());
ZohoSalesIQ.ChatActions.setListener(new RNZohoSalesIQListener());
ZohoSalesIQ.Notification.setListener(new RNZohoSalesIQListener());
}
});
}
Expand Down Expand Up @@ -961,6 +966,16 @@ public void run() {
});
}

@ReactMethod
public void getChatUnreadCount(@NonNull final Callback callback){
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
callback.invoke(ZohoSalesIQ.Notification.getBadgeCount());
}
});
}

@ReactMethod
public void addListener(String eventName) {
// Keep: Required for RN built in Event Emitter Calls.
Expand Down Expand Up @@ -1178,7 +1193,7 @@ public WritableMap getVisitorInfoObject(SIQVisitor siqVisitor) {
return infoMap;
}

public class RNZohoSalesIQListener implements SalesIQListener, SalesIQChatListener, SalesIQFAQListener, SalesIQActionListener {
public class RNZohoSalesIQListener implements SalesIQListener, SalesIQChatListener, SalesIQFAQListener, SalesIQActionListener, NotificationListener {

@Override
public void handleFeedback(VisitorChat visitorChat) {
Expand Down Expand Up @@ -1304,8 +1319,12 @@ public void handleCustomAction(SalesIQCustomAction salesIQCustomAction, final Sa
actionDetailsMap.putString("clientActionName", salesIQCustomAction.clientActionName); // No I18N

actionsList.put(uuid.toString(), salesIQCustomActionListener);

eventEmitter(EVENT_PERFORM_CHATACTION, actionDetailsMap);
}

@Override
public void onBadgeChange(int count) {
eventEmitter(EVENT_CHAT_UNREAD_COUNT_CHANGED, count);
}
}
}
7 changes: 7 additions & 0 deletions components/zohosalesiqJSWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = {
EVENT_CHAT_ATTENDED : RNZohoSalesIQ.CHAT_ATTENDED,
EVENT_CHAT_MISSED : RNZohoSalesIQ.CHAT_MISSED,
EVENT_CHAT_QUEUE_POSITION_CHANGED : RNZohoSalesIQ.CHAT_QUEUE_POSITION_CHANGED,
EVENT_CHAT_UNREAD_COUNT_CHANGED : RNZohoSalesIQ.CHAT_UNREAD_COUNT_CHANGED,
EVENT_FEEDBACK_RECEIVED : RNZohoSalesIQ.FEEDBACK_RECEIVED,
EVENT_RATING_RECEIVED : RNZohoSalesIQ.RATING_RECEIVED,

Expand Down Expand Up @@ -202,5 +203,11 @@ module.exports = {
},
isMultipleOpenChatRestricted: function(callback){
RNZohoSalesIQ.isMultipleOpenChatRestricted(callback);
},
isChatEnabled: function(callback){
RNZohoSalesIQ.isChatEnabled(callback);
},
getChatUnreadCount: function(callback){
RNZohoSalesIQ.getChatUnreadCount(callback);
}
}
16 changes: 11 additions & 5 deletions ios/RNZohoSalesIQ.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ -(void)stopObserving {
NSString *RATING_RECEIVED = @"RATING_RECEIVED";
NSString *CHAT_REOPENED = @"CHAT_REOPENED";
NSString *CHAT_QUEUE_POSITION_CHANGED = @"CHAT_QUEUE_POSITION_CHANGED";
NSString *CHAT_UNREAD_COUNT_CHANGED = @"CHAT_UNREAD_COUNT_CHANGED";
NSString *PERFORM_CHATACTION = @"PERFORM_CHATACTION";

NSString *UNREAD_COUNT_CHANGED = @"UNREAD_COUNT_CHANGED";
NSString *VISITOR_IPBLOCKED = @"VISITOR_IPBLOCKED";
NSString *CUSTOMTRIGGER = @"CUSTOMTRIGGER";

Expand Down Expand Up @@ -122,11 +122,11 @@ -(void)stopObserving {
CHAT_OPENED,
RATING_RECEIVED,
CHAT_REOPENED,
UNREAD_COUNT_CHANGED,
VISITOR_IPBLOCKED,
PERFORM_CHATACTION,
CUSTOMTRIGGER,
CHAT_QUEUE_POSITION_CHANGED];
CHAT_QUEUE_POSITION_CHANGED,
CHAT_UNREAD_COUNT_CHANGED];
}

- (NSDictionary *) constantsToExport {
Expand All @@ -151,7 +151,7 @@ - (NSDictionary *) constantsToExport {
@"CHAT_OPENED": CHAT_OPENED,
@"RATING_RECEIVED": RATING_RECEIVED,
@"CHAT_REOPENED": CHAT_REOPENED,
@"UNREAD_COUNT_CHANGED": UNREAD_COUNT_CHANGED,
@"CHAT_UNREAD_COUNT_CHANGED": CHAT_UNREAD_COUNT_CHANGED,
@"VISITOR_IPBLOCKED": VISITOR_IPBLOCKED,
@"TYPE_OPEN": TYPE_OPEN,
@"TYPE_WAITING": TYPE_WAITING,
Expand Down Expand Up @@ -788,6 +788,12 @@ + (void)handleNotificationAction: (NSDictionary *) info response:(NSString *) re
callback(@[chatEnabled]);
}

RCT_EXPORT_METHOD(getChatUnreadCount:(RCTResponseSenderBlock)callback)
{
NSNumber *unreadCount = [NSNumber numberWithInteger: [[ZohoSalesIQ Chat] getUnreadMessageCount]];
callback(@[unreadCount]);
}

//MARK:- CHAT GET LIST API
RCT_EXPORT_METHOD(getChats:(RCTResponseSenderBlock)callback)
{
Expand Down Expand Up @@ -1108,7 +1114,7 @@ - (void)chatReopenedWithChat:(SIQVisitorChat * _Nullable)chat {

- (void)unreadCountChanged:(NSInteger)count {
if (hasListeners)
[self sendEventWithName:UNREAD_COUNT_CHANGED body: @(count)];
[self sendEventWithName:CHAT_UNREAD_COUNT_CHANGED body: @(count)];
}

- (void)visitorIPBlocked {
Expand Down
2 changes: 1 addition & 1 deletion ios/RNZohoSalesIQ.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = "RNZohoSalesIQ"
s.version = "4.2.4"
s.version = "4.2.5"
s.summary = "A React-Native module for the SalesIQ Mobilisten SDK"
s.description = "A React-Native module for the SalesIQ Mobilisten SDK"
s.homepage = "https://zoho.com"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-zohosalesiq-mobilisten",
"version": "4.2.5",
"version": "4.2.6",
"description": "A React Native module for the ZohoSalesIQ Mobilisten SDK",
"bugs": {
"email": "[email protected]"
Expand Down

0 comments on commit 1b1227e

Please sign in to comment.