Saranshmalik / react-native-zendesk

React native wrapper for Zendesk SDK
MIT License
29 stars 42 forks source link

Crash on Android, works fine on iOS #17

Closed anilios closed 3 years ago

anilios commented 3 years ago

This is how I am using the setup. Keys etc are fine because tickets show up when using iOS. It is just on Android that app crashes as soon as the button tapped to call the code below.

RNZendeskChat.init({ key: ZenDeskConstants.accountKey, appId: ZenDeskConstants.appId, url: ZenDeskConstants.url, clientId: ZenDeskConstants.clientId, }); RNZendeskChat.setVisitorInfo({ name: "Test", email: "test@gmail.com", }); RNZendeskChat.startChat({ chatOnly: false, withChat: true, disableTicketCreation: false, });

This is working on iOS fine but on Android, it just crashes. Can not see anything in logs also. 1618021128237

Saranshmalik commented 3 years ago

I don't see setUserIdentity method being called. That's required before you can use supportSDK. The error shows that only, missing name in setuseridentity. Make sure you do add that, will make it more clear and throw better errors for this.

anilios commented 3 years ago

Even after calling setUserIdentity, still getting the same user, tried the following:

RNZendeskChat.setUserIdentity({ name: "John", email: "xyz@abc.com", }); RNZendeskChat.startChat({ chatOnly: false, withChat: true, disableTicketCreation: false, });

But still gives name error for setUserIdentity.

Then i tried following and it worked:

RNZendeskChat.setUserIdentity({ name: "John", email: "xyz@abc.com", }); RNZendeskChat.startChat({ name: "John", email: "xyz@abc.com", chatOnly: false, withChat: true, disableTicketCreation: false, botName: "XYZ" });

In this case, the crash goes away, but the chatbot still keeps on asking name and email even though name and email is set. This is happening for both iOS and Android.

Saranshmalik commented 3 years ago

Probably a configuration issue. Working on a newer version with better config options to iron out such issues. For now, I'll think on if we have a temp solution for this. Also another things startChat have no option like withChat and disableTicketCreation, these are options for showHelpCenter.

anilios commented 3 years ago

For now, I am happy that I have working code for iOS and Android. The library is working great with Ticket creations.