livechat / chat-window-android

LiveChat mobile chat window for Android
https://developers.livechatinc.com/mobile/android/
MIT License
23 stars 28 forks source link

"Couldn't load chat" overlay when trying to launch from fragment with no/bad internet #34

Closed smckenzieSP closed 4 weeks ago

smckenzieSP commented 4 years ago

Is there any way I can customize this, have it trigger my own custom alert, or at least hide it?

nomyzs commented 4 years ago

Hey @smckenzieSP !

Can you take a look at v2.1.0 of this widget? There you can override onError and return true so you can take full control of displaying errors. Let me know if that helps, or you have any suggestions regarding the library!

smckenzieSP commented 4 years ago

Hi @nomyzs, Thanks for the reply.

I've upgraded to v2.1.0 and implemented onError returning true but it doesn't get triggered by this particular connection error. I now get an error "Couldn't load chat." with a reload button which is better but it is still transparent and hard to read.

nomyzs commented 4 years ago

Morning @smckenzieSP !

Thanks a lot for checking! I think I understand. This issue has two parts, first one when the internet is lost after the chat window has been initialized. Second, which you're referring to, is when there is no internet on initialization. Going to address the second scenario and should have a new version soon. Will let you know here :)

nomyzs commented 4 years ago

Hey @smckenzieSP

Sorry, I didn't let you know, but 2.1.1 is out. I think it's worth updating ;)

smckenzieSP commented 4 years ago

@nomyzs hey I just tested out the new build and found some bugs. https://www.youtube.com/watch?v=q0PUPIcMSE4 here's a screen recording. 1) There's no refreshing once you get the "Web page not available" page 2) Once you've started chat there's constant polling and each error adds another "Unable to connect" alert 3) I didn't get this on video but the original warning w/ no background and the refresh button appears beneath the "Unable to Connect" alert and there's no way to dismiss it

nomyzs commented 4 years ago

@smckenzieSP Thank you so much for your feedback! I missed a case when configuration fails due to no internet because when testing no internet connection, the configuration was cached... Sorry about that. Anyway, I've made some amendments in version 2.1.2.

The update should address your 1st point.

Regarding your 2nd point, please see documentation about error handling or this example

I am not sure I understood your 3rd issue. Could you check if the above helps? If the problem persists, could you share with me your implementation of onError method callback?

smckenzieSP commented 4 years ago

@nomyzs I'm sorry, I completely forgot about my changes in onError so I thought that your update that fixed it was creating my alert message. You can ignore points 2 and 3.

Unfortunately I still have the old error message. Screenshot attached. I just need a non-transparent background on this and a button to close the message without calling to refresh. This is showing when onError is set to false and it does not go away once I am reconnected to the internet, even after I hit refresh.

If I set onError to true I will get the same error as before with the "Web page not available" and no way to refresh/reconnect after internet comes back. This is all with v2.1.2

Screenshot_20200415-115519_Dev SaskPower

nomyzs commented 4 years ago

Good Morning @smckenzieSP :)

Unfortunately I still have the old error message. Screenshot attached. I just need a non-transparent background on this and a button to close the message without calling to refresh. This is showing when onError is set to false and it does not go away once I am reconnected to the internet, even after I hit refresh.

I am assuming you are using the createAndAttachChatWindowInstance method to include your chatwindow. How about setting background on that view? Smth like this

chatWindow.setBackgroundColor(Color.MAGENTA);

If I set onError to true I will get the same error as before with the "Web page not available" and no way to refresh/reconnect after the internet comes back.

If you return true, you will not see any error handling on the chat window side - meaning logic to show an overlay with the reload button. Maybe you can refer to this example to see conditions you could use to implement your own error view and trigger chat window reload if isn't enough.

That being said, I think it would be a good idea to provide a way to include custom error views in chat window configuration and it's something we plan to do going forward.

Hope that helps! But let me know :)

smckenzieSP commented 4 years ago

@nomyzs sorry it took me so long to get back to this. I don't think setting the background colour is a great solution, It would require disabling all buttons on every page the chat is used on as they are still clickable beneath the background. The reload button also doesn't appear to function properly. If I turn off my wifi to trigger the warning, then turn it back on to reload, the chat won't pop up and the message won't go away.

Edit: In regards to the second suggestion, I'm always going to get unwanted behaviour regardless of if it is returning true or false. If I return true I could make my own warning, but it is still going to take me to a webview stating "Web page not available"

nomyzs commented 1 month ago

Hello @smckenzieSP , it's been a while... I hope you're doing good!

I have a surprise for you. The issue you reported - the error view not disappearing on reload - should be fixed with today's release - v2.3.2

nomyzs commented 4 weeks ago

Hopefully, we went in the right direction with the update, and the issue is fixed. Closing this, but feel free to reach out when you have any feedback or problems.