JivoChat / JivoSDK-Android

The Jivo Mobile SDK allows you to embed the Jivo chat into your Android mobile applications to receive customer requests
https://www.jivochat.com
10 stars 5 forks source link

Chat button disabled even if device has internet connection #72

Open alvindizon opened 5 months ago

alvindizon commented 5 months ago

We have received multiple reports from Android 14/API 34 users of not being able to send chat messages. Specifically, they were reporting that the send button is disabled, even if their device still has an internet connection. We suspect that the changes introduced in version 2.2.2 caused this problem, specifically: https://github.com/JivoChat/JivoSDK-Android/blob/87141624c5a9038399fbd26b0c70c5bc58fdd2b9/sdk/src/main/java/com/jivosite/sdk/ui/views/JivoChatButton.kt#L47 This issue does not happen in version 2.1.1.

valdenio commented 3 months ago

I found a similar problem. The error is not in the button, but in the chat itself. The message presented is about internet connection, but that's not the case. I think it's just a generic error message.

The documentation is old and don't reflect current methods, being dificult to understand what is going on. Logcat presents these messages: image

That's how screen looks like: image

tavtorkin-jivo commented 3 months ago

@valdenio what version of JivoSDK are you using? What did you write in Jivo.setData()?

valdenio commented 3 months ago

@tavtorkin-jivo I've tried with versions 2.1.1, 2.2.1, 2.3.0 and 2.3.1. All of them give me the same result.

I'm calling setData only with widgetId: Jivo.setData("widgetId")

Neuron64 commented 2 months ago

Try updating the app from version 2.2.1 to 2.3.2. When calling Jivo.setData("widgetId"), will be error: "There is something wrong, code = 500, error = End of input." If you open the chat, send button will be disabled. Only way to fix -clear app data.

jom16antonio commented 3 weeks ago

Hi, following up on this issue? Is there an upcoming release that will fix this issue with disabled send button? v2.3.2 still encounters this problem.

tavtorkin-jivo commented 2 weeks ago

Hi, we will definitely check and respond.

alvindizon commented 1 week ago

Hello Jivo team, looking at the code for setting the chat button to activated, it seems that ButtonState::isOnline doesn't actually mean that there is an Internet connection, but rather if there are agents online--in JivoChatViewModel.kt, the ButtonState::isOnline is set by AgentRepository::hasAgentsOnline, see https://github.com/JivoChat/JivoSDK-Android/blob/164d35d865d1a652982c3c7fb845b76f1c34b33c/sdk/src/main/java/com/jivosite/sdk/ui/views/JivoChatButtonViewModel.kt#L26. In that case, should this be changed so that the chat button is still activated/enabled even if there are no agents available? Users should still be able to send chats so that their messages can be seen when agents are available. If this is intentional, then it should be documented--versions before 2.2 did not experience this behavior and it would be beneficial to inform developers that chat is disabled if the SDK detects that there are no agents online.