Skip to content

Commit

Permalink
Fix Android issue on determineAvailability result
Browse files Browse the repository at this point in the history
  • Loading branch information
SonoIo committed Oct 1, 2018
1 parent 876854d commit 09b3e70
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-salesforce-snapins",
"version": "1.0.1",
"version": "1.0.2",
"description": "Plugin for SalesForce Snap-ins",
"cordova": {
"id": "cordova-plugin-salesforce-snapins",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-salesforce-snapins" version="1.0.1"
<plugin id="cordova-plugin-salesforce-snapins" version="1.0.2"
xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<name>Snap-ins Salseforce</name>
Expand Down
4 changes: 2 additions & 2 deletions src/android/SalesforceSnapInsPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
public void handleResult(Async<?> async, @NonNull AvailabilityState state) {
switch (state.getStatus()) {
case AgentsAvailable:
callbackContext.success("available");
callbackContext.success("true");
break;
case NoAgentsAvailable:
callbackContext.success("not available");
callbackContext.success("false");
break;
case Unknown:
callbackContext.error("Unknown error");
Expand Down
10 changes: 9 additions & 1 deletion www/SalesforceSnapInsPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,15 @@ SalesforceSnapInsPlugin.prototype.openLiveAgentChat = function openLiveAgentChat
SalesforceSnapInsPlugin.prototype.determineAvailability = function determineAvailability(success, error) {
if (!success) success = successCallback;
if (!error) error = errorCallback;
exec(success, error, 'SalesforceSnapInsPlugin', 'determineAvailability', [ ]);
var internalSuccess = function (available) {
try {
available = JSON.parse(available);
} catch(e) {
available = false;
}
success(available);
};
exec(internalSuccess, error, 'SalesforceSnapInsPlugin', 'determineAvailability', [ ]);
return this;
};

Expand Down

0 comments on commit 09b3e70

Please sign in to comment.