Skip to content
This repository has been archived by the owner on Nov 21, 2021. It is now read-only.

not possible to continue a chat session #36

Open
KorbinianMossandl opened this issue Sep 21, 2021 · 11 comments
Open

not possible to continue a chat session #36

KorbinianMossandl opened this issue Sep 21, 2021 · 11 comments

Comments

@KorbinianMossandl
Copy link

if you don't end the chat session via _zendeskChat.endChat() because you want to let a user come back to the same chat session it is not possible because

_zendeskChat.providersStream?.listen((providerModel) {
  setState(() {
    _providerModel = providerModel;
  });
});

will never set the _providerModel. Only if someone sends a message the listen method will be triggered and the _providerModel will be set and show all the history.
So i think we need a change where subscribing to the stream always updates _providerModel if there already is a chat history.

@rupas385
Copy link

@KohlsAdrian same problem here.

The example still with circular loading until new message sent from the agent or agent start typing in the meantime the app only show a circular loading.

@rupas385
Copy link

I notice this problem only affect on Android, on iOS works well.

For reproduce:

1.- Connect to chat (works well)
2.- Sent a message (works well)
3.- tap on back button and call dispose and disconnect
4.- return to chat and see that only see the circular indicator until agent start typing or sent a message

@KorbinianMossandl
Copy link
Author

you are right, it seems to only affect android. so imo we need a fix where the existing model is always send to a subscriber the moment he subscribes.
My temporary fix for the moment is to save the model and reload it if the chat was not ended. but thats just a workaround imo.

@rupas385
Copy link

Fro the moment my solution is instead of compare if provider model is null I compare if the connection status is connected, if yes then show the chat screen, then when the user send a new message the user recover the history of the chat with the last message. This behaviour I already see in other apps.

The other problem I notice is when the apk is compiled after send a message the chat changed with state CONNECTION FAILED. @KorbinianMossandl you notice this problem? Remember only compiled apk. Simulator or compile throught Android Studio works well.

@KorbinianMossandl
Copy link
Author

i get a very unstable connection in general. but i think that is just zendesk. I added a reconnect button so the user can try to reconnect whenever it happens.

@rupas385
Copy link

yep, but only when I compile de APK? its very strange...

@KorbinianMossandl
Copy link
Author

KorbinianMossandl commented Sep 24, 2021

yep, but only when I compile de APK? its very strange...

do you have different zendesk keys in your build settings based on type of build? like zendesk sandbox key when doing dev builds and normal key when doing prod builds? because sandbox gives me way more disconnects/unstable connection .

@KohlsAdrian
Copy link
Owner

KohlsAdrian commented Sep 25, 2021

you should reinitialize the providers, you should call .dispose() to release and .startProviders() to restart it, I won't release providers on .endChat() in native side, because is not the right way.
This is an expected behaviour

@rupas385
Copy link

rupas385 commented Sep 27, 2021

you should reinitialize the providers, you should call .dispose() to release and .startProviders() to restart it, I won't release providers on .endChat() in native side, because is not the right way.
This is an expected behaviour

But why on iOS works fine and this problem only occurs in Android?

And why the providers starts automatically after the agent sent a message or start typing? If the startProviders() not called not have sense that the apps start works when agent start typing or sent message, not?

@KorbinianMossandl
Copy link
Author

you should reinitialize the providers, you should call .dispose() to release and .startProviders() to restart it, I won't release providers on .endChat() in native side, because is not the right way.
This is an expected behaviour

you missunderstood. i do .dispose() and i do .startProviders() each time. but i dont do .endChat() when i want to keep the chat session alive. This is according to the native sdk documentation. And it also works if you store the last provder model and reload is.
the only issue is that you package does not send the last/current state when a new subscriber subscribes in this case.

@diegogarciar
Copy link

Hi, I think I'm having the same issue on iOS when I hot restart the application and the stream is reset. Anyone experiencing this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants