livechat / chat-window-android

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

setUpWindow(configuration) doesn't update user name or email #64

Closed rhydiant closed 2 years ago

rhydiant commented 3 years ago

Following these integration instructions - https://developers.livechat.com/docs/getting-started/installing-livechat/android-widget/#full-screen-window

Calling setUpWindow(configuration) will not update the users name or email address. This is an issue when switching users in our app, as the previous user details are used in chats. Calling ChatWindowView.clearSession(Context) doesn't resolve the issue either.

As a workaround, we are using ChatWindowActivity which doesn't provide the same capabilities we need (to detect when chat messages are received when the chat window is closed).

Using Android LiveChat SDK v2.1.5.

nomyzs commented 3 years ago

Hello @rhydiant !

Apologies for late response. You are right. Configuration isn't reflected in the chat form after clearing the session. I will fix that as soon as I can.

For now however, I was able to find another workaround that could suit you more than using ChatWindowActivity.

You could remove the view added by ChatWindowView.createAndAttachChatWindowInstance(getActivity()); like so:

public static void detachChatWindowInstance(@NonNull Activity activity, @NonNull ChatWindowView view) {
    final ViewGroup contentView = (ViewGroup) activity.getWindow().getDecorView().findViewById(android.R.id.content);
    contentView.removeView(view);
}

and then create and attach ChatWindowView as you did before with new configuration.

Sorry for the inconvenience and thank you for reporting this!

nomyzs commented 3 years ago

Hey @rhydiant

There is new version brewing that should help to solve your issue in a more convenient way. No, you can fully reload your chat window when your configuration changes. Check 2.2.0rc1 . This version also should make things more readable and cleaner. So if you decide to use that version, you might need to do really small changes in your code: migration guide