parley-messaging / android-library

Parley Android app library
MIT License
3 stars 3 forks source link

Chat keeps scrolling to bottom #53

Closed mennovogel closed 3 months ago

mennovogel commented 3 months ago

The chat keeps scrolling to the bottom if the last or second-last chat message is visible. This is partly due to our implementation, because we use a polling mechanism to update the chat, instead of push. But I don't see a reason why this works like this. There is already a check in place to see if new messages have been downloaded, if the messages are the same the view should not scroll.

https://github.com/parley-messaging/android-library/assets/2795333/a940bb56-0c63-4371-b116-d64c2291e60b

This behaviour is caused by the ParleyView that listens for onReceivedMoreMessages(..), this function calls renderMessages(), this triggers a scroll if you are already close to the bottom (last or second-last message is visible).

I think that onReceivedMoreMessages(..) should only be called if the received messages are not the same.

alexkok commented 3 months ago

Thanks for reporting. Since this is intended to trigger only on reconnecting, it was never an issue earlier.

But the listener could be prevented to happen when no change is done yes 👍

mennovogel commented 3 months ago

Thanks for merging this, could you also create a new version with this fix please?

alexkok commented 3 months ago

Sure! Will do that tomorrow morning 👍

alexkok commented 3 months ago

Fixed in 3.9.5 🚀