Skip to content

Commit

Permalink
Release v8.1.0
Browse files Browse the repository at this point in the history
Release v8.1.0
  • Loading branch information
yeskay-zohocorp committed Sep 11, 2024
1 parent 78b4ba2 commit 2149131
Show file tree
Hide file tree
Showing 8 changed files with 794 additions and 27 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/cordova-ionic-installation.html) [![Version](https://img.shields.io/badge/version-8.0.0-blue.svg)](https://mobilisten.io/) [![Mobilisten NPM CD](https://github.com/zoho/SalesIQ-Mobilisten-Cordova/workflows/Mobilisten%20NPM%20CD/badge.svg)](https://github.com/zoho/SalesIQ-Mobilisten-Cordova/actions?query=workflow%3A%22Mobilisten+NPM+CD%22)
[![SupportedLanguages](https://img.shields.io/badge/Platforms-iOS%20%7C%20%20Android-green.svg)](https://www.zoho.com/salesiq/help/developer-section/cordova-ionic-installation.html) [![Version](https://img.shields.io/badge/version-8.1.0-blue.svg)](https://mobilisten.io/) [![Mobilisten NPM CD](https://github.com/zoho/SalesIQ-Mobilisten-Cordova/workflows/Mobilisten%20NPM%20CD/badge.svg)](https://github.com/zoho/SalesIQ-Mobilisten-Cordova/actions?query=workflow%3A%22Mobilisten+NPM+CD%22)

# SalesIQ Mobilisten SDK - Cordova Plugin

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": "cordova-zohosalesiq-mobilisten",
"version": "8.0.0",
"version": "8.1.0",
"description": "A Cordova plugin for the Zoho SalesIQ Mobilisten SDK",
"cordova": {
"id": "cordova-zohosalesiq-mobilisten",
Expand Down
5 changes: 4 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
<js-module name="ZohoSalesIQ" src="www/ZohoSalesIQ.js">
<clobbers target="ZohoSalesIQ" />
</js-module>
<js-module name="SIQTheme" src="www/SIQTheme.js">
<clobbers target="SIQTheme" />
</js-module>
<platform name="ios">
<podspec>
<config>
<source url="https://github.com/CocoaPods/Specs.git" />
</config>
<pods use-frameworks="true">
<pod name="Mobilisten" spec="9.0.1" />
<pod name="Mobilisten" spec="9.1.1" />
</pods>
</podspec>
<config-file parent="/*" target="config.xml">
Expand Down
83 changes: 83 additions & 0 deletions src/android/ZohoSalesIQPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import com.zoho.livechat.android.models.SalesIQArticleCategory;
import com.zoho.livechat.android.modules.common.DataModule;
import com.zoho.livechat.android.modules.common.ui.LauncherUtil;
import com.zoho.livechat.android.modules.common.ui.result.entities.SalesIQError;
import com.zoho.livechat.android.modules.knowledgebase.ui.entities.Resource;
import com.zoho.livechat.android.modules.knowledgebase.ui.entities.ResourceCategory;
import com.zoho.livechat.android.modules.knowledgebase.ui.entities.ResourceDepartment;
Expand Down Expand Up @@ -155,6 +156,9 @@ public boolean execute(String action, JSONArray data, CallbackContext callbackCo
if (action.equalsIgnoreCase("init")) {
this.init(data.get(0).toString(), data.get(1).toString(), callbackContext);
}
if (action.equalsIgnoreCase("present")) {
this.present(getStringOrNull(data.get(0)), getStringOrNull(data.get(1)), callbackContext);
}
if (action.equals("enableScreenshotOption")) {
this.enableScreenshotOption();
}
Expand Down Expand Up @@ -388,6 +392,47 @@ public static void handleMethodCalls(String action, JSONArray data, CallbackCont
ZohoSalesIQ.Chat.showFeedback(LiveChatUtil.getInteger(data.get(0)));
} else if (action.contains("isChatEnabled")) {
Chat.isChatEnabled(callbackContext);
} else if (action.equals("setChatWaitingTime")) {
ZohoSalesIQ.Chat.setWaitingTime(LiveChatUtil.getInteger(data.get(0)));
} else if (action.equals("startNewChat")) {
ZohoSalesIQ.Chat.start(LiveChatUtil.getString(data.get(0)), getStringOrNull(data.get(1)), getStringOrNull(data.get(2)), chatResult -> {
if (chatResult.isSuccess()) {
callbackContext.success(getAsJSONObject(chatResult.getData()));
} else {
SalesIQError error = chatResult.getError();
if (error != null) {
callbackContext.error(getErrorJson(error.getCode(), error.getMessage()));
} else {
callbackContext.error("Unknown error occurred while starting a new chat."); //No I18N
}
}
});
} else if (action.equals("startNewChatWithTrigger")) {
ZohoSalesIQ.Chat.startWithTrigger(getStringOrNull(data.get(0)), getStringOrNull(data.get(1)), chatResult -> {
if (chatResult.isSuccess()) {
callbackContext.success(getAsJSONObject(chatResult.getData()));
} else {
SalesIQError error = chatResult.getError();
if (error != null) {
callbackContext.error(getErrorJson(error.getCode(), error.getMessage()));
} else {
callbackContext.error("Unknown error occurred while starting a new chat with trigger."); //No I18N
}
}
});
} else if (action.equals("getChat")) {
ZohoSalesIQ.Chat.get(LiveChatUtil.getString(data.get(0)), chatResult -> {
if (chatResult.isSuccess()) {
callbackContext.success(getAsJSONObject(chatResult.getData()));
} else {
SalesIQError error = chatResult.getError();
if (error != null) {
callbackContext.error(getErrorJson(error.getCode(), error.getMessage()));
} else {
callbackContext.error("Unknown error occurred while getting the chat."); //No I18N
}
}
});
}
} catch (JSONException e) {
throw new RuntimeException(e);
Expand Down Expand Up @@ -433,6 +478,9 @@ public static void handleMethodCalls(final String action, final JSONArray data,
case "enableLauncherDragToDismiss":
ZohoSalesIQ.Launcher.enableDragToDismiss(LiveChatUtil.getBoolean(data.get(0)));
break;
case "setLauncherMinimumPressDuration":
ZohoSalesIQ.Launcher.setMinimumPressDuration(LiveChatUtil.getInteger(data.get(0)));
break;
}
} catch (JSONException e) {
throw new RuntimeException(e);
Expand All @@ -455,6 +503,31 @@ public void run() {
});
}

private static void present(@Nullable final String tab, @Nullable final String id, final CallbackContext callbackContext) {
ZohoSalesIQ.present(getTab(tab), id, presentResult -> {
if (presentResult.isSuccess()) {
callbackContext.success(1);
} else {
SalesIQError error = presentResult.getError();
if (error != null) {
callbackContext.error(getErrorJson(error.getCode(), error.getMessage()));
} else {
callbackContext.error("Unknown error occurred while presenting the tab."); //No I18N
}
}
});
}

private static @Nullable ZohoSalesIQ.Tab getTab(@Nullable String tab) {
ZohoSalesIQ.Tab tabType = null;
if (Tab.CONVERSATIONS.name.equals(tab)) {
tabType = ZohoSalesIQ.Tab.Conversations;
} else if (Tab.KNOWLEDGE_BASE.name.equals(tab) || Tab.FAQ.name.equals(tab)) {
tabType = ZohoSalesIQ.Tab.KnowledgeBase;
}
return tabType;
}

private void enableScreenshotOption() {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
Expand Down Expand Up @@ -2179,6 +2252,16 @@ static JSONObject getErrorJson(int code, String message) {
return errorMap;
}

private static @Nullable String getStringOrNull(Object object) {
String value;
if (object == null || object == JSONObject.NULL) {
value = null;
} else {
value = (String) object;
}
return value;
}

// void clearLogsForiOS() {}

// void setLoggerPathForiOS(final String value) {}
Expand Down
2 changes: 1 addition & 1 deletion src/android/zohosalesIQ.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ repositories {
}

dependencies {
implementation "com.zoho.salesiq:mobilisten:7.0.0"
api "com.zoho.salesiq:mobilisten:8.0.5"
implementation 'com.google.code.gson:gson:2.8.6'
}
Loading

0 comments on commit 2149131

Please sign in to comment.